• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

custom script call RemoveLoc... errors

Status
Not open for further replies.
Level 2
Joined
Jan 27, 2013
Messages
9
  • Team2 HeroPick
    • Ereignisse
      • Spieler - Spieler 7 (Grün) Auswählen a unit
      • Spieler - Spieler 8 (Rosa) Auswählen a unit
      • Spieler - Spieler 9 (Grau) Auswählen a unit
      • Spieler - Spieler 10 (Hellblau) Auswählen a unit
      • Spieler - Spieler 12 (Braun) Auswählen a unit
    • Bedingungen
      • And - All (Conditions) are true
        • Bedingungen
          • SelectionHeroSelected[(Player number of (Triggering player))] Gleich False
          • Or - Any (Conditions) are true
            • Bedingungen
              • (Triggering unit) Gleich Alchimist 0000 <gen>
              • (Triggering unit) Gleich Naga-Meerhexe 0001 <gen>
              • (Triggering unit) Gleich Tüftler 0002 <gen>
              • (Triggering unit) Gleich Bestienmeister 0003 <gen>
              • (Triggering unit) Gleich Dunkler Waldläufer 0004 <gen>
              • (Triggering unit) Gleich Feuerlord 0005 <gen>
              • (Triggering unit) Gleich Pandarenen-Braumeister 0006 <gen>
              • (Triggering unit) Gleich Grubenlord 0007 <gen>
              • (Triggering unit) Gleich Blutmagier 0010 <gen>
    • Aktionen
      • Auswahl - Clear selection for (Triggering player)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Bedingungen
          • (Triggering unit) Gleich Selectedunit[(Player number of (Triggering player))]
        • 'THEN'-Aktionen
          • Set locT2HS = Team2HeroSpawn <gen>
          • Einheit - Create 1 (Unit-type of (Triggering unit)) for (Triggering player) at (Center of Team2HeroSpawn <gen>) facing Vorgabe für Gebäude-Ausrichtung degrees
          • Set SelectionHeroSelected[(Player number of (Triggering player))] = True
          • Einheit - Hide (Triggering unit)
          • Custom script: call RemoveLocation(udg_locT2HS)
        • 'ELSE'-Aktionen
          • Set Selectedunit[(Player number of (Triggering player))] = (Triggering unit)
          • Wait 1.50 seconds
          • Set Selectedunit[(Player number of (Triggering player))] = Keine Einheit
JASS:
 //***************************************************************************

globals
    // User-defined
    unit array              udg_Selectedunit
    boolean array           udg_SelectionHeroSelected
    integer                 udg_Soldat_Bogenschtzen    = 0
    rect                    udg_locT1HS                = null
    rect                    udg_locT2HS                = null

    // Generated
    rect                    gg_rct_Team1HeroSpawn      = null
    rect                    gg_rct_HeroPickRegion      = null
    rect                    gg_rct_Team2HeroSpawn      = null
    rect                    gg_rct_Team1SpawnLinks     = null
    rect                    gg_rct_Team1SpawnMitte     = null
    rect                    gg_rct_Team1SpawnRechts    = null
    rect                    gg_rct_Team2SpawnRechts    = null
    rect                    gg_rct_Team2SpawnMitte     = null
    rect                    gg_rct_Team2SpawnLinks     = null
    rect                    gg_rct_Mitte               = null
    trigger                 gg_trg_Team1_HeroPick      = null
    trigger                 gg_trg_Team2_HeroPick      = null
    trigger                 gg_trg_SpielerPuefung      = null
    trigger                 gg_trg_Sentry              = null
    trigger                 gg_trg_CreepSpawns         = null
    trigger                 gg_trg_Red_modes           = null
    unit                    gg_unit_Nalc_0000          = null
    unit                    gg_unit_Nngs_0001          = null
    unit                    gg_unit_Ntin_0002          = null
    unit                    gg_unit_Nbst_0003          = null
    unit                    gg_unit_Nbrn_0004          = null
    unit                    gg_unit_Nfir_0005          = null
    unit                    gg_unit_Npbm_0006          = null
    unit                    gg_unit_Nplh_0007          = null
    unit                    gg_unit_H000_0010          = null
    unit                    gg_unit_hcas_0022          = null
    unit                    gg_unit_hcas_0023          = null
    unit                    gg_unit_hbar_0024          = null
    unit                    gg_unit_hbar_0025          = null
    unit                    gg_unit_hbar_0026          = null
    unit                    gg_unit_hbar_0032          = null
    unit                    gg_unit_hbar_0033          = null
    unit                    gg_unit_hbar_0034          = null
endglobals

function InitGlobals takes nothing returns nothing
    local integer i = 0
    set i = 0
    loop
        exitwhen (i > 12)
        set udg_Selectedunit[i] = null
        set i = i + 1
    endloop

    set i = 0
    loop
        exitwhen (i > 12)
        set udg_SelectionHeroSelected[i] = false
        set i = i + 1
    endloop

endfunction

function Trig_Team2_HeroPick_Func003Func002C takes nothing returns boolean
    if ( ( GetTriggerUnit() == gg_unit_Nalc_0000 ) ) then
        return true
    endif
    if ( ( GetTriggerUnit() == gg_unit_Nngs_0001 ) ) then
        return true
    endif
    if ( ( GetTriggerUnit() == gg_unit_Ntin_0002 ) ) then
        return true
    endif
    if ( ( GetTriggerUnit() == gg_unit_Nbst_0003 ) ) then
        return true
    endif
    if ( ( GetTriggerUnit() == gg_unit_Nbrn_0004 ) ) then
        return true
    endif
    if ( ( GetTriggerUnit() == gg_unit_Nfir_0005 ) ) then
        return true
    endif
    if ( ( GetTriggerUnit() == gg_unit_Npbm_0006 ) ) then
        return true
    endif
    if ( ( GetTriggerUnit() == gg_unit_Nplh_0007 ) ) then
        return true
    endif
    if ( ( GetTriggerUnit() == gg_unit_H000_0010 ) ) then
        return true
    endif
    return false
endfunction

function Trig_Team2_HeroPick_Func003C takes nothing returns boolean
    if ( not ( udg_SelectionHeroSelected[GetConvertedPlayerId(GetTriggerPlayer())] == false ) ) then
        return false
    endif
    if ( not Trig_Team2_HeroPick_Func003Func002C() ) then
        return false
    endif
    return true
endfunction

fu[B][/B]nction Trig_Team2_HeroPick_Conditions takes nothing returns boolean
    if ( not Trig_Team2_HeroPick_Func003C() ) then
        return false
    endif
    return true
endfunction

function Trig_Team2_HeroPick_Func002C takes nothing returns boolean
    if ( not ( GetTriggerUnit() == udg_Selectedunit[GetConvertedPlayerId(GetTriggerPlayer())] ) ) then
        return false
    endif
    return true
endfunction

function Trig_Team2_HeroPick_Actions takes nothing returns nothing
    call ClearSelectionForPlayer( GetTriggerPlayer() )
    if ( Trig_Team2_HeroPick_Func002C() ) then
        set udg_locT2HS = gg_rct_Team2HeroSpawn
        call CreateNUnitsAtLoc( 1, GetUnitTypeId(GetTriggerUnit()), GetTriggerPlayer(), GetRectCenter(gg_rct_Team2HeroSpawn), bj_UNIT_FACING )
        set udg_SelectionHeroSelected[GetConvertedPlayerId(GetTriggerPlayer())] = true
        call ShowUnitHide( GetTriggerUnit() )
        call RemoveLocation(udg_locT2HS)
    [B]else[/B] ( here it says the error "invalid argumenttype"
        set udg_Selectedunit[GetConvertedPlayerId(GetTriggerPlayer())] = GetTriggerUnit()
        call TriggerSleepAction( 1.50 )
        set udg_Selectedunit[GetConvertedPlayerId(GetTriggerPlayer())] = null
    endif
endfunction

//===========================================================================
function InitTrig_Team2_HeroPick takes nothing returns nothing
    set gg_trg_Team2_HeroPick = CreateTrigger(  )
    call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Team2_HeroPick, Player(6), true )
    call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Team2_HeroPick, Player(7), true )
    call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Team2_HeroPick, Player(8), true )
    call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Team2_HeroPick, Player(9), true )
    call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Team2_HeroPick, Player(11), true )
    call TriggerAddCondition( gg_trg_Team2_HeroPick, Condition( function Trig_Team2_HeroPick_Conditions ) )
    call TriggerAddAction( gg_trg_Team2_HeroPick, function Trig_Team2_HeroPick_Actions )
endfunction

whereever i put the customscript to delete the variable i get an error can u help me pls >.<
sorry for this being half in german but idk how i can change the world editor language to english <.<
EDIT: oh y i am pretty new to this forum so idk how to make spoilers dont be too harsh too me >.< arrigato goseimasu
 
Last edited:
Level 29
Joined
Oct 24, 2012
Messages
6,543
in this line Einheit - Create 1 (Unit-type of (Triggering unit)) for (Triggering player) at (Center of Team2HeroSpawn <gen>) facing Vorgabe für Gebäude-Ausrichtung degrees
cahng (Center of Team2HeroSpawn <gen>) to locT2HS and change this Set locT2HS = Team2HeroSpawn <gen> to Set locT2HS = (Center of (Team2HeroSpawn <gen>) )

note: the way u have it listed above is not the way to remove leaks u have to set a temp variable then use tht temp variable then remove the temp variable to clean up the leaks
 
Level 2
Joined
Jan 27, 2013
Messages
9
in this line Einheit - Create 1 (Unit-type of (Triggering unit)) for (Triggering player) at (Center of Team2HeroSpawn <gen>) facing Vorgabe für Gebäude-Ausrichtung degrees
cahng (Center of Team2HeroSpawn <gen>) to locT2HS and change this Set locT2HS = Team2HeroSpawn <gen> to Set locT2HS = (Center of (Team2HeroSpawn <gen>) )

so you basicly want me to change the value of the variable to Center of (Team2HeroSpawn) , there is no such an option sir^^
EDIT: did you maybe mean that i should change (Center of Team2HeroSpawn<gen>) to locT2HS ? i did that now but the thing is the custom script is still making problems ;)

note: the way u have it listed above is not the way to remove leaks u have to set a temp variable then use tht temp variable then remove the temp variable to clean up the leaks
=/ so how do i make a temporary variable and then rmeove it ? i looked into another topic and it wasnt explained further


  • Set loc = Somewhere
    • Unit - Create 1 unit at loc
    • Custom script: call RemoveLocation(udg_loc)
??? :eekani:

Edit: this function works fine without the variable and the custom script the problem is it doesnt work anymore after i filled in the custom script . i believe this might leak so thats why i implementated it in the first place , so i'd love if some1 could tell me how to do this the right way because i cant solve this ^^
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
this is the way u have it listed change it from this

  • Actions
    • Set locT2HS = (Center of (Playable map area))
    • Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
    • Custom script: call RemoveLocation(udg_locT2HS)
change it to this

  • Actions
    • Set locT2HS = (Center of (Playable map area))
    • Unit - Create 1 Footman for Player 1 (Red) at locT2HS facing Default building facing degrees
    • Custom script: call RemoveLocation(udg_locT2HS)

ur problem may be in the variable editor locT2HS has to be a point if im not mistaken u seem to be using region as the variable type

if u have any more problems upload ur map and ill have a closer look for u
 
Last edited:
Level 2
Joined
Jan 27, 2013
Messages
9
ahhh a point variable well that makes sense ^^ thank you , so my location doesnt leak anymore : p , if i am not mistaken^^
 
Level 2
Joined
Jan 27, 2013
Messages
9
  • Set locT2HS = (Center of Team2HeroSpawn <gen>)
  • Einheit - Create 1 (Unit-type of (Triggering unit)) for (Triggering player) at locT2HS facing Vorgabe für Gebäude-Ausrichtung degrees
  • Set SelectionHeroSelected[(Player number of (Triggering player))] = True
  • Einheit - Hide (Triggering unit)
  • Custom script: call RemoveLocation(udg_locT2HS)
is this now deleaked?^^
Edit: thanks for your support deathisimyfriend , admin can close topic now ;)
 
Last edited:
Status
Not open for further replies.
Top