• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Creep Respawn(glitch and bug)

Status
Not open for further replies.
Level 10
Joined
Feb 20, 2008
Messages
448
im making a project, and i want to use most efficient code i can to make my map good as other do!!!

Map size 256 x 256
Over 400-500 mobs
Problem : imagin 10 player that gather over 50 mobs and kill them over time(5min exemple) huge lag happened with most gui system i tryed

System required :
Can use Jnpg editor aka newjassGen
Work on Specific region named as : CreepPoint1,CreepPoint2,CreepPoint3,CreepPoint4,
map contain over 400 mobs as Neutral hostile
Hope its could use X & Y value for location since they dont lag!!

since this forum love jass, i hope some1 will able to help me :D, im starting to learn jass but..... i kind of bad....

there is the code i have now, i would like it to use region in condition and unit x & Y as position
JASS:
function Trig_Respawn01_Conditions takes nothing returns boolean
    if ( not ( GetOwningPlayer(GetDyingUnit()) == Player(PLAYER_NEUTRAL_AGGRESSIVE) ) ) then
        return false
    endif
    return true
endfunction

function Trig_Respawn01_Actions takes nothing returns nothing
    local unit u = GetDyingUnit()
    local location l = GetUnitLoc(u)
    local real facing = GetUnitFacing(u)
    call TriggerSleepAction( 10.00 ) //This is the wait time.
    call CreateNUnitsAtLoc( 1, GetUnitTypeId(u), Player(PLAYER_NEUTRAL_AGGRESSIVE), l, facing )
    call RemoveLocation(l)
endfunction

//===========================================================================
function InitTrig_Respawn01 takes nothing returns nothing
    set gg_trg_Respawn01 = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Respawn01, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_Respawn01, Condition( function Trig_Respawn01_Conditions ) )
    call TriggerAddAction( gg_trg_Respawn01, function Trig_Respawn01_Actions )
endfunction
 
Level 8
Joined
Feb 15, 2009
Messages
463
JASS:
function Trig_Respawn01_Conditions takes nothing returns boolean
    return GetOwningPlayer(GetDyingUnit()) == Player(PLAYER_NEUTRAL_AGGRESSIVE) )
endfunction

function Trig_Respawn01_Actions takes nothing returns nothing
    local unit u = GetDyingUnit()

    call TriggerSleepAction( 10.00 )
    call CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE) , GetUnitTypeId(u) , GetUnitX(u), GetUnitY(u) ,0)

endfunction

//===========================================================================
function InitTrig_Respawn01 takes nothing returns nothing
    local trigger t = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition(t, Condition( function Trig_Respawn01_Conditions ) )
    call TriggerAddAction( t, function Trig_Respawn01_Actions )
endfunction

this is what this trigger in normal JASS(not vJass) should look like but i dont undestand you question also TriggerSleepActopn is a bit inaccurate but if you dont have probs with it then leave else use timer(which takes minor performance tweaks)
 
JASS:
function Trig_Respawn01_Conditions takes nothing returns boolean
    return GetOwningPlayer(GetDyingUnit()) == Player(PLAYER_NEUTRAL_AGGRESSIVE) )
endfunction

function Trig_Respawn01_Actions takes nothing returns nothing
    local unit u = GetDyingUnit()

    call TriggerSleepAction( 10.00 )
    call CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE) , GetUnitTypeId(u) , GetUnitX(u), GetUnitY(u) ,0)

endfunction

//===========================================================================
function InitTrig_Respawn01 takes nothing returns nothing
    local trigger t = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition(t, Condition( function Trig_Respawn01_Conditions ) )
    call TriggerAddAction( t, function Trig_Respawn01_Actions )
endfunction

this is what this trigger in normal JASS(not vJass) should look like but i dont undestand you question also TriggerSleepActopn is a bit inaccurate but if you dont have probs with it then leave else use timer(which takes minor performance tweaks)

Yep that should work
BUT you do use the units coordinates after it died and a wait
some unit do decay and also their location gets cleared(or whatever) e.g. the human Grycopter does so
Just to make it save and avoid possible bugs returning a (0,0) location save the coordinates in 2 local reals
 
Status
Not open for further replies.
Top