"changing unit"

Sgqvur

FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
Reaction score
62
So basically there are two placed units on the map (three with the start location)
1. gg_unit_hpea_0001
2. gg_unit_hfoo_0002

and here's the code that doesn't do what i think it should/has to do:
JASS:
function changeunit takes unit u returns nothing
    set u = gg_unit_hfoo_0002
endfunction

function Trig_test_Actions takes nothing returns nothing
    local unit u2 = gg_unit_hpea_0001
    call changeunit(u2)
    call KillUnit(u2)
endfunction

//===========================================================================
function InitTrig_test takes nothing returns nothing
    set gg_trg_test = CreateTrigger(  )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_test, Player(0) )
    call TriggerAddAction( gg_trg_test, function Trig_test_Actions )
endfunction


So why is the peasant (gg_unit_hpea_0001) ding instead of the footman(gg_unit_hfoo_0002)?

PS: changeunit should probably be change2corpse ^^
 

Rushhour

New Member
Reaction score
46
call KillUnit(u)
instead? Else you will kill that peasant no matter how many functions you call^^
 

Sgqvur

FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
Reaction score
62
I guess poor description by me.

My point was why the changeunit function doesn't change the variable 'u2'==gg_unit_hfoo_0002.
 

Rushhour

New Member
Reaction score
46
Oh, you can't access local variables from another function, that means yes you can get the value, but you can't change what the variable stores.
So you would need to make a global variable.
But nevertheless this is pretty pointless, why calling an extra function, you could do this all in one function. What is your final aim?
 

Sgqvur

FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
Reaction score
62
you are pretty right...

no aim just poking with wc3 (poke poke ^^)

A bit off topic now...What does spreading mean as in:
"You must spread some Reputation around before giving it to <alias> again."
I've been getting this even before few a months...
 

Bogrim

y hello thar
Reaction score
154
It means you have to give reputation to someone else before giving it to the same person again. It's to stop people from overusing the reputation system, e.g. abuse by removing all of someone's reputation.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top