Home   Help Search Login Register  

Author Topic: HELP WITH THE "foreach thislist" command!!!!  (Read 2747 times)

0 Members and 1 Guest are viewing this topic.

tai mai shu

  • Guest
HELP WITH THE "foreach thislist" command!!!!
« on: 21 Aug 2002, 08:59:51 »
hello, im making an mp mission (please dont move this mods)

i want to make a respawn protection that is more advanced than the "kill anything in this trigger" type thing.

instead, i wanna make a system that gives the side who's respawn has been violated, the chance to get revenge on the violator (hehehe).

what i did was make a trigger that is activated by west present

on activation i put "removeallweapons _x; _x setpos getpos Cage" foreach thislist
repeatedly

what it does is takes the violators guns away, and puts him in a cage where he is helpless to defend himself, and the enemy gets a free kill.

the 2 problems im having is that when one person activates it, any person after him is not affected.  for example, joe blow walks into enemy respawn, and gets take prisoner.  but his good buddy Mark walks into the enemy respawn, but nuthin happens to him  :o  am i writing the script innapopriately?!?!

another problem im having is, if the person is in a vehicle, he and the vehicle is placed in the cage, and he runs over the fence, thus ruing the neat little cage i made.  how can i detect if the violator is in a vehicle, remove the vehicle, eject the ciolator, and place him in the cage???

any help will be EXTREMELY APPRECIATED  ;D  ;D  ;D

thanks
Tai Mai Shu

Offline KTottE

  • Former Staff
  • ****
Re:HELP WITH THE "foreach thislist" command!!!!
« Reply #1 on: 21 Aug 2002, 09:59:25 »
The first part is easy, make sure your trigger is set to be activated repeatedly, not just once.
The second part is a bit trickier.

* KTottE calls up his trusted old ComRef *

Quote
crew vehicle
Operand types:
    vehicle: Object
Type of returned value:
    Array
Description:
    All units mounted in given vehicle. If vehicle is not vehicle, but person, list containing only person is returned.

Example:
    crew vehicle player


I think this could be used to your advantage.
This will return each soldier in a vehicle, and return them in an array. Then you could run another/modified script that takes each unit in that array and moves them into the cage.
I'm not sure how the data is returned from this command, since I have never used it myself, so experiment with it.

Edit
I forgot to mention that you have to do UnAssignVehicle to get them out, then you do DeleteVehicle to get rid of the vehicle.
Or you could move that vehicle to the violated side's vehicle stash (if there is one) so that the violator learns his lesson.
« Last Edit: 21 Aug 2002, 10:02:20 by KTottE »
"Life is not a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside, thoroughly used up, totally worn out, and loudly proclaiming 'WOW What a Ride!'"

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:HELP WITH THE "foreach thislist" command!!!!
« Reply #2 on: 21 Aug 2002, 10:02:05 »
if u wanna check if unit is in a vehicle just use as a condition

vehicle unitname != unitname

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

Bremmer

  • Guest
Re:HELP WITH THE "foreach thislist" command!!!!
« Reply #3 on: 21 Aug 2002, 10:53:48 »
I'm not convinced that changing the trigger to repeating will resolve the first problem. In my experience a trigger will start repeating only after its condition statement becomes false. ie if two units enter a repeating trigger in quick succession then thislist will contain the first unit, but not the second if the first unit is still in the trigger.

The way around this is to place a couple of repeating triggers with identical conditions nested inside each other. Place them so their boundaries are close together (a couple of meters seperation is fine). Also place your cage outside the trigger area or the triggers will always be true, and thislist will not update.

Cheers

tai mai shu

  • Guest
Re:HELP WITH THE "foreach thislist" command!!!!
« Reply #4 on: 21 Aug 2002, 11:25:38 »
omg bremmer, that post just cracked the first problem, thanks a lot!!!! me being such a newb, didnt understand that the thislist command can be only activated once, then waits for the condition to be false before being able to be reactivated.

since the POW cage was inside the enemy base, the man who was the pow would hence remain in the trigger field, and the thislist linne could not be activated because the POW would not allow the conditio to turn false. thanks a lot.  what i will do is make a trigger covering teh entire pow cage, in teh command line, ill put POWlist = thislist  hten in the main trigger, ill put Capturelist = thislist - Powlist "commandline...." foreach Capturelist, therefore the main trigger will not repeatedly be activated by the POW, now what i need is another stupid loop so that the POW doesnt concurrently reactivate the stupid POWlsit trigger, goddamn repetitive loops.

i still need to figure out how to make the peeps leave their vehicles without crashing it into the enemy squa or pow cage (the cage ispretty useless if there a big mofo AH1 sitting int eh middle of it LMAO  ;D)

oh yeah, LCD thanks for your little loophole tip, it should help me a lot  ;)

ill keep you guys posted, peace out
tai mai shu

tai mai shu

  • Guest
Re:HELP WITH THE "foreach thislist" command!!!!
« Reply #5 on: 24 Aug 2002, 02:56:10 »
damnit, even with all this help, the script still isnt working worth crap!!!!!! :noo:

iv nailed it so that any soldiers will be put in the cage, properly, but the damn vehicles keep screwing it up!!! any vehicle that enters the trigger zone, will move intot eh cage!!! and destroy it!!! this is sooo annoying!!!!  heres my problems:

1) i cant detect if the unit is in a vehicle
2) if the unit is ina  vehicle, i cant get him to eject/get out, while staying alive!!!

heres my situation, i ahve a trigger, and in the condition, i put west present, repeatedly

in activation, i put "thislist exec "makePow.sqs"

in the script, i use "_this select 0" to find the player

the only problem is that is think that "_this select 0" is returning the vehicle, not the player!!!

How do i find the PLAYER ONLY, and how do i detect if hes on foot, in a car or tank, or if hes ina  helicopter????

ANYONE!!! PLEASE HELP ME!!! I THINK IM GOING CRAZY TRYING TO FIGURE THIS OUT!!!!!!!!!!!!!!!!!!! :help:  :gunman: :tomato: