Jump to content
Sign in to follow this  
SD_BOB

Tripwire Script

Recommended Posts

Hi guys, i'm looking for a bit of help. First of all, i'm totally inept at any kind of scripting. Although im familiar with the editor even basic scripting is beyond me. I've searched these forums and OFPEC for a solution to this, but have not come across anything that would do the job. Basically i'm looking for a way to create a simple tripwire for my missions. I have, in the past just used triggers and createVehicle for this purpose, but this isnt ideal for use in MP.

Ok here's the idea...

A trigger placed where the tripwire would be, this then calls the script. Ideally i would like the script to throw a hint to the player about tripping the wire so lets say "Tripwire! Grenade!". Then a random wait of 3/7 secs for the grenade fuse, thus giving the person who tripped it a fighting chance of getting clear.

I put this together, it by no means works. But you guys might ge the idea of what i am trying to go for.

_triploc = _this select 0;

hint "Tripwire! Grenade!";

sleep random 7;

createVehicle "GrenadeHand" position _triploc;

This would be called by: trip= [trip1] execVM "tripwire.sqf";

trip1 would be a gamelogic or whatever object you would use to mark the position.

I would like this to work in a dedicated enviroment and to only throw the hhint up to the player who has tripped the wire.

Again in an ideal world, you would have the option to "cut" the tripwire if you moved close enough without setting it off. But that isnt really important for now.

Thankyou in advance for any help you can provide with this...

Share this post


Link to post
Share on other sites

What you have there seems like it would work... have you tried it in a test mission?

Share this post


Link to post
Share on other sites

for thegrenade to be placed on the map it would be bomb = "Grenadehand" createVehicle position _triploc;

for it to explode bomb = "Grenade" createVehicle position _triploc;

that should do it.

Edited by F2k Sel

Share this post


Link to post
Share on other sites

Hmmm nope cant get the grenade to spawn and explode. The hint fires fine, but then nothing.

I've tried your way F2k, but still not working...

If i do a normal trigger, with the activation:

bomb="Grenade" createVehicle position trip1;

It works fine that way, but cant get the script to spawn the grenade.

Thx for the replies.

Edited by Shadow.D. ^BOB^

Share this post


Link to post
Share on other sites

Try colliding the grenade with a "bomb" object:

_bomb = "Bomb" createVehicleLocal position _triploc;
_grenade = "Grenade" createVehicleLocal position _triploc;

You might need to setPos it to make sure they collide.

Share this post


Link to post
Share on other sites

There's no need to setpos or collide the grenade.

_triploc = _this select 0;

hint "Tripwire! Grenade!";

// visual grenade 
bomb = "Grenadehand" createVehicle position _triploc;

sleep random 7;

// explosion
bomb = "Grenade" createVehicle  position _triploc;

nothing else needed.

Share this post


Link to post
Share on other sites

Thankyou F2k, i could have swore i tried that. But anyway it works now, for your ref the final script just needed the one createvehicle so:-

_triploc = _this select 0;

hint "Tripwire! Grenade!";

sleep random 7;

// explosion
bomb = "Grenade" createVehicle  position _triploc;

Using the GrenadeHand also created an explosion.

Just another quick question, would anything need to be added to the above for use on a dedicated server??

Edited by Shadow.D. ^BOB^

Share this post


Link to post
Share on other sites

I used two to show the difference between the "grenade" and "grenadehand" ammo types. the first only places a grenade on the ground but doesn't explode and it vanishes after about 10 seconds , it's hard to see unless your on a road. The second was the explosion.

Any way glad you got it sorted.

Share this post


Link to post
Share on other sites

Sorry i should have phrased it a bit differently, it appears that both Grenade & GrenadeHand ammo types create an explosion.

Thankyou again and also to everyone who has chipped in, i know its not much, but its the first .sqf i've put together. So i'm smiling :D:D:D

Share this post


Link to post
Share on other sites

My scripting abilities are very limited so far! (Starting and still learning a lot!!!)

Is it possible to trigger 4 grenades (different location) at the same time with one trigger. In clear, i would want that when Opfor trip on one trigger(tripwire) that would release 4 grenades at the same time. Is it possible with one trigger? i'm using the script in reference in this post, what would be written in the activation of this trigger to activate grenade#90 to #94. (yes i have 90 different trip wires on my map, that should be enough after this!)

on activation : trip= [trip90] execVM "tripwire.sqf";

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  

×