• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[JASS] A nice and easy noob question :)

Status
Not open for further replies.
Level 6
Joined
Jan 2, 2007
Messages
189
Hey, I JUST started learning JASS (last night actually) and I am obviously a little confused. My main concern is how do I make JASS 'execute'.

Like this:

Code:
function variable_test takes nothing returns nothing
  local unit array A
set A[1] = GetTriggerUnit()
    call KillUnit(A[1])
set A[1] = null
endfunction

From what I understand, this should kill the triggering unit. But how do I:
a) Determine the triggering unit
b) Make this code "execute". (sorry if that isn't clear. I have used GUI for alsmost 4 years now and I dont have a better way of explaining it). Like if I wanted to kill a "unit" after 5 seconds. What makes the function run after 5 seconds?
 
function zomg takes nothing returns nothing
local unit a = GetTriggerUnit()
call TriggerSleepAction(2)
call KillUnit(a)
endfunction

you call it like
call zomg()

if you put call zomg() to your actions it will kill triggering unit after 2 seconds for short but trigger will wait for 2 seconds so you need to put it bottom of trigger

Triggering units determine on trigger encounters
like a trigger that registered for spell cast gets executed
and GetTriggerUnit() becomes the caster

Some Other Information: functions executed inside functions affects the parent function like if you call zomg() in a function your parent function will wait too UNLESS you dont use ExecuteFunc("zomg")
 
Some Other Information: functions executed inside functions affects the parent function like if you call zomg() in a function your parent function will wait too UNLESS you dont use ExecuteFunc("zomg")
In other words, if you call a function, the function will be executed in the same thread. On the other hand, if you execute a function using ExecuteFunc or TriggerExecute, a new thread will be created, and the function will be executed at the same time as the calling function...

Kind of hard to understand...
 
Thread is basically a chain of executions, and when you make a "new" thread you create another chain of executions which has various effects depending on what you are doing (it can prevent bugs for example such as damage requirzion in damagedetect systems)
 
Status
Not open for further replies.
Back
Top