Changing a unit's race

Seprest

New Member
Reaction score
15
Hello!

I am wondering what is the appropriate action to change a unit's race? I can use a unit's race in booleans, but I can't set it! I can set unit classifications ect, but not what race the unit is considered! :banghead:

If anyone know how to do this, it would be greatly appreciated.


PS: I will take custom scripts too!
 

Happy

Well-Known Member
Reaction score
71
sure you can set the race...its in the editor......just take a look...i dont have WE at the moment so sry that i cant tell you the line...
 

Seprest

New Member
Reaction score
15
No I mean set the race via a trigger. Like change a unit that starts as a human to undead, keeping the same exact unit, but with 1 changed variable.

Sorry for not clarifying that, I know where the race field is in the object editor :shades:

current if/then/else:

If ((Race of (Triggering unit)) Equal to Undead) then do (Do nothing) else do (Do nothing)



need to make it do something like this:

If ((Race of (Triggering unit)) Equal to Undead) then do (Do nothing) else do (set the darn race to UNDEAD!)

But I can't find the correct action to change a units variables. There are some, such as classification, health, mana, ect. But can't change the race! Which is why I believe a custom script(which I don't know how to do but one for this sounds like it could be simple) is neccesary.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
simple answer:
you cant...

more advanced answer:
you still cant. but you might make an exact copy of that unit, change its race to undead in object editor and morph the first unit via trigger into the second by using the chaos ability.
 

Seprest

New Member
Reaction score
15
depends on what you call easy...

I'm just going to make all heroes undead from the beggining, and make it so death coil just does dmg, not heal undead ppl and stuff, -1 utility +1 paladins mining haunted gold mines:cool:
 

jig7c

Stop reading me...-statement
Reaction score
123
there is a native called
JASS:

not sure what it does though... i also don't have WE on this computer..


maybe something like this...
JASS:
local unit u = GetTriggerUnit()

if IsUnitRace(u, 3) then
 DoNothing()
elseif
 ConvertRace (3)
endif
set u = null


JASS:
 

Chaos_Knight

New Member
Reaction score
39
there is a native called
JASS:

not sure what it does though... i also don't have WE on this computer..


maybe something like this...
JASS:

local unit u = GetTriggerUnit()

if IsUnitRace(u, 3) then
 DoNothing()
elseif
 ConvertRace (3)
endif
set u = null


JASS:

constant race               RACE_HUMAN                      = ConvertRace(1)
constant race               RACE_ORC                        = ConvertRace(2)
constant race               RACE_UNDEAD                     = ConvertRace(3)
constant race               RACE_NIGHTELF                   = ConvertRace(4)
constant race               RACE_DEMON                      = ConvertRace(5)
constant race               RACE_OTHER                      = ConvertRace(7)

That could work.
 

Seprest

New Member
Reaction score
15
I gave up on all the jass, just made it be a normal gold mine but with the haunted goldmine model ^.^

Never used jass b4 except custom lines. Wasn't sure if I could put a chunk of jass in the middle of my trigger, or have to make the whole trigger out of jass. I have other stuff in the trigger, so I didn't want to do a whole trigger in jass with all my other stuff. I probably could have just called on a 2nd trigger inside the jass trigger so I wouldn't have to code all the other junk.


And if Chaos_Knight sais it will work, it must!

Edit: but don't think your data mining was wasted, I bookmark all pages with nifty WC3 stuff, and I will certainly use this sometime in the future. And I'm sure you've educated a few random viewers of this thread <3
 

Lehona

New Member
Reaction score
12
That won't work (At least I think it won't). ConvertRace(x) is, just as other natives like ConvertPlayerEvent(x) etc. just to convert an integer to a handle (in this case: to 'race').
 

Seprest

New Member
Reaction score
15
Yeah you are probably right when you explain it like that. So it would just convert an integer to a handle huh. Exciting :rolleyes:

Though, I never tried it out, so anything could(possibly) be possible(possibly).
 

jig7c

Stop reading me...-statement
Reaction score
123
That won't work (At least I think it won't). ConvertRace(x) is, just as other natives like ConvertPlayerEvent(x) etc. just to convert an integer to a handle (in this case: to 'race').

so you can't change a unit's race with triggers..

this myth is BUSTED!
 

Lehona

New Member
Reaction score
12
Well, if you can write at the data segment you'd be abled to change a unit's race. Though you need at least some programming-skills to do that (Or at least JASS if someone could rebuild the classes and make a nice interface).

And I'm kinda sure that you can't write in the data segment anymore.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top