Jump to content
Sign in to follow this  
abshire

Bribe a Gate Guard script

Recommended Posts

This script is oddly specific, and it was my first script. I am releasing it in the hopes that others will use it, edit it, and enjoy it. Its a simple script that allows you to use evMoney as a means to bribe a guard, for a mission I made that is based on real life experiences in West Africa. (The bribing police was real, the rest of the mission was based on Operations 10 years before I was in Sierra Leone and Libera...lol)

Works fine in Multiplayer.

In the Init for the Guard (whomever you interact with) simply put AddAction ["Why did they get shot?", "question.sqf"];

https://www.dropbox.com/s/weg6nkfpo71zcto/BribeScriptAbshire.zip <---Download the Scripts

<----Demo Video

I wanted to add that if you try to go around the gate, or ram the gate that the police will open fire on your vehicle and destroy the tires...or just open fire on the players. I could not figure that out for myself, so if anyone has any tips on what direction I need to go in order to get the AI to do that, I would really appreciate that.

I know this is REALLY simple, but I am happy with it and hope you all are as well.

Edited by Abshire

Share this post


Link to post
Share on other sites

Haven't looked at the script but for the getting the AI to open fire if you drive around the gate you could do the following:

1. Name the Police group something

2. Place triggers either side of the gate - if BLUEFOR present trigger (or opfor or whatever your units are)

3. In the activation field use the name of the police group and doTarget and doFire

alternatively if you are bluefor and the Police are resistance (green) then put in the activation field of the trigger: WEST setFriend [RESISTANCE, 0]; RESISTANCE setFriend [WEST, 0];

Share this post


Link to post
Share on other sites

Thanks a bunch, so the doTarget and doFire won't make the cops shoot each other?

Share this post


Link to post
Share on other sites

No the cops won't shoot eachother unless you tell them to, or one runs infront of the other etc.

What you are looking to do with the doTarget and doFire commands is something like this:

Cop1 DoWatch Car1;
Cop2 DoWatch Car1;
sleep 0.1;
Cop1 DoTarget Car1;
Cop2 DoTarget Car1;
sleep 0.1;
Cop1 DoFire Car1;
Cop2 DoFire Car1;

Regards Hawk.

Share this post


Link to post
Share on other sites

Just watched the video and had a look at the script - cool concept. Quick suggestion - put the addAction on the cop rather than the player. In the video when you run back to the car you still have the option "for will this work" which looks a bit weird.

Share this post


Link to post
Share on other sites

Hawk: Okay I know how to use those, its how I got the cops to shoot the civies at the gate. Thanks, I am not sure why I did not think of that...lol.

Actually the addaction is on the cop, but that deletes the action 'question' after it calls the 'bribe.sqs'. I tried to remove it after that, but it did not seem to work. Any suggestions on that? Have a look at the actual script. I still want to learn more...a lot more.

Share this post


Link to post
Share on other sites
Actually the addaction is on the cop, but that deletes the action 'question' after it calls the 'bribe.sqs'. I tried to remove it after that, but it did not seem to work. Any suggestions on that? Have a look at the actual script. I still want to learn more...a lot more.

on an addaction:

select 0 = the person the action is being done on

select 1 = the person doing the action

select 2 = the ID of the action

so using _activator = _this select 1 you are saying the activator will be the player. So on the last line when you go _activator addAction [...] you are actually putting the action on you.

I would have written it like this

question.sqf

_activator = _this select 0;  //this makes the cop _activator
cop removeAction question;  //see the end of my post regarding this

hint "None of your fucking Business white boy...";
sleep 5;
hint "Do you have something for me?";
bribe = _activator addAction ["Will this work?", "bribe.sqf"];  //question is now the ID of the addAction. Is a global variable so that we can use it in bribe.sqf

bribe.sqf

_activator = _this select 0;  //it is to select the cop

//player refers to the playable unit
if (player hasWeapon "EvMoney") then    
{
   _activator RemoveAction bribe;   //removes the bribe option as "bribe" is the ID of the bribe
hint "Thank you, you may pass.";
BG_1 animate ["bargate",0]; 
player RemoveWeapon "EvMoney";
sleep 45;
BG_1 animate ["bargate",1];	
}
else
{
   hint "You cannot pass unless you give me something. Give me money...white boy.";	 
};

Also to initiate question.sqf I assume you have something like this in the init field of the cop:

this addAction ["Question", "question.sqf"];

Change that to:

question = this addAction ["Question", "question.sqf"];

This makes the ID of the addAction "question" and you then use it in question.sqf to remove the ability to ask the question as I've done above.

Edited by Valfunction

Share this post


Link to post
Share on other sites

THANKS! I will do just that. This was the main reason I wanted to share this, so I can improve. So far I am very pleased with the BI Community....I half expected someone to come in here and just say 'you suck and your code sucks!'. Thanks a lot.

Share this post


Link to post
Share on other sites

It could be further improved by using _this select 2 in conjunction with _this select 0 to remove the action, making naming these (question = XXX) unnecessary.

So for example:

_unit = _this select 0; // the cop
_caller = _this select 1; // the player
_ID = _this select 2; // The ID of the addAction

_unit removeAction _ID;

/*
rest of the code
*/

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  

×