Quote:
Originally Posted by Luccian
I read your thread about the proper usage of both plugins but I'm afraid I don't see how it's supposed to be put in an EVENT_SPAWN format.
I start a timer of 1 sec as you recommended, and once the timer is up it will use both plugins to randomize my poor misunderstood bandits with hearts of gold race/ features as well as equipment. I know you've answered nearly all of my questions up to this point, and I thank you for your helping a newer dev, but would you mind giving me an example of proper use?
|
This will answer your example question for weapons
http://www.eqemulator.org/forums/showthread.php?t=30637
In the first post is an example snippet, within that timer you can have all of your randomized features be executed:
Code:
sub EVENT_SPAWN {
quest::settimer("WeaponChange", 5);
}
sub EVENT_TIMER {
if($timer eq "WeaponChange") {
quest::stoptimer("WeaponChange");
#Any random weapon and shield available through SoF
plugin::RandomWeapons(1, 11169, 50, 200, 230);
plugin::RandomFeatures($npc); ### Simply changes face, hair, etc.
}
}
You could also utilize a plugin I created but never posted for whatever reason, it will randomize race, texture for a particular NPC:
The below is an example of the code usage, you could use quest::ChooseRandom inside any of the arguments to randomize certain things.
#SpawnDynNPC([race, 0 or "random"=Random Player Race, Texture, Gender);
Code:
plugin::SpawnDynNPC(quest::ChooseRandom(1, 2, 3, 4, 5, 6, 128, 130), 3, 0);
Below is the plugin code you place in your plugins folder and name it whatever.pl
Code:
#SpawnDynNPC([race, 0 or "random"=Random Player Race, Texture, Gender);
sub SpawnDynNPC {
my $MobRace = $_[0];
my $Texture = $_[1];
my $Gender = $_[2];
my $npc = plugin::val('$npc');
if($MobRace eq "random" || $MobRace == 0){
$MobRace = quest::ChooseRandom(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 128, 130, 330, 522);
}
if ($MobRace <= 12 || $MobRace == 128 || $MobRace == 130 || $MobRace == 330 || $MobRace == 522)
{
$Texture = 0xFF;
$HelmTexture = 0xFF;
$HairColor = 0xFF;
$BeardColor = 0xFF;
$EyeColor1 = 0xFF;
$EyeColor2 = 0xFF;
$HairStyle = 0xFF;
$LuclinFace = 0xFF;
$Beard = 0xFF;
$DrakkinHeritage = 0xFFFFFFFF;
$DrakkinTattoo = 0xFFFFFFFF;
$DrakkinDetails = 0xFFFFFFFF;
# Set some common feature settings
$EyeColor1 = plugin::RandomRange(0, 9);
$EyeColor2 = plugin::RandomRange(0, 9);
$LuclinFace = plugin::RandomRange(0, 7);
# Adjust all settings based on the min and max for each feature of each $MobRace and $Gender
#plugin::Debug("About to switch case");
use Switch;
switch ($MobRace)
{
case (1)
{
# Human
$size = 7;
$HairColor = plugin::RandomRange(0, 19);
if ($Gender == 0) {
$BeardColor = $HairColor;
$HairStyle = plugin::RandomRange(0, 3);
$Beard = plugin::RandomRange(0, 5);
}
if ($Gender == 1) {
$HairStyle = plugin::RandomRange(0, 2);
}
}
case (2)
{
# Barbarian
$size = 7;
$HairColor = plugin::RandomRange(0, 19);
$LuclinFace = plugin::RandomRange(0, 87);
if ($Gender == 0) { #
$BeardColor = $HairColor;
$HairStyle = plugin::RandomRange(0, 3);
$Beard = plugin::RandomRange(0, 5);
}
if ($Gender == 1) { #
$HairStyle = plugin::RandomRange(0, 2);
}
}
case (3)
{
# Erudite
$size = 6;
if ($Gender == 0) { #
$BeardColor = plugin::RandomRange(0, 19);
$Beard = plugin::RandomRange(0, 5);
$LuclinFace = plugin::RandomRange(0, 57);
}
if ($Gender == 1) { #
$LuclinFace = plugin::RandomRange(0, 87);
}
}
case (4)
{
# WoodElf
$size = 5;
$HairColor = plugin::RandomRange(0, 19);
if ($Gender == 0) { #
$HairStyle = plugin::RandomRange(0, 3);
}
if ($Gender == 1) { #
$HairStyle = plugin::RandomRange(0, 2);
}
}
case (5)
{
# HighElf
$size = 6;
$HairColor = plugin::RandomRange(0, 14);
if ($Gender == 0) { #
$HairStyle = plugin::RandomRange(0, 3);
$LuclinFace = plugin::RandomRange(0, 37);
$BeardColor = $HairColor;
}
if ($Gender == 1) { #
$HairStyle = plugin::RandomRange(0, 2);
}
}
case (6)
{
# DarkElf
$size = 6;
$HairColor = plugin::RandomRange(13, 18);
if ($Gender == 0) { #
$HairStyle = plugin::RandomRange(0, 3);
$LuclinFace = plugin::RandomRange(0, 37);
$BeardColor = $HairColor;
}
if ($Gender == 1) { #
$HairStyle = plugin::RandomRange(0, 2);
}
}
case (7)
{
# HalfElf
$size = 6;
$HairColor = plugin::RandomRange(0, 19);
if ($Gender == 0) { #
$HairStyle = plugin::RandomRange(0, 3);
$LuclinFace = plugin::RandomRange(0, 37);
$BeardColor = $HairColor;
}
if ($Gender == 1) { #
$HairStyle = plugin::RandomRange(0, 2);
}
}
case (8)
{
# Dwarf
$size = 4;
$HairColor = plugin::RandomRange(0, 19);
$BeardColor = $HairColor;
if ($Gender == 0) { #
$HairStyle = plugin::RandomRange(0, 3);
$Beard = plugin::RandomRange(0, 5);
}
if ($Gender == 1) { #
$HairStyle = plugin::RandomRange(0, 2);
$LuclinFace = plugin::RandomRange(0, 17);
}
}
case (9)
{
# Troll
$size = 8;
$EyeColor1 = plugin::RandomRange(0, 10);
$EyeColor2 = plugin::RandomRange(0, 10);
if ($Gender == 1) { #
$HairStyle = plugin::RandomRange(0, 3);
$HairColor = plugin::RandomRange(0, 23);
}
}
case (10)
{
# Ogre
$size = 9;
if ($Gender == 1) { #
$HairStyle = plugin::RandomRange(0, 3);
$HairColor = plugin::RandomRange(0, 23);
}
}
case (11)
{
# Halfling
$size = 3;
$HairColor = plugin::RandomRange(0, 19);
if ($Gender == 0) { #
$BeardColor = $HairColor;
$HairStyle = plugin::RandomRange(0, 3);
$Beard = plugin::RandomRange(0, 5);
}
if ($Gender == 1) { #
$HairStyle = plugin::RandomRange(0, 2);
}
}
case (12)
{
# Gnome
$size = 3;
$HairColor = plugin::RandomRange(0, 24);
if ($Gender == 0) { #
$BeardColor = $HairColor;
$HairStyle = plugin::RandomRange(0, 3);
$Beard = plugin::RandomRange(0, 5);
}
if ($Gender == 1) { #
$HairStyle = plugin::RandomRange(0, 2);
}
}
case (128)
{
# Iksar
$size = 6;
$LuclinFace = plugin::RandomRange(0, 9);
}
case (130)
{
# VahShir
$size = 7;
$LuclinFace = plugin::RandomRange(0, 9);
}
case (330)
{
# Froglok
$size = 5;
$LuclinFace = plugin::RandomRange(0, 9);
}
case (522)
{
# Drakkin
$size = 6;
$HairColor = plugin::RandomRange(0, 3);
$BeardColor = $HairColor;
$EyeColor1 = plugin::RandomRange(0, 11);
$EyeColor2 = plugin::RandomRange(0, 11);
$LuclinFace = plugin::RandomRange(0, 6);
$DrakkinHeritage = plugin::RandomRange(0, 6);
$DrakkinTattoo = plugin::RandomRange(0, 7);
$DrakkinDetails = plugin::RandomRange(0, 7);
if ($Gender == 0) { #
$Beard = plugin::RandomRange(0, 12);
$HairStyle = plugin::RandomRange(0, 8);
}
if ($Gender == 1) { #
$Beard = plugin::RandomRange(0, 3);
$HairStyle = plugin::RandomRange(0, 7);
}
}
}
#plugin::Debug("About to SendIllusion");
quest::npcsize($size);
$npc->SendIllusion($MobRace,$Gender,$Texture, $HelmTexture,$LuclinFace,$HairStyle,$HairColor,$Beard,$BeardColor,$DrakkinHeritage,$DrakkinTattoo,$DrakkinDetails); # ,$size
plugin::RandomFeatures($npc);
}
}
return 1;
Let me know if that helps Reed.
|