Schm0ftie
06-27-2011, 05:42 PM
Hey guys,
some of you know that I am currently work on a hero, called
Crystal Enchanter, which is basicly a Invoker port. I have
already finished the orb system and started with working at
the abilities that can be created. Currently I want to add
the visual orbs, since they aren't visible around the hero at
the moment. I tried to use a state and refresh it every times
a new orb is set. But my problem is that a state loses his
proxy on refresh. Trying to expire the state before re applying
it seems not to work too (idea was to put the delete orbits
thing in <onexpired>. Maybe you guys have ideas how to
make it. The main problem is that I need to delete old orbits
and spawn new one, every time the player changes the orbs.
I hope someone has a good idea, else I would leave the visual
as it is know, only visible on the ability buttons and do the rest
of the abilities.
For those who want to look into the state, there is the code.
<state
name="State_Crystal_Enchanter_Orbs"
icon="ability_04/icon.tga"
allowtransfer="false"
ishidden="false"
>
<oninflict>
<printvalue label="ORBIT STATE REFRESHED" value="" />
<!-- A orb was activated, new orbs have to be spawn -->
<setaccumulator value="0" />
<setcharges a="0" />
<!-- Get current orbs -->
<pushability name="Ability_Crystal_Enchanter1" />
<setent0 entity="stack_entity" />
<pushentityproxy entity="ent0" />
<changeaccumulator entity="stack_entity" b="0" op="add" />
<setvar0 a="result" />
<pushability name="Ability_Crystal_Enchanter2" />
<setent1 entity="stack_entity" />
<pushentityproxy entity="ent1" />
<changeaccumulator entity="stack_entity" b="0" op="add" />
<setvar1 a="result" />
<pushability name="Ability_Crystal_Enchanter3" />
<setent2 entity="stack_entity" />
<pushentityproxy entity="ent2" />
<changeaccumulator entity="stack_entity" b="0" op="add" />
<setvar2 a="result" />
<evaluate a="var0" b="var1" op="add" />
<evaluate a="result" b="var2" op="add" />
<setvar3 a="result" />
<!-- Get current number of active orbs -->
<addcharges entity="ent0" count="0" />
<changeaccumulator b="result" op="add"/>
<addcharges entity="ent1" count="0" />
<changeaccumulator b="result" op="add" />
<addcharges entity="ent2" count="0" />
<changeaccumulator b="result" op="add" />
<printvalue label="Accumulator - active orbs" value="accumulator" />
<!-- ################################################# -->
<!-- Only ONE orb active, only ONE needs to be spawned -->
<!-- ################################################# -->
<compare a="accumulator" b="1" op="eq">
<!-- One orb active -->
<compare a="var0" b="1" op="eq">
<!-- Red orb is active, spawn it -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Red"
source="source_entity"
target="source_entity"
orbitstartingtheta="120"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<compare a="var1" b="1" op="eq">
<!-- Green orb is active, spawn it -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Green"
source="source_entity"
target="source_entity"
orbitstartingtheta="120"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<compare a="var2" b="1" op="eq">
<!-- Blue orb is active, spawn it -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Blue"
source="source_entity"
target="source_entity"
orbitstartingtheta="120"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
</compare>
<!-- ################################################## #### -->
<!-- Only TWO orbs are active, only TWO needs to be spawned -->
<!-- ################################################## #### -->
<compare a="accumulator" b="2" op="eq">
<!-- 1 Orb is already active, activate another one -->
<!-- Get the orb that is at position 1 -->
<compare a="var0" b="1" op="eq">
<!-- Red orb is at position 1 -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Red"
source="source_entity"
target="source_entity"
orbitstartingtheta="120"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<compare a="var1" b="1" op="eq">
<!-- Green orb is at position 1 -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Green"
source="source_entity"
target="source_entity"
orbitstartingtheta="120"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<compare a="var2" b="1" op="eq">
<!-- Blue orb is at position 1 -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Blue"
source="source_entity"
target="source_entity"
orbitstartingtheta="120"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<!-- Get the orb that is at position 2 -->
<!-- Check if one orb is activated twice -->
<compare a="var3" b="3" op="eq">
<!-- 2 different orbs are active -->
<compare a="var0" b="2" op="eq">
<!-- Red Orb is at position 2 -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Red"
source="source_entity"
target="source_entity"
orbitstartingtheta="240"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<compare a="var1" b="2" op="eq">
<!-- Green Orb is at position 2 -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Green"
source="source_entity"
target="source_entity"
orbitstartingtheta="240"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<compare a="var2" b="2" op="eq">
<!-- Blue Orb is at position 2 -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Blue"
source="source_entity"
target="source_entity"
orbitstartingtheta="240"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
</compare>
<else>
<!-- Two orbs of the same type are active -->
<compare a="var0" b="1" op="eq">
<!-- Two red orbs are active -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Red"
source="source_entity"
target="source_entity"
orbitstartingtheta="240"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<compare a="var1" b="1" op="eq">
<!-- Two green orbs are active -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Green"
source="source_entity"
target="source_entity"
orbitstartingtheta="240"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<compare a="var2" b="1" op="eq">
<!-- Two blue orbs are active -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Blue"
source="source_entity"
target="source_entity"
orbitstartingtheta="240"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
</else>
</compare>
<!-- ################################################## ###### -->
<!-- all THREE orbs are active, all THREE needs to be spawned -->
<!-- ################################################## ###### -->
<compare a="accumulator" b="3" op="eq">
<!-- Three orbs are active -->
<!-- First orb -->
<compare a="var0" b="1" op="eq">
<!-- Red orb is active, spawn it -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Red"
source="source_entity"
target="source_entity"
orbitstartingtheta="120"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<compare a="var1" b="1" op="eq">
<!-- Green orb is active, spawn it -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Green"
source="source_entity"
target="source_entity"
orbitstartingtheta="120"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<compare a="var2" b="1" op="eq">
<!-- Blue orb is active, spawn it -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Blue"
source="source_entity"
target="source_entity"
orbitstartingtheta="120"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<!-- Second orb -->
<compare a="var0" b="2" op="eq">
<!-- Red is active -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Red"
source="source_entity"
target="source_entity"
orbitstartingtheta="240"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
<addcharges />
</compare>
<compare a="var1" b="2" op="eq">
<!-- Green is active -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Green"
source="source_entity"
target="source_entity"
orbitstartingtheta="240"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
<addcharges />
</compare>
<compare a="var2" b="2" op="eq">
<!-- Blue is active -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Blue"
source="source_entity"
target="source_entity"
orbitstartingtheta="240"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
<addcharges />
</compare>
<!-- Check if second orb is set -->
<compare a="charges" b="1" op="ne">
<!-- Second orb isn't set yet -->
<!-- IMPORTANT: Var0,Var1 and Var2 will be used here for another purpose -->
<!-- They no longer contaion the position of the first orb -->
<pushentityproxy entity="ent0" />
<addcharges entity="stack_entity" count="0" />
<setvar0 a="result" />
<pushentityproxy entity="ent1" />
<addcharges entity="stack_entity" count="0" />
<setvar1 a="result" />
<pushentityproxy entity="ent2" />
<addcharges entity="stack_entity" count="0" />
<setvar2 a="result" />
<compare a="var0" b="2" op="eq">
<!-- Red orb is at position two -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Red"
source="source_entity"
target="source_entity"
orbitstartingtheta="240"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<compare a="var1" b="2" op="eq">
<!-- Green orb is at position two -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Green"
source="source_entity"
target="source_entity"
orbitstartingtheta="240"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<compare a="var2" b="2" op="eq">
<!-- Blue orb is at position three -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Blue"
source="source_entity"
target="source_entity"
orbitstartingtheta="240"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
</compare>
<!-- Third orb -->
<setcharges a="0" />
<compare a="var0" b="3" op="eq">
<!-- Red is active -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Red"
source="source_entity"
target="source_entity"
orbitstartingtheta="360"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
<addcharges />
</compare>
<compare a="var1" b="3" op="eq">
<!-- Green is active -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Green"
source="source_entity"
target="source_entity"
orbitstartingtheta="360"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
<addcharges />
</compare>
<compare a="var2" b="3" op="eq">
<!-- Blue is active -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Blue"
source="source_entity"
target="source_entity"
orbitstartingtheta="360"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
<addcharges />
</compare>
<!-- Check if third orb is set -->
<compare a="charges" b="1" op="ne">
<!-- Third orb isn't set yet -->
<!-- IMPORTANT: Var0,Var1 and Var2 will be used here for another purpose -->
<!-- They no longer contaion the position of the first orb -->
<pushentityproxy entity="ent0" />
<addcharges entity="stack_entity" count="0" />
<setvar0 a="result" />
<pushentityproxy entity="ent1" />
<addcharges entity="stack_entity" count="0" />
<setvar1 a="result" />
<pushentityproxy entity="ent2" />
<addcharges entity="stack_entity" count="0" />
<setvar2 a="result" />
<compare a="var0" b="3" op="eq">
<!-- Red orb is at position two -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Red"
source="source_entity"
target="source_entity"
orbitstartingtheta="360"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
<addcharges />
</compare>
<compare a="var1" b="3" op="eq">
<!-- Green orb is at position two -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Green"
source="source_entity"
target="source_entity"
orbitstartingtheta="360"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
<addcharges />
</compare>
<compare a="var2" b="3" op="eq">
<!-- Blue orb is at position three -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Blue"
source="source_entity"
target="source_entity"
orbitstartingtheta="360"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
<addcharges />
</compare>
<!-- IF the 3rd orb isn't set yet it has to be 3 orbs of one type -->
<compare a="charges" b="1" op="ne">
<addcharges entity="ent0" count="0" />
<compare a="result" b="3" op="eq">
<!-- Red is active 3 times -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Red"
source="source_entity"
target="source_entity"
orbitstartingtheta="360"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<addcharges entity="ent1" count="0" />
<compare a="result" b="3" op="eq">
<!-- Green is active 3 times -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Green"
source="source_entity"
target="source_entity"
orbitstartingtheta="360"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<addcharges entity="ent2" count="0" />
<compare a="result" b="3" op="eq">
<!-- Blue is active 3 times -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Blue"
source="source_entity"
target="source_entity"
orbitstartingtheta="360"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
</compare>
</compare>
</compare>
<printdebuginfo />
</oninflict>
<onexpired>
<!-- Remove all existing orbs -->
<compare a="accumulator" b="3" op="eq">
<pushentityproxy entity="this_proxy_entity" />
<printdebuginfo />
<pushentityproxy entity="stack_entity" />
<printdebuginfo />
<kill target="stack_entity" />
<pushentityproxy entity="this_proxy_entity" />
<printdebuginfo />
<kill target="stack_entity" />
<kill target="this_proxy_entity" />
<printdebuginfo />
<printvalue label="3 PROXY" value="accumulator" />
</compare>
<else>
<compare a="accumulator" b="2" op="eq">
<printdebuginfo />
<pushentityproxy entity="this_proxy_entity" />
<printdebuginfo />
<kill target="stack_entity" />
<kill target="this_proxy_entity" />
<printvalue label="2 PROXY" value="accumulator" />
</compare>
<else>
<printdebuginfo />
<kill target="this_proxy_entity" />
<printvalue label="1 PROXY" value="accumulator" />
</else>
</else>
</onexpired>
</state>
some of you know that I am currently work on a hero, called
Crystal Enchanter, which is basicly a Invoker port. I have
already finished the orb system and started with working at
the abilities that can be created. Currently I want to add
the visual orbs, since they aren't visible around the hero at
the moment. I tried to use a state and refresh it every times
a new orb is set. But my problem is that a state loses his
proxy on refresh. Trying to expire the state before re applying
it seems not to work too (idea was to put the delete orbits
thing in <onexpired>. Maybe you guys have ideas how to
make it. The main problem is that I need to delete old orbits
and spawn new one, every time the player changes the orbs.
I hope someone has a good idea, else I would leave the visual
as it is know, only visible on the ability buttons and do the rest
of the abilities.
For those who want to look into the state, there is the code.
<state
name="State_Crystal_Enchanter_Orbs"
icon="ability_04/icon.tga"
allowtransfer="false"
ishidden="false"
>
<oninflict>
<printvalue label="ORBIT STATE REFRESHED" value="" />
<!-- A orb was activated, new orbs have to be spawn -->
<setaccumulator value="0" />
<setcharges a="0" />
<!-- Get current orbs -->
<pushability name="Ability_Crystal_Enchanter1" />
<setent0 entity="stack_entity" />
<pushentityproxy entity="ent0" />
<changeaccumulator entity="stack_entity" b="0" op="add" />
<setvar0 a="result" />
<pushability name="Ability_Crystal_Enchanter2" />
<setent1 entity="stack_entity" />
<pushentityproxy entity="ent1" />
<changeaccumulator entity="stack_entity" b="0" op="add" />
<setvar1 a="result" />
<pushability name="Ability_Crystal_Enchanter3" />
<setent2 entity="stack_entity" />
<pushentityproxy entity="ent2" />
<changeaccumulator entity="stack_entity" b="0" op="add" />
<setvar2 a="result" />
<evaluate a="var0" b="var1" op="add" />
<evaluate a="result" b="var2" op="add" />
<setvar3 a="result" />
<!-- Get current number of active orbs -->
<addcharges entity="ent0" count="0" />
<changeaccumulator b="result" op="add"/>
<addcharges entity="ent1" count="0" />
<changeaccumulator b="result" op="add" />
<addcharges entity="ent2" count="0" />
<changeaccumulator b="result" op="add" />
<printvalue label="Accumulator - active orbs" value="accumulator" />
<!-- ################################################# -->
<!-- Only ONE orb active, only ONE needs to be spawned -->
<!-- ################################################# -->
<compare a="accumulator" b="1" op="eq">
<!-- One orb active -->
<compare a="var0" b="1" op="eq">
<!-- Red orb is active, spawn it -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Red"
source="source_entity"
target="source_entity"
orbitstartingtheta="120"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<compare a="var1" b="1" op="eq">
<!-- Green orb is active, spawn it -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Green"
source="source_entity"
target="source_entity"
orbitstartingtheta="120"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<compare a="var2" b="1" op="eq">
<!-- Blue orb is active, spawn it -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Blue"
source="source_entity"
target="source_entity"
orbitstartingtheta="120"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
</compare>
<!-- ################################################## #### -->
<!-- Only TWO orbs are active, only TWO needs to be spawned -->
<!-- ################################################## #### -->
<compare a="accumulator" b="2" op="eq">
<!-- 1 Orb is already active, activate another one -->
<!-- Get the orb that is at position 1 -->
<compare a="var0" b="1" op="eq">
<!-- Red orb is at position 1 -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Red"
source="source_entity"
target="source_entity"
orbitstartingtheta="120"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<compare a="var1" b="1" op="eq">
<!-- Green orb is at position 1 -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Green"
source="source_entity"
target="source_entity"
orbitstartingtheta="120"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<compare a="var2" b="1" op="eq">
<!-- Blue orb is at position 1 -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Blue"
source="source_entity"
target="source_entity"
orbitstartingtheta="120"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<!-- Get the orb that is at position 2 -->
<!-- Check if one orb is activated twice -->
<compare a="var3" b="3" op="eq">
<!-- 2 different orbs are active -->
<compare a="var0" b="2" op="eq">
<!-- Red Orb is at position 2 -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Red"
source="source_entity"
target="source_entity"
orbitstartingtheta="240"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<compare a="var1" b="2" op="eq">
<!-- Green Orb is at position 2 -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Green"
source="source_entity"
target="source_entity"
orbitstartingtheta="240"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<compare a="var2" b="2" op="eq">
<!-- Blue Orb is at position 2 -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Blue"
source="source_entity"
target="source_entity"
orbitstartingtheta="240"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
</compare>
<else>
<!-- Two orbs of the same type are active -->
<compare a="var0" b="1" op="eq">
<!-- Two red orbs are active -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Red"
source="source_entity"
target="source_entity"
orbitstartingtheta="240"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<compare a="var1" b="1" op="eq">
<!-- Two green orbs are active -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Green"
source="source_entity"
target="source_entity"
orbitstartingtheta="240"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<compare a="var2" b="1" op="eq">
<!-- Two blue orbs are active -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Blue"
source="source_entity"
target="source_entity"
orbitstartingtheta="240"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
</else>
</compare>
<!-- ################################################## ###### -->
<!-- all THREE orbs are active, all THREE needs to be spawned -->
<!-- ################################################## ###### -->
<compare a="accumulator" b="3" op="eq">
<!-- Three orbs are active -->
<!-- First orb -->
<compare a="var0" b="1" op="eq">
<!-- Red orb is active, spawn it -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Red"
source="source_entity"
target="source_entity"
orbitstartingtheta="120"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<compare a="var1" b="1" op="eq">
<!-- Green orb is active, spawn it -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Green"
source="source_entity"
target="source_entity"
orbitstartingtheta="120"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<compare a="var2" b="1" op="eq">
<!-- Blue orb is active, spawn it -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Blue"
source="source_entity"
target="source_entity"
orbitstartingtheta="120"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<!-- Second orb -->
<compare a="var0" b="2" op="eq">
<!-- Red is active -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Red"
source="source_entity"
target="source_entity"
orbitstartingtheta="240"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
<addcharges />
</compare>
<compare a="var1" b="2" op="eq">
<!-- Green is active -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Green"
source="source_entity"
target="source_entity"
orbitstartingtheta="240"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
<addcharges />
</compare>
<compare a="var2" b="2" op="eq">
<!-- Blue is active -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Blue"
source="source_entity"
target="source_entity"
orbitstartingtheta="240"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
<addcharges />
</compare>
<!-- Check if second orb is set -->
<compare a="charges" b="1" op="ne">
<!-- Second orb isn't set yet -->
<!-- IMPORTANT: Var0,Var1 and Var2 will be used here for another purpose -->
<!-- They no longer contaion the position of the first orb -->
<pushentityproxy entity="ent0" />
<addcharges entity="stack_entity" count="0" />
<setvar0 a="result" />
<pushentityproxy entity="ent1" />
<addcharges entity="stack_entity" count="0" />
<setvar1 a="result" />
<pushentityproxy entity="ent2" />
<addcharges entity="stack_entity" count="0" />
<setvar2 a="result" />
<compare a="var0" b="2" op="eq">
<!-- Red orb is at position two -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Red"
source="source_entity"
target="source_entity"
orbitstartingtheta="240"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<compare a="var1" b="2" op="eq">
<!-- Green orb is at position two -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Green"
source="source_entity"
target="source_entity"
orbitstartingtheta="240"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<compare a="var2" b="2" op="eq">
<!-- Blue orb is at position three -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Blue"
source="source_entity"
target="source_entity"
orbitstartingtheta="240"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
</compare>
<!-- Third orb -->
<setcharges a="0" />
<compare a="var0" b="3" op="eq">
<!-- Red is active -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Red"
source="source_entity"
target="source_entity"
orbitstartingtheta="360"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
<addcharges />
</compare>
<compare a="var1" b="3" op="eq">
<!-- Green is active -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Green"
source="source_entity"
target="source_entity"
orbitstartingtheta="360"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
<addcharges />
</compare>
<compare a="var2" b="3" op="eq">
<!-- Blue is active -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Blue"
source="source_entity"
target="source_entity"
orbitstartingtheta="360"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
<addcharges />
</compare>
<!-- Check if third orb is set -->
<compare a="charges" b="1" op="ne">
<!-- Third orb isn't set yet -->
<!-- IMPORTANT: Var0,Var1 and Var2 will be used here for another purpose -->
<!-- They no longer contaion the position of the first orb -->
<pushentityproxy entity="ent0" />
<addcharges entity="stack_entity" count="0" />
<setvar0 a="result" />
<pushentityproxy entity="ent1" />
<addcharges entity="stack_entity" count="0" />
<setvar1 a="result" />
<pushentityproxy entity="ent2" />
<addcharges entity="stack_entity" count="0" />
<setvar2 a="result" />
<compare a="var0" b="3" op="eq">
<!-- Red orb is at position two -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Red"
source="source_entity"
target="source_entity"
orbitstartingtheta="360"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
<addcharges />
</compare>
<compare a="var1" b="3" op="eq">
<!-- Green orb is at position two -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Green"
source="source_entity"
target="source_entity"
orbitstartingtheta="360"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
<addcharges />
</compare>
<compare a="var2" b="3" op="eq">
<!-- Blue orb is at position three -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Blue"
source="source_entity"
target="source_entity"
orbitstartingtheta="360"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
<addcharges />
</compare>
<!-- IF the 3rd orb isn't set yet it has to be 3 orbs of one type -->
<compare a="charges" b="1" op="ne">
<addcharges entity="ent0" count="0" />
<compare a="result" b="3" op="eq">
<!-- Red is active 3 times -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Red"
source="source_entity"
target="source_entity"
orbitstartingtheta="360"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<addcharges entity="ent1" count="0" />
<compare a="result" b="3" op="eq">
<!-- Green is active 3 times -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Green"
source="source_entity"
target="source_entity"
orbitstartingtheta="360"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
<addcharges entity="ent2" count="0" />
<compare a="result" b="3" op="eq">
<!-- Blue is active 3 times -->
<spawnprojectile
name="Projectile_Crystal_Enchanter_Orb_Blue"
source="source_entity"
target="source_entity"
orbitstartingtheta="360"
proxy="this_proxy_entity"
pushentity="true"
/>
<setproxy entity="this_entity" target="stack_entity" />
</compare>
</compare>
</compare>
</compare>
<printdebuginfo />
</oninflict>
<onexpired>
<!-- Remove all existing orbs -->
<compare a="accumulator" b="3" op="eq">
<pushentityproxy entity="this_proxy_entity" />
<printdebuginfo />
<pushentityproxy entity="stack_entity" />
<printdebuginfo />
<kill target="stack_entity" />
<pushentityproxy entity="this_proxy_entity" />
<printdebuginfo />
<kill target="stack_entity" />
<kill target="this_proxy_entity" />
<printdebuginfo />
<printvalue label="3 PROXY" value="accumulator" />
</compare>
<else>
<compare a="accumulator" b="2" op="eq">
<printdebuginfo />
<pushentityproxy entity="this_proxy_entity" />
<printdebuginfo />
<kill target="stack_entity" />
<kill target="this_proxy_entity" />
<printvalue label="2 PROXY" value="accumulator" />
</compare>
<else>
<printdebuginfo />
<kill target="this_proxy_entity" />
<printvalue label="1 PROXY" value="accumulator" />
</else>
</else>
</onexpired>
</state>