Full Version : Conditional spawns
xmlspawner >>Q&A >>Conditional spawns
<< Prev | Next >>
Bujinsho- 01-27-2007
Maybe I'm getting tired, but tonight I just can't get my head round the IF/condition/thenspawn/elsespawn syntax and I would really appriciate some help with this one.
In effect, I'm trying to make a (quest)spawner that spawns a creature with different modifiers depending on the Karma of the triggering mobile.
I put in:
IF/GETONTRIGMOB,karma>0/thenspawn/angelofheaven/ATTACH/xmldialog,sacrificespirit/cantwalk/true/direction/south/name/Spirit of Sacrifice/elsespawn/angelofheaven
and it tells me invalid elsegroup arg to IF
Obviously I'm misunderstanding the syntax. any chance somebody could put me straight on this?
ArteGordon- 01-27-2007
IF is most useful when used with sequential spawning. For simple conditional spawns like the one you are describing, I would use the #CONDITION keyword, like this
subgroup 1:#CONDITION,GETONTRIGMOB,karma>0 ; angelofheaven/ATTACH/xmldialog,sacrificespirit/cantwalk/true/direction/south/name/Spirit of Sacrifice
subgroup 1:#CONDITION,GETONTRIGMOB,karma<1 ; angelofheaven
since they are in the same subgroup the spawner will try to spawn both of them together, but the condition tests for each entry will lead to only one of them actually spawning based on the karma test.
--------------------
To do what you wanted using the IF syntax, you would set up the spawner for sequential spawning, and then add entries like
subgroup 1: IF/GETONTRIGMOB,karma>0/10/20
subgroup 1: GOTO/1
subgroup 10: angelofheaven/ATTACH/xmldialog,sacrificespirit/cantwalk/true/direction/south/name/Spirit of Sacrifice
subgroup 20: angelofheaven
using the syntax
IF/condition/thenspawn[/elsespawn]
the thenspawn and elsespawn need to be subgroup numbers.
the use of the GOTO/1 means that it wont sequentially advance past subgroup 1 since it will always be forced to go back to 1 after spawning 1, so subgroups 10 and 20 will only be spawned via the IF condition.
--------------------
And here is another way that I can think of doing it which may be a little cleaner
subgroup 1: angelofheaven
subgroup 1:#CONDITION,GETONTRIGMOB,karma>0 ; SETONSPAWN,1/ATTACH/xmldialog,sacrificespirit/cantwalk/true/direction/south/name/Spirit of Sacrifice
Note that this works because when you use SETONSPAWN,1 to refer to the spawn on subgroup 1, that is going to be the angelofheaven which was just spawned (spawns in the same subgroup are spawned in the order listed in the gump), so if it passes the condition test, it just adds those extra things to the existing spawn, if the test fails you are just left with the unaltered spawn.
Bujinsho- 01-27-2007
Thanks for the quick response Arte ... I'll give it a go.
It's been said before but it's always worth repeating ... it's an awesome system ... and the more I get into it, the better it gets. It just keeps on suprising me with it's sheer flexibility. It's become the backbone of my fledgling shard. Great work and great support. Thanks again Arte
**EDIT**
I like Option 3 best btw ... cleaner indeed