Copy a unit?

Multiply

New Member
Reaction score
0
Instead of spawning the same unit X times, is there a way I can simply copy an existing unit, and spawn it at X,Y location? Or in the center of a region.
 

Momentai

New Member
Reaction score
2
i'm not sure if you can actually copy the unit, but you could always copy the unit-type and then give it all of the current aspects of the first unit (hp, mp, items, levels). it'd be a little bit more hassle than actually straight up copying the unit, but then again i don't think that exists :p
 

Multiply

New Member
Reaction score
0
How would I copy health and armor type then? Also armor count, of course. Mana points is kinda useless. It's because I have a random unit selection, and you can see 10 levels into the future, in the bottom right corner, so when a new level is about to begin, it should copy the unit and spawn it.

I guess, copying info is kinda the same, so I could just make a fuction which spawns X units, of the same type, with the same stats
 

Tom Jones

N/A
Reaction score
437
Can you give me an example of how to do that?
Yep:
JASS:
globals
    gamecache COPY_GC = InitGameCache("CopyUnit.w3v")
endglobals

function CopyUnit takes unit whichunit, player forplayer, real x, real y returns unit
    call StoreUnit(COPY_GC,"Copies","u",whichunit)
    return RestoreUnit(COPY_GC,"Copies","u",forplayer,x,y,0)
endfunction

function CopyUnitLoc takes unit whichunit, player forplayer, location towhere returns unit
    return CopyUnit(whichunit,forplayer,GetLocationX(towhere),GetLocationY(towhere))
endfunction
 
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