OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Tyger on 05 Jul 2004, 02:53:23
-
I'm making a mission where the player is a Sergeant, and he is SIC when NATO invades one of the islands in the Malden chain. After 1-2 missions he is sent to SpecFor camp, and becomes Ranger of Black Op. Then his first mission is to lay some mines on a road.
My problem is to check and see weath the mines have been placed by the soldier. I tried Event Handlers, but I don't know wheather or not they work for V 1.46 (Yeah, I know i'm behind the times... :P).
Anyone got a solution?
Thanx Tyger
-
create an addaction script for the player in question which creates a mine at the position of the player every time he selects the action
The script would reduce the count of a global variable everytime the player uses the addaction
and then when the mine count = 0, a publicvariable will be issued which you could then have a script waiting on and do whatever it is you need to do after all the mines are placed
The below system also removes the action from the unit when all his mines are used up
Add the following to the init.sqs, where the player unit name is W1
INIT.sqs
?(Player == W1): Mineaction = Player addaction ["Lay mine","Placemine.sqs"]
tx_Minecount = 10
tx_Minesplaced = false
?(local server):[] exec "Loopingscript.sqs"
Placemine.sqs
_minepos = getpos player
_mine = "mine" createvehicle _minepos
tx_Minecount =tx_Minecount -1
?(tx_minecount <= 0): tx_Minesplaced = true; publicvariable "tx_Minesplaced"
?( tx_Minesplaced): Player removeaction "Mineaction"
exit
You will then need your own looping script or place the following query in an existing looping script
Looping Script line
?(tx_Minesplaced): [] exec "whateveryouwant.sqs"
eg
LoopinScript.sqs
#START
~1
?(tx_Minesplaced):goto "SKIP"
goto "START"
#SKIP
Add whatever lines you need to run when the mines have been placed
exit
PS not quite sure what the classname for a mine is or whether you can createvehicle it
-
Thanx 4 the help, terox :)