• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] /Trigger - Giving AddAction Code parameters.

Status
Not open for further replies.
Level 7
Joined
Jun 16, 2008
Messages
253
:D

I'm having to remember my problem off the top of my head, but my dilemma is basically:

I want it so that when a unit activates an ability, that ability trigger will call another trigger with the unit as a parameter.
That other trigger will be Event - When a unit is within X of Unit. (Which looks something like PLAYERUNITEVENT_ACQUIRED_UNIT_BJ, Unit. Or something)

Then I have AddAction, which takes the unit parameter and sticks it in the action function. This is where I hit the snage I tihnk.

Because it looks something like.
AddAction(trg_Trigger, function trg_Trigger_Actions) it doesn't allow me to put function trg_Trigger_Actions(unit parameter here) because it's a code.

Can anyone help me stick it in?

For clarification the GUI version just looks like
Event - When unit comes into X range of (Unit). And the (Unit) has to be a generated unit, or a variable, I'm trying to put the casting unit in the original trigger that casts Collision (physics ability for my map) into this little slot, and also use the unit in the actions.

Now besides globals, could you guys help me fix this little hiccup with the whole 'not putting parameters in code' thing. I'm still learning jass.

(P.S, PP if you are reading this and your answer in that other thread covered this, sorry but I'm having trouble using the stuff in jasshelper, they don't seem to be doing what they are suposed to be doing at all!)

Huge appreciation to anyone that can help me with this problem, it is all that stands between me and finishing my collision physics system, which will be hugely important for my map. :cute:
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
You need a "Handle Attachment System" for that (like handlevars)
Because you cant use parameters at something like that
So you will attach a variable to that trigger instead of using parameter
They work like
SetHandleUnit(<handle>,"<section string>",<unit>) (section string is something you choose)
and GetHandleUnit(<handle>,"<same section string>") that returns unit you attached to handle
Example
SetHandleUnit(trig,"unit1",unit)
and inside trigger
local unit u = GetHandleUnit(GetTriggeringTrigger(),"unit1") (oops edited)

These functions are from Handlevars
 
Last edited:
Status
Not open for further replies.
Top