Synchronous vs Asynchronous Effects
- Many effects occur in sequence. It's important to understand that All effects are near instantaneous before moving on to the next one.
- Effects that have a time component operate asynchronously. These might be setting a timer, or starting an animation
- <StartTag> is used in effects to signify that the effect is to not occur unless the tag specified is called.
- Often, <StartTag> is used as a "callback".
Observe the following script from the StoneStaff file:
<Timer> <Duration>0.2</Duration> <CallTag>DealDamage</CallTag> <EndTag>DealDamage</EndTag> </Timer> <ModifyEnergy> <TargetEntity>Source</TargetEntity> <Amount>-45</Amount> </ModifyEnergy> <DoAction name="DoStone"> <Simulation/> <StartTag>DealDamage</StartTag> <TargetEntity Angle="70" Distance="1200" InnerSortDistance="0" InnerConeWidth="400" Ignore1="Warmage">Cone</TargetEntity> <ActionName>WeaponStoneStaffSecondaryStoneStartAction</ActionName> </DoAction>
It's important to note the actual sequence of events here:
- Timer occurs first, and starts a timer. The action does not wait for the timer to finish before moving on to the next effect
- ModifyEnergy is called next.
- DoAction has a <StartTag> with the tag "DealDamage" listed, which means this effect does not occur until that tag is activated or "called". So for now, this effect is ignored.
- All effects after DoEffect are executed.
- The first timer finishes, and so it executes the "callback" using <CallTag>, giving the "DealDamage" tag name.
- Since the DealDamage tag was called, NOW the DoAction labeled "DoStone" occurs.
Nested XML Tags
These tags are nested under the <Effects> tag:
A timer kicks off and performs and activates a "tag" upon completion. See <Timer> for more information.
Activates a particular tag name, evoking all other effects which have that tag under a <StartTag> See <ActivateTag> for more information.
Performs another <Action>. Best practice is to keep the Actions small and as granular as possible so they can be re-used, are more readable, and are easier to troubleshoot. See <DoAction> for more information.