Home   Help Search Login Register  

Author Topic: Mine laying  (Read 462 times)

0 Members and 1 Guest are viewing this topic.

Offline Tyger

  • Former Staff
  • ****
  • I was at OFPEC when it still had dirt floors...
    • OFPEC
Mine laying
« 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
"People sleep soundly at night only because rough men stand ready to do violence on their behalf." - George Orwell

MSG Mike Everret - We Will Never Forget - '75-'08

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Mine laying
« Reply #1 on: 05 Jul 2004, 16:18:38 »
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
Quote
?(Player == W1): Mineaction = Player addaction ["Lay mine","Placemine.sqs"]
tx_Minecount = 10
tx_Minesplaced = false
?(local server):[] exec "Loopingscript.sqs"

Placemine.sqs
Quote
_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
Quote
#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
« Last Edit: 05 Jul 2004, 16:19:53 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline Tyger

  • Former Staff
  • ****
  • I was at OFPEC when it still had dirt floors...
    • OFPEC
Re:Mine laying
« Reply #2 on: 06 Jul 2004, 15:42:42 »
Thanx 4 the help, terox :)
"People sleep soundly at night only because rough men stand ready to do violence on their behalf." - George Orwell

MSG Mike Everret - We Will Never Forget - '75-'08