• 🏆 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!

How to make a player control a unit but not make it move?

Status
Not open for further replies.
Level 6
Joined
Feb 16, 2014
Messages
193
So i'm making a modern warfare type of map where you have to battle zombies along with other players,you can control different types of vehicles like an AC-130,it has 3 different weapons(25mm gatling,40mm Bofors Autocannon and 105mm Howitzer) 3 players can each control a specific gun,but the one who controls the 25mm gatling gets to be the one to pilot the plane,so heres what i want to do:
3 flying units follow each other(like the flying machine unit) they each have 1 ability(1st one has 25mm gatling 2nd one has the 40mm then the 3rd one has the 105mm cannon) then the player who controls one of them gets the ability to use that weapon, but heres my problem:
how to make it the 2nd and 3rd one continuously follow the 1st one regardless of which player owns it(they cant order it to move anywhere but they can still use the ability) how to do that? :ogre_rage: :vw_wtf:
 
Level 17
Joined
Feb 11, 2011
Messages
1,860
Hello,
You'll need a simple trigger that activates when the player orders the unit to do something other that use the ability. Something like:

  • Untitled Trigger 001
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Issued order) Equal to (Order(move))
    • Actions
      • Trigger - Turn off (This trigger)
      • Unit - Order (Triggering unit) to Follow someUnit
      • Trigger - Turn on (This trigger)
You'll need to change it a bit to prevent the player from making the unit stop, hold position or attack-ground. I'll try to help where I can, but I'm no GUI expert :p
 
Level 6
Joined
Feb 16, 2014
Messages
193
  • Follow
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Issued order) Equal to (Order(move))
    • Actions
      • Trigger - Turn off (This trigger)
      • Unit - Order (Ordered unit) to Follow Peasant 0005 <gen>
      • Trigger - Turn on (This trigger)
It didnt work,did i do it wrong?
 
Level 17
Joined
Feb 11, 2011
Messages
1,860
Sorry, wasn't thinking properly :p
Here's some working triggers:

  • No Target
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Peasant
    • Actions
      • Game - Display to (All players) the text: No target
      • Trigger - Turn off Object Target <gen>
      • Unit - Order (Triggering unit) to Follow Footman 0001 <gen>
      • Trigger - Turn on Object Target <gen>
  • Object Target
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Peasant
    • Actions
      • Game - Display to (All players) the text: Object target
      • Trigger - Turn off (This trigger)
      • Unit - Order (Triggering unit) to Follow Footman 0001 <gen>
      • Trigger - Turn on (This trigger)
  • Point Target
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Peasant
    • Actions
      • Game - Display to (All players) the text: Point target
      • Trigger - Turn off Object Target <gen>
      • Unit - Order (Triggering unit) to Follow Footman 0001 <gen>
      • Trigger - Turn on Object Target <gen>
I had a test map with a peasant, footman and rifleman. When the peasant was ordered to do anything, it was re-ordered to follow the footman.
You can remove all the "Trigger - Turn off" and "Trigger - Turn on" actions; they just prevent the "Object Target" trigger from being executed twice each time.
 
Level 12
Joined
Oct 16, 2010
Messages
680
that will prevent the units the use of their abilities... so i would prefer a solution of units (the following ones) with 0 movespeed and reposition them by SetUnitX/Y

Edit: an example
  • Events
    • Time - Every 0.03 sec of game time
  • Conditions
  • Actions
    • Custom script: SetUnitX(udg_FolowingUnit,udg_TempX)
    • Custom script: SetUnitY(udg_FolowingUnit,udg_TempY)
    • Set TempX = x coordinate of LeadUnit's position
    • Set TempY = y coordinate of LeadUnit's position
 
Last edited:
Level 17
Joined
Feb 11, 2011
Messages
1,860
that will prevent the units the use of their abilities... so i would prefer a solution of units (the following ones) with 0 movespeed and reposition them by SetUnitX/Y

Oh yes, you should also add a condition to check that the orders are either:

  • Move
  • Attack
  • Stop
  • Hold Position
  • There might be others
Lender's solution would be better; periodically set the following units' positions using triggers.
 
Status
Not open for further replies.
Top