EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Random Race/Class/Texture/Weapons on spawn (https://www.eqemulator.org/forums/showthread.php?t=34941)

Luccian 02-19-2012 02:34 PM

Random Race/Class/Texture/Weapons on spawn
 
Good afternoon once again,
I am looking to try and add some variance to the way mobs look when they spawn. This is especially true when it comes to humanoid types of NPCs that could easily have variable type of equipment and a diverse race environment.

Basically for this particular case I have some Rogues in an encampment. They are all similarly named at the moment so I could use just the one script. I want to be able to have them spawn and randomly choose X race, X class, X prim/ sec weapon graphic, X texture.

I know it needs to be an Event_Spawn type script, I just don't know how to format it really. I've looked around the forum for examples I could pick apart and use, but haven't had much luck. I appreciate any help.

Luccian 02-19-2012 03:09 PM

So I kinda worked up something I feel it will/should resemble for a particular instance for me. I just don't know what to put where I placed "???"

Code:

#By: Luccian
#This script will be used to have variable spawn appearances of NPCs. Through class, texture, race, wep1, and wep2.

sub EVENT_SPAWN
{
# Random Races: Human, Barbarian, Erudite, Wood Elf, High Elf, Dark Elf, Half Elf Dwarf
#            : Troll, Ogre, Halfling, Gnome, Iksar, Vah Shir, Guktan, Drakkin
        my $randomrace=quest::ChooseRandom(1,2,3,4,5,6,7,8,9,10,11,12,128,130,330,522);
        quest::???($randomrace);

# Random Classes: Warrior, Cleric, Paladin, Ranger, Shadow Knight, Druid, Monk, Bard, Rogue
#              : Shaman, Necromancer, Wizard, Magician, Enchanter, Beastlord, Berserker
        my $randomclass=quest::ChooseRandom(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
        quest::???($randomclass);

# Random Texture: Cloth, Leather, Chain, Plate
        my $randomtexture=quest::ChooseRandom(0,1,2,3);
        quest::???($randomtexture);

# Random Weapons: Revamped Old Weapons- 2 Handed Sword, Longsword, Dagger, Nail Board, Broken Bottle
        my $randomweapon=quest::ChooseRandom(10648,10649,10650,10688,10692);

#Weapon1
        quest::wearchange(7, $randomweapon);

#Weapon2
        quest::wearchange(8, $randomweapon);
}


Luccian 02-19-2012 03:21 PM

Well thanks for a friend (Jenkos) I was given the idea to look at a plugin he saw, weapon_tools, and kinda pick it apart.

From that I was able to find the weapon 1 and weapon 2 commands I think. Gonna test a bit.

trevius 02-20-2012 03:45 AM

You might take a look at this plugin for giving random appearances as far as face, hair, etc:

Code:

#Usage: plugin::RandomFeatures(Mob);
# Chooses a random set of facial features for playable races (NPCs or Players)

sub RandomFeatures {

        my $Mob = $_[0];

        if ($Mob)
        {
                $MobRace = $Mob->GetRace();
               
                if ($MobRace <= 12 || $MobRace == 128 || $MobRace == 130 || $MobRace == 330 || $MobRace == 522)
                {
                       
                        $Gender = $Mob->GetGender();
                        $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
                                        $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
                                        $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
                                        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
                                        $HairColor = plugin::RandomRange(0, 19);
                                        if ($Gender == 0) { #
                                                $HairStyle = plugin::RandomRange(0, 3);
                                        }
                                        if ($Gender == 1) { #
                                                $HairStyle = plugin::RandomRange(0, 2);
                                        }
                                }
                                case (5)
                                {
                                        # HighElf
                                        $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
                                        $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
                                        $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
                                        $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
                                        $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
                                        if ($Gender == 1) { #
                                                $HairStyle = plugin::RandomRange(0, 3);
                                                $HairColor = plugin::RandomRange(0, 23);
                                        }
                                }
                                case (11)
                                {
                                        # Halfling
                                        $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
                                        $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
                                        $LuclinFace = plugin::RandomRange(0, 9);
                                }
                                case (130)
                                {
                                        # VahShir
                                        $LuclinFace = plugin::RandomRange(0, 9);
                                }
                                case (330)
                                {
                                        # Froglok
                                        $LuclinFace = plugin::RandomRange(0, 9);
                                }
                                case (522)
                                {
                                        # Drakkin
                                        $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");
                        $Mob->SendIllusion($MobRace,$Gender,$Texture,$HelmTexture,$LuclinFace,$HairStyle,$HairColor,$Beard,$BeardColor,$DrakkinHeritage,$DrakkinTattoo,$DrakkinDetails); # ,$size
                }
        }

}

For weapons, you should be able to use this plugin with these settings:

Code:

plugin::RandomWeapons(10648, 10692, 100, 0, 0, 0, 0);

Luccian 02-20-2012 06:02 AM

I was looking at the plugins, however I am a little embarrassed to say I seemed to fail at properly implementing in/ them in a spawn script. I am also unsure as to how much of a burden it may put on the server we may get to host us eventually.

If I could learn how to do these types of things without the plugin first, to understand why the plugin does what it does (if that makes sense), then I would feel better about using them more frequently because I have the knowledge of its inner working.

I did see both plugins earlier in the day, and was looking at how they were constructed. I think I am beginning to see how they are able to randomize everything though.

Luccian 02-21-2012 02:10 PM

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?

Akkadius 02-21-2012 04:13 PM

Quote:

Originally Posted by Luccian (Post 207447)
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.

Luccian 02-21-2012 10:11 PM

Super!
Huge help Akkadius! Features, weapon, etc.. all changed, makes those poor bandits seem more like individuals now.
Your plugin post is great. I saw how the illusion_tool allowed for race/ gender randomization but i didn't really know how to use it. Your plugin along with tutorial-ish post worked great. I do seem to be having a small issue with the texture selection. No matter what I use it shows them as wearing nothing/ cloth type armor as opposed to leather, chain, plate and whatnot.

Here is what I came up with with the help I got here:

Code:

sub EVENT_SPAWN
{
quest::settimer("feature",5);
}

sub EVENT_TIMER
{
        if ($timer eq "feature")
        {
                quest::stoptimer("feature");
                plugin::RandomWeapons(10688, 10693, 100, 0, 0, 1, 1);
                plugin::SpawnDynNPC(quest::ChooseRandom(1,2,3,4,5,6,7,8,9,10,11,12,128,130,330,522),quest::ChooseRandom(1,2,3),quest::ChooseRandom(0,1));
        }
}

This allowed me to use all races, both genders, and should allow for leather, chain, and plate texture unless im mistaken?

trevius 02-21-2012 10:22 PM

You can also set a random armor tint by adding something like this after all of your other changes are done:

Code:

                #my $Material = plugin::RandomRange(1,3);        # Random armor texture
                my $Material = 2;
                $Color = (plugin::RandomRange(0,255) & 0xFF) << 16;
                $Color |= (plugin::RandomRange(0,255) & 0xFF) << 8;
                $Color |= (plugin::RandomRange(0,255) & 0xFF);
                $Color |= 0xFF << 24;
                for (my $slot = 0; $slot < 7; $slot++)
                {
                        $npc->WearChange($slot, $Material, $Color);
                }

You could add robes in there as well if you wanted to by adding the Materials 12 to 18 or whatever when it does the chest slot in the for loop.

Akkadius 02-21-2012 10:26 PM

Quote:

Originally Posted by Luccian (Post 207459)
Super!
Huge help Akkadius! Features, weapon, etc.. all changed, makes those poor bandits seem more like individuals now.
Your plugin post is great. I saw how the illusion_tool allowed for race/ gender randomization but i didn't really know how to use it. Your plugin along with tutorial-ish post worked great. I do seem to be having a small issue with the texture selection. No matter what I use it shows them as wearing nothing/ cloth type armor as opposed to leather, chain, plate and whatnot.

Here is what I came up with with the help I got here:

Code:

sub EVENT_SPAWN
{
quest::settimer("feature",5);
}

sub EVENT_TIMER
{
        if ($timer eq "feature")
        {
                quest::stoptimer("feature");
                plugin::RandomWeapons(10688, 10693, 100, 0, 0, 1, 1);
                plugin::SpawnDynNPC(quest::ChooseRandom(1,2,3,4,5,6,7,8,9,10,11,12,128,130,330,522),quest::ChooseRandom(1,2,3),quest::ChooseRandom(0,1));
        }
}

This allowed me to use all races, both genders, and should allow for leather, chain, and plate texture unless im mistaken?

That should work fine. I think the only reason why I didn't post it is that you need to keep in mind that people who zone in after this has fired off, some clients may not view textures and races correctly as not everything sends. I never investigated as to why, but I made a hack that resent the information for NPC's whenever a client got close to the NPC (Proximity) via Perl, not the greatest solution and depends on how many NPC's you want to use this for to what resources it takes up. I'm sure all of this is not reassuring, maybe someone else could answer as to why illusion packets aren't reliably sent after setting an NPC's visuals appearances using Perl.

Luccian 02-22-2012 05:55 AM

Quote:

Originally Posted by Akkadius (Post 207461)
That should work fine. I think the only reason why I didn't post it is that you need to keep in mind that people who zone in after this has fired off, some clients may not view textures and races correctly as not everything sends.

I saw this after I went to sleep. I woke up and fiddled some more and saw that after zoning out and in I could at least see the chest texture, but everything else was cloth looking. This is really only a minor inconvenience. I can just set individual textures and such worst case scenario. I really really appreciate your help. Both you and Trev =)

One final question though regarding this all (at least I hope). Is there a way to choose specific weapons only, as opposed to a ranged using the RandomWeapons plugin? Example being I wanted to use weapon 1,3,11,13,27,and 62 but nothing in between.

sorvani 02-22-2012 12:16 PM

That is what chooserandom does.

quest::ChooseRandom(1,3,11,13,27,62)

Edit to clarify: If you do not want to set the weapon yourself but still use the plugin, I would use ChooseRandom and then pass the same result into the plugin instead of a range.

Luccian 02-23-2012 10:14 AM

Quote:

Originally Posted by sorvani (Post 207468)
That is what chooserandom does.

quest::ChooseRandom(1,3,11,13,27,62)

Edit to clarify: If you do not want to set the weapon yourself but still use the plugin, I would use ChooseRandom and then pass the same result into the plugin instead of a range.

Personally I would prefer not to use the RandomWeapons plugin all together. Its an excellent tool, however I feel I have more control if I were able to just ChooseRandom. I just dont know how to use it to select a primary/ sec item.

I thought the entry was quest::wearchange(7,(weapon#)), where I could make the weapon number a chooserandom, however I was mistaken.

Quote:

Originally Posted by Luccian
# Random Weapons: Revamped Old Weapons- 2 Handed Sword, Longsword, Dagger, Nail Board, Broken Bottle
my $randomweapon=quest::ChooseRandom(10648,10649,1065 0,10688,10692);

#Weapon1
quest::wearchange(7, $randomweapon);

#Weapon2
quest::wearchange(8, $randomweapon);


joligario 02-23-2012 12:19 PM

Is that vBulletin or is there really a space in 10650 weapon?

Harcourt 02-23-2012 03:39 PM

No space, probably just a typo.

Luccian 02-23-2012 07:39 PM

Quote:

Originally Posted by Luccian (Post 207494)
Personally I would prefer not to use the RandomWeapons plugin all together. Its an excellent tool, however I feel I have more control if I were able to just ChooseRandom. I just dont know how to use it to select a primary/ sec item.

I thought the entry was quest::wearchange(7,(weapon#)), where I could make the weapon number a chooserandom, however I was mistaken.

Quote:

Originally Posted by joligario
Is that vBulletin or is there really a space in 10650 weapon?

Quote:

Originally Posted by Harcourt
No space, probably just a typo.

This small amount of chat made me think I mistakenly put a space in my initial submission, and found that I had infact done that. Which caused the wearchange quest to no work correctly. SO all in all, I got the last answer I was looking for =)

Thanks!! Now I can randomize the npcs, textures, races, genders and even select certain weapons to apply based on location. You're all a huge huge help.

Luccian 02-23-2012 07:42 PM

Just for closure, the final result I used was this. In the future if anyone has questions similar to mine they could always save the trouble and check out here!

Code:

sub EVENT_SPAWN
{
quest::settimer("feature",1);
}

sub EVENT_TIMER
{
        if ($timer eq "feature")
        {
                quest::stoptimer("feature");
                my $randomweapon=quest::ChooseRandom(10648,10649,10650,10688,10692);
                        quest::wearchange(7,$randomweapon);
                        quest::wearchange(8,$randomweapon);
                plugin::SpawnDynNPC(quest::ChooseRandom(1,2,3,4,5,6,7,8,9,10,11,12,128,130,330,522),quest::ChooseRandom(1,2,3),quest::ChooseRandom(0,1));
                plugin::RandomFeatures($npc);
        }
}



All times are GMT -4. The time now is 12:22 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.