- Joined
- Oct 12, 2007
- Messages
- 148
im still reading http://www.hiveworkshop.com/forums/...als-280/beginning-jass-tutorial-series-30765/
and i got afew more questions to ask
(btw i dont know how 2 quote jass like with the white box so if some1 can tell me how 2 do that would be great. Rite know i'll just use normal quote)
1)
so im guessing:
-take player id- is player number? (like i put *1,* here and will create a unit for player one)
-integer unitid- is the id of the unit? (like for pally is Hpal?, so in here i enter *Hpal,*? but its a integer shouldn't i enter a number instead?)
-real x- i have no idea what this is... since its a real, i assume i enter a number here, but what does this number do?
-real y- same with real x... no idea what this is
-real face- lol no idea what this is either
is this correct? lol
2)
the way i see it it's like uhm ...
-create a unit (…), name it *u*
-and ... (on the line start with set u = ...) u nolonger is this unit created with function *createunit* with the identity of *…* and ... *u* turns into *other_unit* ...
i assume this *other_unit* is like another *createunit* with a different identity like *createunit( <---different number) ... rite? no? am it way off lol?
3)
so uhm... is *function killunit takes unit u returns nothing* part of the function of the variable?
as in the function;
function variable_test takes nothing returns nothing
local unit u
set u = CreateUnit(…..)
endfunction
? or is it a different function? ... and the next example the author gives:
ty in advance
and i got afew more questions to ask
1)
I asked about this in the last thread. I checked the *createunit* uhm... function (i think function is the word refering this code/command correct me if im wrong) and it says i need "takes player id, integer unitid, real x, real y, real face returns unit"function variable_test takes nothing returns nothing
local unit u
set u = CreateUnit(…..) //Creates a unit and sets the variable to it
so im guessing:
-take player id- is player number? (like i put *1,* here and will create a unit for player one)
-integer unitid- is the id of the unit? (like for pally is Hpal?, so in here i enter *Hpal,*? but its a integer shouldn't i enter a number instead?)
-real x- i have no idea what this is... since its a real, i assume i enter a number here, but what does this number do?
-real y- same with real x... no idea what this is
-real face- lol no idea what this is either
is this correct? lol
2)
i dont understand the purpose of this part ... what does the author mean by *new variable*? ...Hey wait! I want the value to change, does that mean I need a new variable?
-No, not necessarily. All you need to do is put “set your_variable = newvalue
Here’s an example.
function variable takes nothing returns nothing
local unit u = CreateUnit(…)
//Other actions
set u = other_unit //other_unit would be some other unit, don't use this example literally!
endfunction
Remember though, that old value isn’t set to that variable, so if you want 2 different units, use 2 different variables.
the way i see it it's like uhm ...
-create a unit (…), name it *u*
-and ... (on the line start with set u = ...) u nolonger is this unit created with function *createunit* with the identity of *…* and ... *u* turns into *other_unit* ...
i assume this *other_unit* is like another *createunit* with a different identity like *createunit( <---different number) ... rite? no? am it way off lol?
3)
Ok, so I have my local variable. Now what?
-Now, use it! Here’s an example.
function KillUnit takes unit u returns nothing
-If you notice, KillUnit needs a unit. Now, you can fill this with many things, like GetTriggerUnit(), GetSpellAbilityUnit(), or any function which returns a unit. However, a variable can be a unit, so you can put that there instead. Here’s a side-by-side comparison.
so uhm... is *function killunit takes unit u returns nothing* part of the function of the variable?
as in the function;
function variable_test takes nothing returns nothing
local unit u
set u = CreateUnit(…..)
endfunction
? or is it a different function? ... and the next example the author gives:
doesn't have anything in the variable function ... so how does This function *use* the variable function? since i dont see any connection between the 2 ... or is the author making a completely different example?function variable_testA takes nothing returns nothing
local unit u = GetTriggerUnit()
call KillUnit(u)
endfunction
function variable_testB takes nothing returns nothing
call KillUnit(GetTriggerUnit())
endfunction
ty in advance