Home   Help Search Login Register  

Author Topic: Detecting a certain unit  (Read 478 times)

0 Members and 1 Guest are viewing this topic.

MONOLITH

  • Guest
Detecting a certain unit
« on: 11 Sep 2003, 11:03:14 »
Ok here is the problem

I need to be able to detect when a certain unit trips a trigger and then i want to give that unit a variety of weapons. I know how to add the weapons and such. I need a script that will detect a which units enters the trigger and place it in script. I know you can use

_unit = thisselect_0
or something simlar to place a unit into an exec field, i want the trigger to automatically place the name of the unit into the exec field when the unit enters the trigger.

Sorry if the description is a little messed. Thanks for any help

Offline Dinger

  • Contributing Member
  • **
  • where's the ultra-theoretical mega-scripting forum
Re:Detecting a certain unit
« Reply #1 on: 11 Sep 2003, 15:06:45 »
well, it won't work in some combined cases, but the quick and dirty way is:

[thislist select 0] exec "myscript.sqs"
Dinger/Cfit

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Detecting a certain unit
« Reply #2 on: 11 Sep 2003, 15:23:50 »
da quick n dirty way is 2 group da unit 2 da triger :P

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

skreet

  • Guest
Re:Detecting a certain unit
« Reply #3 on: 15 Sep 2003, 14:11:31 »
well, one way is this: you start a script when someone triggers that specific trigger and that script constantly checks who enters it's area. when the unit you want to give weapons to enters the area it gives them to it.

set triggers activation to anybody ( or if the specific unit is on either side set the activation side accordingly)
this goes to the triggers on activation field:
[unitname, triggername] exec "check_certain_unit.sqs" (presumes that unitname is a global variable, triggername is the name of this trigger)

in check_certain_unit.sqs:
_unit = _this select 0
_area = _this select 1

#loop
?_unit in list _area: goto "give_weapons"
~1 ( set delay to anything u like)
goto "loop"

#give_weapons
(in here you do all that is needed to give weapons for the unit)
;then exit
exit

this script is reuseable, so you can make many areas that gives weapons to different units if u like.. hope this will help in a way or another.. I haven't checked my code, but hope it's not too much bugged  ;)
« Last Edit: 15 Sep 2003, 14:24:32 by skreet »

MONOLITH

  • Guest
Re:Detecting a certain unit
« Reply #4 on: 16 Sep 2003, 08:24:21 »
Thanks people for the feedback, it helped alot. :cheers: