Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
(2 ratings)
Approved
Ruse Switch

Events


Unit - A unit Starts the effect of an ability

Conditions


(Ability being cast) Equal to Ruse Switch

Actions


-------- Do not touch any of these codes below, because this is where the units switch places --------


Custom script: local real x1=GetUnitX(GetTriggerUnit())


Custom script: local real y1=GetUnitY(GetTriggerUnit())


Custom script: local real x2=GetUnitX(GetSpellTargetUnit())


Custom script: local real y2=GetUnitY(GetSpellTargetUnit())


Custom script: call SetUnitX(GetSpellTargetUnit(), x1)


Custom script: call SetUnitY(GetSpellTargetUnit(), y1)


Custom script: call SetUnitX(GetTriggerUnit(), x2)


Custom script: call SetUnitY(GetTriggerUnit(), y2)


-------- This is where you can edit everything, special effects, damage, etc. --------


Set RS_caster = (Triggering unit)


Set RS_target = (Target unit of ability being cast)


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




And - All (Conditions) are true





Conditions






(RS_target belongs to an enemy of (Owner of RS_caster)) Equal to True






(RS_target is A structure) Not equal to True



Then - Actions




Unit - Cause RS_caster to damage RS_target, dealing (100.00 x (Real((Level of Ruse Switch for RS_caster)))) damage of attack type Spells and damage type Normal




Special Effect - Create a special effect attached to the chest of RS_caster using Abilities\Spells\Other\Doom\DoomDeath.mdl




Special Effect - Destroy (Last created special effect)




Special Effect - Create a special effect attached to the chest of RS_target using Abilities\Spells\Other\Doom\DoomDeath.mdl




Special Effect - Destroy (Last created special effect)



Else - Actions




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






And - All (Conditions) are true







Conditions








(RS_target belongs to an ally of (Owner of RS_caster)) Equal to True








(RS_target is A structure) Not equal to True





Then - Actions






Unit - Set life of RS_target to ((Life of RS_target) + (75.00 x (Real((Level of Ruse Switch for RS_caster)))))






Special Effect - Create a special effect attached to the chest of RS_caster using Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl






Special Effect - Destroy (Last created special effect)






Special Effect - Create a special effect attached to the chest of RS_target using Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl






Special Effect - Destroy (Last created special effect)





Else - Actions
Hmm, spell too simple, store everything that will used twice to a variable ( GetTriggerUnit() and GetSpellTargetUnit() )
Spell is very very simple but it is useful ^^. 3/5.
Store GetTriggerUnit and GetSpellTargetUnit in the variable. Configuration gone. Read spell submission rules https://www.hiveworkshop.com/forums/beta-rules-information-710/spell-submission-rules-230362/
referencing to a local variable is faster than function call, even native function.From what I recall, using a local is slower than calling the native 3 times (or somewhere around there). Could be wrong though, haven't touched WE for about an year.
Ruse Switch
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Ruse Switch
Actions
-------- this doesn't need configurable variables :P --------
set TempPoint[1] = Position of (Triggering Unit)
set TempPoint[2] = Position of (Event Response - Target of Ability being Cast)
Unit - Move (Triggering Unit) to TempPoint[2]
Unit - Move (Event Response - Target of Ability being Cast) to TempPoint[1]
custom script: RemoveLocation(udg_TempPoint[1])
custom script: RemoveLocation(udg_TempPoint[2])
------- that is more simple units swaping triggers -------
well keep it simple
I type it manually, so..
Ruse Switch
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Ruse Switch
Actions
-------- this doesn't need configurable variables :P --------
set TempPoint[1] = Position of (Triggering Unit)
set TempPoint[2] = Position of (Event Response - Target of Ability being Cast)
Unit - Move (Triggering Unit) to TempPoint[2]
Unit - Move (Event Response - Target of Ability being Cast) to TempPoint[1]
custom script: RemoveLocation(udg_TempPoint[1])
custom script: RemoveLocation(udg_TempPoint[2])
------- that is more simple units swaping triggers -------
yeah, I can't beat magh and kobas :/honestly, chronos_077's trigger is better because it avoid the use of location
Set RS_caster = (Triggering unit)
Set RS_target = (Target unit of ability being cast)
Custom script: local real x1=GetUnitX(udg_RS_caster)
Custom script: local real y1=GetUnitY(udg_RS_caster)
Custom script: local real x2=GetUnitX(udg_RS_target)
Custom script: local real y2=GetUnitY(udg_RS_target)
Custom script: call SetUnitX(udg_RS_target, x1)
Custom script: call SetUnitY(udg_RS_target, y1)
Custom script: call SetUnitX(udg_RS_caster, x2)
Custom script: call SetUnitY(udg_RS_caster, y2)
|
REVIEW|Ruse Switch|v1.1
|
| Resource Status: Needs Fix Rating: 3/5 (Useful) |
|
GENERAL
|
|
|
PROS
|
|
|
CONS
|
|
|
SUGGESTIONS
|
|
how do i change locals to globals?
Custom script: local real x1
Custom script: local real x2
Custom script: local real y1
Custom script: local real y2
set RS_caster = (Triggering unit)
set RS_target = (Target unit of ability being cast)
Custom script: set x1 = GetUnitX(udg_RS_caster)
Custom script: set y1 = GetUnitY(udg_RS_caster)
Custom script: set x2 = GetUnitX(udg_RS_target)
Custom script: set y2 = GetUnitY(udg_RS_target)
Custom script: call SetUnitX(udg_RS_caster, x2)
Custom script: call SetUnitY(udg_RS_caster, y2)
Custom script: call SetUnitX(udg_RS_target, x1)
Custom script: call SetUnitY(udg_RS_target, y1)
Basically, the idea is that since you declared RS_caster and RS_target, might as well use those variables to save a few native calls.
You could also use global variables for your x's and y's. That way, you can eliminate the use of locals altogether. But using locals for your x's and y's are fine.
Custom script: local real x1
Custom script: local real x2
Custom script: local real y1
Custom script: local real y2
set RS_caster = (Triggering unit)
set RS_target = (Target unit of ability being cast)
Custom script: set x1 = GetUnitX ( udg_RS_caster )
Custom script: set y1 = GetUnitY ( udg_RS_caster )
Custom script: set x2 = GetUnitX ( udg_RS_target )
Custom script: set y2 = GetUnitY ( udg_RS_target )
Custom script: call SetUnitX ( udg_RS_caster, x2 )
Custom script: call SetUnitY ( udg_RS_caster, y2 )
Custom script: call SetUnitX ( udg_RS_target, x1 )
Custom script: call SetUnitY ( udg_RS_target, y1 )
? The user that will download this spell and import it to another map will gives errors about X/Y and if he do that, it is like he made a spell to turn in JASS.
Set RS_caster = (Triggering unit)
set RS_target = (Target unit of ability being cast)
Custom script: set udg_x1 = GetUnitX ( udg_RS_caster )
Custom script: set udg_x2 = GetUnitX ( udg_RS_target )
Custom script: set udg_y1 = GetUnitY ( udg_RS_caster )
Custom script: set udg_y2 = GetUnitY ( udg_RS_target )
Custom script: call SetUnitX ( udg_RS_caster , udg_x2 )
Custom script: call SetUnitY ( udg_RS_caster , udg_y2 )
Custom script: call SetUnitX ( udg_RS_target , udg_x1 )
Custom script: call SetUnitY ( udg_RS_target , udg_y1 )
? The user that will download this spell and import it to another map will gives errors about X/Y and if he do that, it is like he made a spell to turn in JASS.
Make it like this:
Set RS_caster = (Triggering unit)
set RS_target = (Target unit of ability being cast)
Custom script: set udg_x1 = GetUnitX ( udg_RS_caster )
Custom script: set udg_x2 = GetUnitX ( udg_RS_target )
Custom script: set udg_y1 = GetUnitY ( udg_RS_caster )
Custom script: set udg_y2 = GetUnitY ( udg_RS_target )
Custom script: call SetUnitX ( udg_RS_caster , udg_x2 )
Custom script: call SetUnitY ( udg_RS_caster , udg_y2 )
Custom script: call SetUnitX ( udg_RS_target , udg_x1 )
Custom script: call SetUnitY ( udg_RS_target , udg_y1 )
how can a local variable instance give error when copied into another map? the only bad thing about using custom script in GUI is just it limits further modification by pure GUI users.? The user that will download this spell and import it to another map will gives errors about X/Y and if he do that, it is like he made a spell to turn in JASS.
Make it like this:
Set RS_caster = (Triggering unit)
set RS_target = (Target unit of ability being cast)
Custom script: set udg_x1 = GetUnitX ( udg_RS_caster )
Custom script: set udg_x2 = GetUnitX ( udg_RS_target )
Custom script: set udg_y1 = GetUnitY ( udg_RS_caster )
Custom script: set udg_y2 = GetUnitY ( udg_RS_target )
Custom script: call SetUnitX ( udg_RS_caster , udg_x2 )
Custom script: call SetUnitY ( udg_RS_caster , udg_y2 )
Custom script: call SetUnitX ( udg_RS_target , udg_x1 )
Custom script: call SetUnitY ( udg_RS_target , udg_y1 )
too much watching Adventure Time. i seeWhat are you going on about finn?! I mean jake?! The coordinate variables are locals so it does not need to be instantiated (created) by World Editor. Stop hating on jass.

yeah, how could locals cause an error?? The user that will download this spell and import it to another map will gives errors about X/Y and if he do that, it is like he made a spell to turn in JASS.
Make it like this:
Set RS_caster = (Triggering unit)
set RS_target = (Target unit of ability being cast)
Custom script: set udg_x1 = GetUnitX ( udg_RS_caster )
Custom script: set udg_x2 = GetUnitX ( udg_RS_target )
Custom script: set udg_y1 = GetUnitY ( udg_RS_caster )
Custom script: set udg_y2 = GetUnitY ( udg_RS_target )
Custom script: call SetUnitX ( udg_RS_caster , udg_x2 )
Custom script: call SetUnitY ( udg_RS_caster , udg_y2 )
Custom script: call SetUnitX ( udg_RS_target , udg_x1 )
Custom script: call SetUnitY ( udg_RS_target , udg_y1 )
i guess it'll be his decision@chobibo
Anyway I'm not hating JASS. I mean that if he start doing declare variables in locals, it might be he turn the spell ( GUI ) into JASS, so it is better to turn it in JASS than GUI.
@chobibo
Anyway I'm not hating JASS. I mean that if he start doing declare variables in locals, it might be he turn the spell ( GUI ) into JASS, so it is better to turn it in JASS than GUI.
SetUnitX and SetUnitY isn't "GUI" either.
Ruse Switch

Events


Unit - A unit Starts the effect of an ability

Conditions


And - All (Conditions) are true



Conditions




(Ability being cast) Equal to Ruse Switch




((Target unit of ability being cast) is A structure) Equal to False

Actions


Custom script: local unit u1=GetTriggerUnit()


Custom script: local unit u2=GetSpellTargetUnit()


Custom script: local real x1=GetUnitX(u1)


Custom script: local real y1=GetUnitY(u1)


Custom script: local real x2=GetUnitX(u2)


Custom script: local real y2=GetUnitY(u2)


Custom script: call SetUnitX(u2, x1)


Custom script: call SetUnitY(u2, y1)


Custom script: call SetUnitX(u1, x2)


Custom script: call SetUnitY(u1, y2)


Custom script: if GetOwningPlayer(u1) == GetOwningPlayer(u2) then


Custom script: call SetUnitState(u2, UNIT_STATE_LIFE, GetUnitState(u2, UNIT_STATE_LIFE) + 75*GetUnitAbilityLevel(u1, 'A001'))


Custom script: call DestroyEffect(AddSpecialEffectTarget("chest", u1, "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl"))


Custom script: call DestroyEffect(AddSpecialEffectTarget("chest", u2, "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl"))


Custom script: else


Custom script: call UnitDamageTarget(u1, u2, 75*GetUnitAbilityLevel(u1, 'A001'), true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null)


Custom script: call DestroyEffect(AddSpecialEffectTarget("chest", u1, "Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl"))


Custom script: call DestroyEffect(AddSpecialEffectTarget("chest", u2, "Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl"))


Custom script: endif


Custom script: set u1=null


Custom script: set u2=null
|

