OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Mr.Pibb on 17 Dec 2004, 02:10:44

Title: Getting the player that tripped a trigger and is in a global in condit field
Post by: Mr.Pibb on 17 Dec 2004, 02:10:44
Hello all,

Got what is prolly going to be a real brain teaser here: ::)

I have a trigger setup around a flag pole, the trigger is designed to change the flag to the appropriate one when a player or different side than west crosses thru the prox zone. Each player MAY possibly be referenced within a certain global variable.

 Therefore I need to get the player that tripped the trigger (normally local player) and see if he is in that global variable also, sounds easy? I thought, oh yea, just do this: condit: this && (local player) == player in clantown0, and with no great suprise the editor returned an error(i can provide it if neccessary)

 Now, on the flip side, -- condition:this && player in clantown0, works a treat! Except, there are 9 players, therefore this will refer to ANY player on the whole dang map, regardless of who actually tripped the trigger. :(

 So, anyone know of a way to get that trigger condition to get : if the player that tripped this trigger is also in clantown0 <---- Global Variable  ??

Pibb

:)

Title: Re:Getting the player that tripped a trigger and is in a global in condit field
Post by: RedHouse on 17 Dec 2004, 03:07:46
not to sure what your asking but i think you could try listing an array of all the units in the trigger (list tiggername), then check if the unit is in the array (unit1 in [unit2, unit1]).
Title: Re:Getting the player that tripped a trigger and is in a global in condit field
Post by: Mr.Pibb on 17 Dec 2004, 03:12:57
RedHouse, can you provide an example please, I am lil confused as to what you are saying to input and how to do it, is that a trigger condition line?

:)

Pibb
Title: Re:Getting the player that tripped a trigger and is in a global in condit field
Post by: Triggerhappy on 17 Dec 2004, 03:19:52
on the trigger, put:
this && "_x in clantown0" foreach thislist
Title: Re:Getting the player that tripped a trigger and is in a global in condit field
Post by: RedHouse on 17 Dec 2004, 03:38:50
is this similiar to what you mean

just change the sqm file's name to just mission, create a folder call it anything you want put the file in the folder then play the mission
Title: Re:Getting the player that tripped a trigger and is in a global in condit field
Post by: RedHouse on 17 Dec 2004, 04:15:54
if you want the actual names of the units returned and put into one global variable use this script

again it's just the missions sqm file
Title: Re:Getting the player that tripped a trigger and is in a global in condit field
Post by: RedHouse on 17 Dec 2004, 04:40:15
if you tell me exactly what you need I will send you an example mission that is fully functional and explains everything.
Title: Re:Getting the player that tripped a trigger and is in a global in condit field
Post by: Mr.Pibb on 17 Dec 2004, 05:23:25
@ RedHouse

Heres the easiest way to describe it:

in a seperate script, a global variable is assigned to a player in a mp game, name clantown0

Then, in a trigger:

Radius:10
Activation:anybody,repeatedly

In the condition, I am seeking to get if the player that tripped this trigger (normally local player) is in clantown0 <---global variable

Therefore, the trigger would only activate if the player that tripped the trigger had that global variable assigned to him.

I can take a look at that stuff tommorow RedHouse, its too late now.

@Triggerhappy

I will give that a try tommorow, thanks  ;)

Thank you very much for the help guys


Pibb
Title: Re:Getting the player that tripped a trigger and is in a global in condit field
Post by: RedHouse on 17 Dec 2004, 15:45:09
i'd take a look at the trip2 demo but i'm not used to the way ofp works in multiplayer because i mostly script for singleplayer
Title: Re:Getting the player that tripped a trigger and is in a global in condit field
Post by: Mr.Pibb on 18 Dec 2004, 00:49:46
@Triggerhappy

Tried the new script line in the condition field, caused an error in editor:

this && "_x in clantown0" foreach thislist |#|:Error &&: Type Any, expected Bool

going to mess around with some combos of that script line ya got and see if something works maybe.

@RedHouse

Going to give that test mission a shot soon if I cant get the condition field to work first :) , thank you for the time doin that.

Just so you know so there isnt any confusion, I have all the scripts and whatnot that is neccessary for assigning the global to players, what I am trying to do is just within a trigger condition field (hopefully), which is have a script line in the condit field that will see if the player that tripped the trigger is within a certain global variable, and hence activate the trigger upon that criteria :)

Like I said in the Topic description, a brain teaser lol ::)

Pibb
Title: Re:Getting the player that tripped a trigger and is in a global in condit field
Post by: RedHouse on 18 Dec 2004, 00:54:26
the trip2 thing might be just what your looking for
Title: Re:Getting the player that tripped a trigger and is in a global in condit field
Post by: Mr.Pibb on 18 Dec 2004, 01:40:05
Gotcha, Ill have a look at it RedHouse, Thanks :)

Pibb
Title: Re:Getting the player that tripped a trigger and is in a global in condit field
Post by: Mr.Pibb on 18 Dec 2004, 02:36:37
@RedHouse

Unfortunately the condition Field script does not work in my MP mission as you have it, must be some clash there, cause it brings up an error everytime in the editor, of course, it works fine with single player in yer mission.
Dont know.

Pibb

btw - nice test mission, I do appreciate that work you did, neat how you got the guys running thru the flag so they will be referenced ;)
Title: Re:Getting the player that tripped a trigger and is in a global in condit field
Post by: Mr.Pibb on 18 Dec 2004, 02:47:26
@RedHouse

Ok, didnt realize that the method you have dosent actually use the condition field for the check but the activation, let me look over things again and I will get back on this :)

Pibb
Title: Re:Getting the player that tripped a trigger and is in a global in condit field
Post by: Mr.Pibb on 18 Dec 2004, 03:12:32
Guys, looks like I will prolly have to make the neccessary changes in the script for the flag, using RedHouses method is only applicable with the activation field, which in my trigger the activation field executes the flag script.

I will see if I cant gather all this info and get it working in the script, if anyone can come up with a trigger condition field that would work with this let me know please :)

It will be a lil while before I can get the script for the flag changed (rough estimate lol  ::) ) but I think I can do this in the script with the info I now have, unless someone can get the condition feild with the required criteria working, but I think it wont do it there.

I will solve this topic as soon as an ultimatum is found, or if it just seems it cant be done(which could happen quick; quick = a few days = seems cant be done)

Cyas round

Pibb
Title: Re:Getting the player that tripped a trigger and is in a global in condit field
Post by: RedHouse on 18 Dec 2004, 03:47:30
if the trigger executes a script i've made it so the unit that tripped the trigger is a globalvariable called globalunit, or something similiar. so if you put something like this in the script
? globalunit == unit1: goto "unit1"
? globalunit == unit2: goto "unit2"
? globalunit == unit3: goto "unit3"

you can go to different parts in the script, i don't know if this is any help to you because i'm still unsure of what your trying to do as I'm not used to scripting for multiplayer.
Title: Re:Getting the player that tripped a trigger and is in a global in condit field
Post by: Mr.Pibb on 18 Dec 2004, 16:22:23
Thanks RedHouse, not sure exactly how I am going to do this, but all the provided info will be looked at and used as neccessary from you and your mission, so thanks a bunch. :)
 On to christmas shopping  :P (and added bonus of house cleaning too! :( )

Cyas around

Pibb
Title: Re:Getting the player that tripped a trigger and is in a global in condit field
Post by: RedHouse on 18 Dec 2004, 17:03:20
no problemo