- Joined
- Nov 22, 2009
- Messages
- 181
Hi. I'm learning to use Jass and have read all the tutorials i could find and still have many questions especially about triggers.
Lets say you have a trigger assisted spell called portal. the ability is based off of Archimond's Dark Portal spell and summons nothing. The unit is based off of the human campaign 'portal' and has the Waygate ability. The trigger's actions would be:
*not exact functions
Do the actions and conditions need in a special place like when you click on the map name in the trigger editor, above the area where the actions/conditions/events are displayed, and to the left, where it says 'code entered here will be loaded after global variables and before any other functions? (i hope you got that) and does there need to be a function that starts at melee initialization in order to call the InitTrig_Portal function to actually make the trigger?
ill finish this post when im able
Lets say you have a trigger assisted spell called portal. the ability is based off of Archimond's Dark Portal spell and summons nothing. The unit is based off of the human campaign 'portal' and has the Waygate ability. The trigger's actions would be:
-
set tempPoint[1] to position of (casting unit)
-
set temppoint[2] to target point of ability being cast
-
create 1 Portal at tempPoint[1] for (owner of (casting unit))
-
set Waygate destination for (last created unit) to tempPoint[2]
-
create 1 portal at tempPoint[2] for (owner of (casting unit))
-
set Waygate destination for (last created unit) to tempPoint[1]
-
custom script: call RemoveLocation(udg_tempPoint[1])
-
custom script: call RemoveLocation(udg_tempPoint[2])
JASS:
function PortalConditions takes nothing returns boolean
return GetAbilityID()=='A000'
endfunction
function PortalActions takes nothing returns nothing
local location loc1=GetUnitLocation(caster)
local location loc2=GetSpellTargetLocation()
local unit portal1= CreateNUnits(1, loc1, GetUnitOwner(caster))
local unit portal2= CreateNUnits(1, loc2, GetUnitOwner(caster))
SetWaygateDestinationBJ (portal1, loc2)
SetWaygateDestinationBJ (portal2, loc1)
call RemoveLocation(loc1)
call RemoveLocation(loc2)
set portal1 = null
set portal2 = null
endfunction
//======================================
function InitTrig_Portal takes nothing returns nothing
set gg_trg_Portal = CreateTrigger()
TriggerRegisterAnyUnitEventBJ(gg_trg_Portal, EVENT_UNIT_ABILITY_CAST)
TriggerAddCondition(gg_trg_Portal, condition(PortalConditions),
TriggerAddAction(gg_trg_Portal, PortalActions)
Do the actions and conditions need in a special place like when you click on the map name in the trigger editor, above the area where the actions/conditions/events are displayed, and to the left, where it says 'code entered here will be loaded after global variables and before any other functions? (i hope you got that) and does there need to be a function that starts at melee initialization in order to call the InitTrig_Portal function to actually make the trigger?
ill finish this post when im able