Jump to content
Sign in to follow this  
DrBobcat

A Car Bomb Script (MP)

Recommended Posts

I am having a serious problem getting this script to work in multiplayer. What is supposed to happen is that someone "purchases" a vehicle and then a script is executed on the vehicle that loops, constantly looking for someone who is carrying a car bomb to enter the driver seat. Then, it will add an action to the vehicle (because you cannot add actions to a unit inside of a vehicle) which allows you to rig the bomb to the vehicle. After that, once the engine is turned on, the vehicle explodes.

What isn't working is the detection script. I think this is because the action for buying the vehicle is local to the person who activates that action. All consecutive scripts associated with the detection script become local to that person from then on. This prevents from anyone rigging a car bomb in that person's car aside from that person himself. This completely is against the point of the script.

Now how do I make the detection script global to everyone? I tried using triggers to create the vehicle and execute this script but that just did not work. Still was local to the person who purchased the vehicle. Help me please!

The detection script

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_unit = _this select 0

#LOOP

? !(alive _unit) : Exit

_unit removeAction _actionId

? (driver _unit == p1) && (p1HasCarBomb) && (speed _unit < 1) && !(isEngineOn _unit) : _actionId = _unit addAction  ["SPECIAL - RIG CAR BOMB","scripts\misc\CarBomb.sqs"]

? (driver _unit == p2) && (p2HasCarBomb) && (speed _unit < 1) && !(isEngineOn _unit) : _actionId = _unit addAction  ["SPECIAL - RIG CAR BOMB","scripts\misc\CarBomb.sqs"]

? (driver _unit == p3) && (p3HasCarBomb) && (speed _unit < 1) && !(isEngineOn _unit) : _actionId = _unit addAction  ["SPECIAL - RIG CAR BOMB","scripts\misc\CarBomb.sqs"]

? (driver _unit == p4) && (p4HasCarBomb) && (speed _unit < 1) && !(isEngineOn _unit) : _actionId = _unit addAction  ["SPECIAL - RIG CAR BOMB","scripts\misc\CarBomb.sqs"]

? (driver _unit == p5) && (p5HasCarBomb) && (speed _unit < 1) && !(isEngineOn _unit) : _actionId = _unit addAction  ["SPECIAL - RIG CAR BOMB","scripts\misc\CarBomb.sqs"]

? (driver _unit == p6) && (p6HasCarBomb) && (speed _unit < 1) && !(isEngineOn _unit) : _actionId = _unit addAction  ["SPECIAL - RIG CAR BOMB","scripts\misc\CarBomb.sqs"]

? (driver _unit == p7) && (p7HasCarBomb) && (speed _unit < 1) && !(isEngineOn _unit) : _actionId = _unit addAction  ["SPECIAL - RIG CAR BOMB","scripts\misc\CarBomb.sqs"]

? (driver _unit == p8) && (p9HasCarBomb) && (speed _unit < 1) && !(isEngineOn _unit) : _actionId = _unit addAction  ["SPECIAL - RIG CAR BOMB","scripts\misc\CarBomb.sqs"]

? (driver _unit == p9) && (p9HasCarBomb) && (speed _unit < 1) && !(isEngineOn _unit) : _actionId = _unit addAction  ["SPECIAL - RIG CAR BOMB","scripts\misc\CarBomb.sqs"]

? (driver _unit == p10) && (p10HasCarBomb) && (speed _unit < 1) && !(isEngineOn _unit) : _actionId = _unit addAction  ["SPECIAL - RIG CAR BOMB","scripts\misc\CarBomb.sqs"]

~0.5

goto "LOOP"

EDIT: Some additional information. The purchasing script is attached to a flag pole via an action. You hit the action which creates the vehicle and then executes this script. I already know scripts executed by actions are local to the player who activates them, but I used triggers to try to "globalize" the detection script and again, it still didn't work.

- dRb

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  

×