owner123 wrote:
Because copying units was never programmed:
Code:
function CopyHero takes unit source, integer uid, real locX, real locY returns nothing
local integer pid = GetPlayerId( GetOwningPlayer( source ) )
local real facing = GetUnitFacing( source )
if uid == 0 then
set uid = GetUnitTypeId( source )
endif
if IsUnitType( source, UNIT_TYPE_HERO ) then
set bj_lastCreatedUnit = CreateUnit( Player( pid ), uid, locX, locY, facing )
call CopyStats( source, bj_lastCreatedUnit )
call CopyItems( source, bj_lastCreatedUnit )
call CopyState( source, bj_lastCreatedUnit )
endif
endfunction
I think it can be updated like this:
Code:
function CopyHero takes unit source, integer uid, real locX, real locY returns nothing
local integer pid = GetPlayerId( GetOwningPlayer( source ) )
local real facing = GetUnitFacing( source )
if uid == 0 then
set uid = GetUnitTypeId( source )
endif
if IsUnitType( source, UNIT_TYPE_HERO ) then
set bj_lastCreatedUnit = CreateUnit( Player( pid ), uid, locX, locY, facing )
call CopyStats( source, bj_lastCreatedUnit )
call CopyItems( source, bj_lastCreatedUnit )
call CopyState( source, bj_lastCreatedUnit )
else
set bj_lastCreatedUnit = CreateUnit( Player( pid ), uid, locX, locY, facing )
endif
endfunction
Not sure which version you are refering to.. Copy used to copy all units an # amount of times.
So if you select 2 footmen and 3 riflemen and use "-copy 2". Each SELECTED unit would be copy twice.
So you will endup having 6 footmen and 9 riflemen (4 new footment and 6 new riflemen)
Code:
if SubString(s2s,0,5)=="-copy" and SubString(s2s,6,7)!="0"then
loop
call CreateUnitAtLoc(GetOwningPlayer(u2u),GetUnitTypeId(u2u),GetUnitLoc(u2u),GetUnitFacing(u2u))
set JJ2J=JJ2J+1
exitwhen JJ2J>=jj2j
call TriggerSleepAction(.001)
endloop
call RemoveLocation(GetUnitLoc(u2u))
endif
<-- This code was taken from FatherSpace's (Ken's) version of the update cheatpack back in who knows when... (cant remember the patch that broke most maps)