Selecting unit after restoring it

SouLEDGE

Damn you advanced calculus
Reaction score
75
I can't figure out why it won't add my unit to my selection after I restore it from the game cache:
JASS:
    //Game Cache Init
    call InitGameCacheBJ( "MapName.w3v" )
    set g = bj_lastCreatedGameCache
    call SaveGameCache(g)
    //End OF Game Cache Init
   
    //Store and remove unit
    call StoreUnit(g, "Sonic", "Caster", u)    //Store Caster in gamecache g
    call SaveGameCache(g)                      //Update gamecache
    call RemoveUnit(u)
    //Store and remove unit
   
    //Restore and Select
    call RestoreUnit(g, "Sonic", "Caster", GetOwningPlayer(u), x, y, AngleBetweenPoints(Location(x,y), lt))
    //set u = bj_lastLoadedUnit
    set u = GetLastRestoredUnitBJ()
    call KillUnit(u)
    call SelectUnitAddForPlayer( u, GetOwningPlayer(u) )
    //Restore and Select
 

SouLEDGE

Damn you advanced calculus
Reaction score
75
Yeah, should have taken it out before I posted it, that was only there to see
whether or not:
JASS:
worked, which it didn't.
So I suppose my real question is why isn't that line working?
 

Solu9

You can change this now in User CP.
Reaction score
216
Im no jass fox but could it be that you just save the unit and do not create it for a specific player?
 

Imp Midna

Active Member
Reaction score
52
JASS:
function RestoreUnitLocFacingAngleBJ takes string key, string missionKey, gamecache cache, player forWhichPlayer, location loc, real facing returns unit
    //call SyncStoredUnit(cache, missionKey, key)
    set bj_lastLoadedUnit = RestoreUnit(cache, missionKey, key, forWhichPlayer, GetLocationX(loc), GetLocationY(loc), facing)
    return bj_lastLoadedUnit
endfunction

JASS:
function GetLastRestoredUnitBJ takes nothing returns unit
    return bj_lastLoadedUnit
endfunction


obviously: no calling RestoreUnitLocFacingAngleBJ, no bj_lastLoadedUnit, no GetLastRestoredUnitBJ.
 
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