Full Version : Pick one from list help
xmlspawner >>Q&A >>Pick one from list help


<< Prev | Next >>

Erinn- 04-21-2007
What I'd like to do is have the loot be a chance at one item from a list. As an example, here is my Leprechaun that I did for St Patricks day:

CODE

AncientLich/BodyValue/400/Female/False
/Name/{RANDNAME,male} the Leprechaun
/Tamable/False/Kills/5
/Hue/RNDLIST,33770,33774,33778,33782,33786
/HairItemID/RNDLIST,12241,8252,8251,8264
/HairHue/RNDLIST,1368,52,2116,1149,1141,1124
/EQUIP/<Boots>
/EQUIP/<ShortPants/Hue/902>
/EQUIP/<Obi/Hue/1175>
/EQUIP/<FancyShirt>
/EQUIP/<JinBaori/Hue/1368>
/EQUIP/<WizardsHat/Hue/1368>
/Fame/9999
/ADD,0.05/<GlassMug,Ale/Name/Leprechaun Ale/Hue/1368>
/ADD,0.05/
<Club/Hue/1368/Name/Shillelagh
/Attributes.Luck/200
/Attributes.WeaponDamage/50
/Attributes.WeaponSpeed/10
/MaxHitPoints/150
/HitPoints/150
/Attributes.SpellChanneling/1
/Attributes.ReflectPhysical/25
/Attributes.RegenHits/5
/WeaponAttributes.HitLeechHits/25>
/ADD,0.05/
<WizardsHat/Hue/1368/Name/Hat of Hiding
/Attributes.Luck/200
/Attributes.NightSight/1
/SkillBonuses.Skill_1_Name/Hiding
/SkillBonuses.Skill_1_Value/10
/MaxHitPoints/100
/HitPoints/100>
/ADD,0.05/
<Boots/ItemID/12228/Name/Boots of Stealth/Hue/1368
/Attributes.Luck/200
/SkillBonuses.Skill_1_Name/Stealth
/SkillBonuses.Skill_1_Value/10>


This gives a .05 chance of each item dropping as loot. I'd prefer to be able to have it set to a, say, .50 chance on dropping one of the items (Leprechaun Ale, Shillelagh, Hat of Hiding or Boots of Stealth). Just can't seem to find anything that works. Any suggestions?

Thanks,
Erinn


ArteGordon- 04-22-2007
you could do something like this, where you combine the SETVAR/GETVAR with #CONDITION statements to make something like a switch/case

subgroup 1:AncientLich/BodyValue/400/Female/False
/Name/{RANDNAME,male} the Leprechaun
/Tamable/False/Kills/5
/Hue/RNDLIST,33770,33774,33778,33782,33786
/HairItemID/RNDLIST,12241,8252,8251,8264
/HairHue/RNDLIST,1368,52,2116,1149,1141,1124
/EQUIP/<Boots>
/EQUIP/<ShortPants/Hue/902>
/EQUIP/<Obi/Hue/1175>
/EQUIP/<FancyShirt>
/EQUIP/<JinBaori/Hue/1368>
/EQUIP/<WizardsHat/Hue/1368>
/Fame/9999
subgroup 1:SETVAR,RandVal/{RND,1,4}
subgroup 1:#CONDITION,{GETVAR,RandVal}=1 ; SETONSPAWN,1/ADD,0.5/<GlassMug,Ale/Name/Leprechaun Ale/Hue/1368>
subgroup 1:#CONDITION,{GETVAR,RandVal}=2 ; SETONSPAWN,1/ADD,0.5/
<Club/Hue/1368/Name/Shillelagh/Attributes.Luck/200/Attributes.WeaponDamage/50/Attributes.WeaponSpeed/10/MaxHitPoints/150/HitPoints/150/Attributes.SpellChanneling/1/Attributes.ReflectPhysical/25/Attributes.RegenHits/5/WeaponAttributes.HitLeechHits/25>
subgroup 1:#CONDITION,{GETVAR,RandVal}=3 ;

etc.


from xmlspawner2.txt
QUOTE

- added the new keywords "SETVAR,varname" and "GETVAR,varname" which can be used to create your own local variables on a spanwer.  These are used in the same way as other SET and GET keywords.  These can be useful when you want to use some value repeatedly as in the following example.

1 SETVAR,MyRand/{RND,1,100}
1 SENDMSG/making a hued set with value {GETVAR,MyRand}
1 platelegs/hue/GETVAR,MyRand
1 platehelm/hue/GETVAR,MyRand
1 platechest/hue/GETVAR,MyRand

This creates a local variable named MyRand, and sets the value of it to a random number between 1 and 100. Note that the local variables hold string values so by using the {} substitution delimiters you assign it the results of evaluating the RND,1,100 keyword instead of the string "RND,1,100"
The contents of the MyRand variable are then used to assign the hue property of the various spawned items using the GETVAR keyword.

Local variables are stored as XmlLocalVariable attachments on the spawner and can be viewed and modified using the [getatt command and targeting the spawner.


Erinn- 04-22-2007
Whoo Hoo! Thankee Sai biggrin.gif