How to remove point variable with array(s)

Nathan0093

New Member
Reaction score
4
I tried to use the function "call RemoveLocation(udg_) but everytime I save WE would say that I didnt do it right. Can anyone take a look at this trigger and help me correct it?
Code:
SW Bridge LR
    Events
        Unit - A unit enters SW Bridge Left Enter <gen>
        Unit - A unit enters SW Bridge Left Enter 2 <gen>
        Unit - A unit enters SW Bridge Left Enter 3 <gen>
    Conditions
        Or - Any (Conditions) are true
            Conditions
                (Unit-type of (Triggering unit)) Equal to Merchant Vessel
                (Unit-type of (Triggering unit)) Equal to Transport Ship
                (Unit-type of (Triggering unit)) Equal to Assault Ship
                (Unit-type of (Triggering unit)) Equal to Demolition Ship
                (Unit-type of (Triggering unit)) Equal to War Galley
                (Unit-type of (Triggering unit)) Equal to Ballistic Frigate
                (Unit-type of (Triggering unit)) Equal to Cannon Galleon
                (Unit-type of (Triggering unit)) Equal to Hydra
                (Unit-type of (Triggering unit)) Equal to Mur'gul Tidewarrior
                (Unit-type of (Triggering unit)) Equal to Snap Dragon
                (Unit-type of (Triggering unit)) Equal to Sea Giant
                (Unit-type of (Triggering unit)) Equal to Giant Sea Turtle
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Triggering unit) is selected by (Owner of (Triggering unit))) Equal to True
            Then - Actions
                Set BridgeLocation[(Integer A)] = (Center of SW Bridge Right Exit <gen>)
                Unit - Hide (Triggering unit)
                Unit - Move (Triggering unit) instantly to BridgeLocation[(Integer A)], facing (Facing of (Triggering unit)) degrees
                Wait 2.00 game-time seconds
                Unit - Unhide (Triggering unit)
                Selection - Select (Triggering unit) for (Owner of (Triggering unit))
                Unit - Order (Triggering unit) to Right-Click CurrentTargetPointShip[(Custom value of (Triggering unit))]
                [U]Custom script:   call RemoveLocation(udg_BridgeLocation[(Integer A)])[/U]            Else - Actions
                Set BridgeLocation[(Integer A)] = (Center of SW Bridge Right Exit <gen>)
                Unit - Hide (Triggering unit)
                Unit - Move (Triggering unit) instantly to BridgeLocation[(Integer A)], facing (Facing of (Triggering unit)) degrees
                Wait 2.00 game-time seconds
                Unit - Unhide (Triggering unit)
                Unit - Order (Triggering unit) to Right-Click CurrentTargetPointShip[(Custom value of (Triggering unit))]
                [U]Custom script:   call RemoveLocation(udg_BridgeLocation[(Integer A)])[/U]
 

trb92

Throwing science at the wall to see what sticks
Reaction score
142
You don't use (Integer A). In JASS, that translates to bj_forLoopAIndex. So your code would be

Code:
Custom script:   call RemoveLocation(udg_BridgeLocation[bj_forLoopAIndex])

Not sure why your using Integer A though, this is outside a loop so that's not going to work properly...
 

Nathan0093

New Member
Reaction score
4
I want to make it MUI but dont know how. When multiple units try to cross under the bridge at once they can still go through, but an error message pops up that says "Double free of Location in "Trig_SW_Bridge_RL_Actions." Help again, guys?
Code:
SW Bridge LR
    Events
        Unit - A unit enters SW Bridge Left Enter <gen>
        Unit - A unit enters SW Bridge Left Enter 2 <gen>
        Unit - A unit enters SW Bridge Left Enter 3 <gen>
    Conditions
         Multiple ConditionsOr - Any (Conditions) are true
            Conditions
                (Unit-type of (Triggering unit)) Equal to (==) Merchant Vessel
                (Unit-type of (Triggering unit)) Equal to (==) Transport Ship
                (Unit-type of (Triggering unit)) Equal to (==) Assault Ship
                (Unit-type of (Triggering unit)) Equal to (==) Demolition Ship
                (Unit-type of (Triggering unit)) Equal to (==) War Galley
                (Unit-type of (Triggering unit)) Equal to (==) Ballistic Frigate
                (Unit-type of (Triggering unit)) Equal to (==) Cannon Galleon
                (Unit-type of (Triggering unit)) Equal to (==) Hydra
                (Unit-type of (Triggering unit)) Equal to (==) Mur'gul Tidewarrior
                (Unit-type of (Triggering unit)) Equal to (==) Snap Dragon
                (Unit-type of (Triggering unit)) Equal to (==) Sea Giant
                (Unit-type of (Triggering unit)) Equal to (==) Giant Sea Turtle
    Actions
         Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Triggering unit) is selected by (Owner of (Triggering unit))) Equal to (==) True
            Then - Actions
                Set BridgeLocation1 = (Center of SW Bridge Right Exit <gen>)
                Unit - Hide (Triggering unit)
                Unit - Move (Triggering unit) instantly to BridgeLocation1, facing (Facing of (Triggering unit)) degrees
                Wait 2.00 game-time seconds
                Unit - Unhide (Triggering unit)
                Selection - Select (Triggering unit) for (Owner of (Triggering unit))
                Unit - Order (Triggering unit) to Right-Click CurrentTargetPointShip[(Custom value of (Triggering unit))]
                Custom script:   call RemoveLocation(udg_BridgeLocation1)
            Else - Actions
                Set BridgeLocation1 = (Center of SW Bridge Right Exit <gen>)
                Unit - Hide (Triggering unit)
                Unit - Move (Triggering unit) instantly to BridgeLocation1, facing (Facing of (Triggering unit)) degrees
                Wait 2.00 game-time seconds
                Unit - Unhide (Triggering unit)
                Unit - Order (Triggering unit) to Right-Click CurrentTargetPointShip[(Custom value of (Triggering unit))]
                Custom script:   call RemoveLocation(udg_BridgeLocation1)
 

vypur85

Hibernate
Reaction score
803
Code:
                Set BridgeLocation1 = (Center of SW Bridge Right Exit <gen>)
                Unit - Hide (Triggering unit)
                Unit - Move (Triggering unit) instantly to BridgeLocation1, facing (Facing of (Triggering unit)) degrees
[B]                Custom script:   call RemoveLocation(udg_BridgeLocation1)[/B]
                Wait 2.00 game-time seconds
[B]                Set BridgeLocation1 = (Center of SW Bridge Right Exit <gen>)[/B]
                Unit - Unhide (Triggering unit)
                Selection - Select (Triggering unit) for (Owner of (Triggering unit))
                Unit - Order (Triggering unit) to Right-Click CurrentTargetPointShip[(Custom value of (Triggering unit))]
                Custom script:   call RemoveLocation(udg_BridgeLocation1)

Try adding the bolded lines before and after the wait. You may be destroying an inexisting point variable. Do the same thing for the Else function (or whatever it's called).
 

Nathan0093

New Member
Reaction score
4
^ It worked. +rep as promised lol. Anyway, if a selected group of ships crossed the bridge then only the last unit coming out would be selected. How would I fix this?
 
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