OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: TheCaptn on 28 Jan 2005, 07:07:52

Title: Trigger to activate the first time each player enters?
Post by: TheCaptn on 28 Jan 2005, 07:07:52
I'm still working on the same mission. I've managed to figure out out everything except this.

I've got my three players and I want them to activate a trigger the first time each of them enters it's zone. But I only want to activate it on -that- player's computer.

You see they may be there as a group, but they may not... If the first person to reach it activates the trigger for all of them and the other two aren't present then that story element won't make any sense to them.

So far I'm calling the story.sqs (which contains each plot thread for each player) directly from my triggers but if this needs a seperate script I'll call the story.sqs from that and and call the new script from the trigger.
I'm just struggling to work out how I'd structure a script to do it.
Title: Re:Trigger to activate the first time each player enters?
Post by: AK-Chester on 28 Jan 2005, 18:48:03
Activation: Anybody (present, once)
Condition: this && player in thislist
Title: Re:Trigger to activate the first time each player enters?
Post by: Terox on 28 Jan 2005, 20:14:12
Name the units
W1
W2
W3

Init.sqs
tx_Runonce = false


Trigger
Activation: Anybody (repeating)
Condition: (vehicle player in thislist)
on Activation: (vehicle player in thislist) exec "myscript.sqs"

Myscript.sqs
? !(local Player): exit
? (tx_Runonce): exit
?(Player == W1):tx_Runonce = true
?(Player == W2):tx_Runonce = true
?(Player == W3):tx_Runonce = true
........ then state whatever lines you want in the script



this will make sure each one of the 3 players will only run the script in its entirity once and only when they activate the trigger
Title: Re:Trigger to activate the first time each player enters?
Post by: Fragorl on 29 Jan 2005, 08:47:06
Do you only want the trigger to run once all three are there? If so try
condition: "_x == player" count (thislist) == 3
maybe that'll work

Also, the statement "player in thislist" returns a bool so saying
player in thislist exec "myscript.sqs"
is like saying
(true/false) exec "myscript" - perhaps that was a typo?