Home   Help Search Login Register  

Author Topic: Assigning a script to created vehicles  (Read 774 times)

0 Members and 1 Guest are viewing this topic.

TH

  • Guest
Assigning a script to created vehicles
« on: 01 Aug 2004, 16:30:23 »
In mfcti how can i assign a script/scripts to a vehicle as soon as its built at the factory, or build menu...for example when a person builds a flag i want it to be assigned a script.

Offline Roni

  • Members
  • *
  • Play the Game !
Re:Assigning a script to created vehicles
« Reply #1 on: 01 Aug 2004, 23:19:33 »
Hi TH !

You can ether give the new object a name and then give the named object the addaction or, if the new object is created next to a known object such as the player, then you can search for the nearest object of that type and assign it that way.

Example 1 -

newObject = "ACamp" createVehicle [_xPos, _yPos, 0]
newObject addAction ["Break Camp", "breakcamp.sqs"]


OR

"ACamp" createVehicle [_xPos, _yPos, 0]
nearestobject [_player, "ACamp"] addAction ["Break Camp", "breakcamp.sqs"]



I prefer the second method, that way I can create multiple versions of the same object without having to give each one a unique name.

Good luck !



Roni

TH

  • Guest
Re:Assigning a script to created vehicles
« Reply #2 on: 01 Aug 2004, 23:48:49 »
thx roni, got it to work a different way... ;D

Offline Roni

  • Members
  • *
  • Play the Game !
Re:Assigning a script to created vehicles
« Reply #3 on: 02 Aug 2004, 01:41:49 »
No probs - good luck with it !