Jump to content
Sign in to follow this  
HuBBa

Fun little mine script i wrote..

Recommended Posts

Someone was asking about how to make a "clickmine" script. Ie. when you step on the mine, it sounds click and if you move anything it blows up. Here is a script that does just that:

; Anti Personel mine with a "click" =)

; Coder: [FILO] HuBBa

;

; Usage: add a trigger which is activated by anyone and name it something like "Trigger".

; In the activation field, call [Trigger] exec "clickmine.sqs";

; Now.. if the soldier moves an inch after the klick sound, he's toast.

; Get the people inside the trigger

_people = thislist select 0

_grunts = units _people

; Lets always use the first sod to activate the trigger.

_grunt = _grunts select 0

; Find out the starting position.

_mx=getpos _grunt select 0

_my=getpos _grunt select 1

_mz=getpos _grunt select 2

; Play the click

playSound "MineTrigger"

~0.5

; Main loop

#Loop

; lets find out the current position

_nx=getpos _grunt select 0

_ny=getpos _grunt select 1

; if it has changed, badaboom

? (_mx-_nx) != 0 : goto "boom"

~0.1

? (_my-_ny) != 0 : goto "boom"

~0.5

; if not, lets continue checking.

Goto "Loop"

#Boom

; kill kill kill

explosion = "Grenade" camCreate [_mx,_my,_mz]

exit

Make sure you have a sound availible for the actual klick sound. For how to do that, there are good info on several tutorials out there. Now.. things to do.. a way for another soldier to disarm it =)

Enjoy,

[FILO] HuBBa

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×