Enter/Exit Vehicles with Abilities

Status
Not open for further replies.
Level 10
Joined
May 20, 2008
Messages
433
I wish to have units gain the ability to enter a vehicle when 100x away, but when they are not, they lose the ability.
Giving the unit the ability is simple (when [triggering unit] is 100 away from unit add ability). The issue is removing the ability, as there is nothing I'm aware of that checks if a unit is '=>100' away from unit. I'm thinking of using a buff as a way to check distance (every X seconds, if unit has [buff] add ability else remove ability), but I'm wondering if there is a simpler way.
 
Level 15
Joined
Oct 16, 2010
Messages
942
Periodic is the only way I can think to do it. I wouldn't do a buff I would just check the distance between the unit and the vehicle every x seconds to see if it's greater than or equal to 100 away. A buff would be messier in-game.
 
Level 10
Joined
May 20, 2008
Messages
433
Periodic is the only way I can think to do it. I wouldn't do a buff I would just check the distance between the unit and the vehicle every x seconds to see if it's greater than or equal to 100 away. A buff would be messier in-game.

True, but I'm not finding anything related to checking the distance, like:
  • if ((unit)'s distance from (unit2)) is greater than or equal to 101
This is the only thing close to being relevant:
  • Unit - A unit comes within 100.00 of Main Battle tank 0001 <gen>
Of course that's only an event where a unit comes within 100 of the tank (IOW, it only checks when the unit gets closer, not farther).
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Also, the use of Unit - A unit comes within... MUST have a pre-placed unit in the map, for referrence
Try base it off Devotion Aura, edit the buff
When unit gets that buff, that particular unit gains the ability of entering the vehicle
When it is far, it'll lose the buff, remove the ability
Use Event - Periodic Timer to check once every second
This is the simplest, I think

You can also use Unit Group action
Once every second, Pick every unit in radius of XXX around the tank
If picked unit is in radius, grant ability, if not, remove ability
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
Baldemaster = tank

  • Untitled Trigger 067
    • Events
      • Unit - A unit comes within 128.00 of Blademaster 0068 <gen>
      • Unit - A unit comes within 128.00 of Blademaster 0069 <gen>
    • Conditions
      • ((Triggering unit) is in group) Equal to False
    • Actions
      • Unit Group - Add (Triggering unit) to group
      • Trigger - Turn on Untitled Trigger 068 <gen>
      • Unit - Add Holy Light to (Triggering unit)
  • Untitled Trigger 068
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in group and do (Actions)
        • Loop - Actions
          • Game - Display to Player Group - Player 1 (Red) the text: Picked
          • Set u1 = (Picked unit)
          • Set boolean = False
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (u1 is alive) Equal to True
            • Then - Actions
              • Set p1 = (Position of u1)
              • Unit Group - Pick every unit in tanks and do (Actions)
                • Loop - Actions
                  • Set u2 = (Picked unit)
                  • Set p2 = (Position of u2)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Distance between p1 and p2) Less than 150.00 // set this to slighlty larger value than the "unit becomes within range"
                    • Then - Actions
                      • Set boolean = True
                    • Else - Actions
                  • Custom script: call RemoveLocation(udg_p2)
              • Custom script: call RemoveLocation(udg_p1)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • boolean Equal to False
            • Then - Actions
              • Unit - Remove Holy Light from u1
              • Unit Group - Remove u1 from group
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (group is empty) Equal to True
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                  • Game - Display to Player Group - Player 1 (Red) the text: Off
                • Else - Actions
            • Else - Actions
Also, the use of Unit - A unit comes within... MUST have a pre-placed unit in the map, for referrence

  • Untitled Trigger 069
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to tank
    • Actions
      • Trigger - Add to (some trigger) the event (Unit - A unit comes within x of (Triggering unit))
or
  • Untitled Trigger 072
    • Events
      • *some event*
    • Conditions
    • Actions
      • Set u1 = *some unit*
      • Custom script: call TriggerRegisterUnitInRange( gg_trg_Untitled_Trigger_070 , udg_u1 , 128 , null )
 
Level 10
Joined
May 20, 2008
Messages
433
Baldemaster = tank

  • Untitled Trigger 067
    • Events
      • Unit - A unit comes within 128.00 of Blademaster 0068 <gen>
      • Unit - A unit comes within 128.00 of Blademaster 0069 <gen>
    • Conditions
      • ((Triggering unit) is in group) Equal to False
    • Actions
      • Unit Group - Add (Triggering unit) to group
      • Trigger - Turn on Untitled Trigger 068 <gen>
      • Unit - Add Holy Light to (Triggering unit)
  • Untitled Trigger 068
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in group and do (Actions)
        • Loop - Actions
          • Game - Display to Player Group - Player 1 (Red) the text: Picked
          • Set u1 = (Picked unit)
          • Set boolean = False
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (u1 is alive) Equal to True
            • Then - Actions
              • Set p1 = (Position of u1)
              • Unit Group - Pick every unit in tanks and do (Actions)
                • Loop - Actions
                  • Set u2 = (Picked unit)
                  • Set p2 = (Position of u2)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Distance between p1 and p2) Less than 150.00 // set this to slighlty larger value than the "unit becomes within range"
                    • Then - Actions
                      • Set boolean = True
                    • Else - Actions
                  • Custom script: call RemoveLocation(udg_p2)
              • Custom script: call RemoveLocation(udg_p1)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • boolean Equal to False
            • Then - Actions
              • Unit - Remove Holy Light from u1
              • Unit Group - Remove u1 from group
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (group is empty) Equal to True
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                  • Game - Display to Player Group - Player 1 (Red) the text: Off
                • Else - Actions
            • Else - Actions


  • Untitled Trigger 069
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to tank
    • Actions
      • Trigger - Add to (some trigger) the event (Unit - A unit comes within x of (Triggering unit))
or
  • Untitled Trigger 072
    • Events
      • *some event*
    • Conditions
    • Actions
      • Set u1 = *some unit*
      • Custom script: call TriggerRegisterUnitInRange( gg_trg_Untitled_Trigger_070 , udg_u1 , 128 , null )

The first set of triggers worked nicely up until here:
  • If - Conditions
    • (Distance between p1 and p2) Less than 150.00
Could not find any way of doing this (apparently you can't convert points to integers/reals in any way/shape/form).
Plus, by the looks of it, it would only work for 1 unit, when there is a total of 6 (excluding other potential vehicles).
 
Level 10
Joined
May 20, 2008
Messages
433
I tested it, and it did work. The one thing I found out, though, is that units being transported inside the vehicle still exist where they were placed, as if the vehicle passes by the loading area, the test text pops up (well, until I created the trigger to turn it off when boarded). +Rep
 
Status
Not open for further replies.
Top