Jump to content
Sign in to follow this  
614hardcore

Arrest/Rescue scipting.

Recommended Posts

Heyy guys.

For my mission, I need to "rescue" 4 civilians.

My rescue.sqf is

[tak] join player; tak enableAI "Move";

[tak1] join player; tak1 enableAI "Move";

[tak2] join player; tak2 enableAI "Move";

[tak3] join player; tak3 enableAI "Move";

Each unit is named accordingly and the scipt works just fine.

However, I'm trying to make each unit separately rescued. When use the action menu to rescue one, they all join my group.

Should each unit have a separate .sqf?

Thanks in advance :)

EDIT: CRAPPP. Wrong section... If one of the moderators could move this to the correct one, that would be lovely :)

Thank you.

EDITx2: I've got everything all sorted out. But does anyone know what the script and the addaction command thing to make them leave me group?

Edited by 614hardcore

Share this post


Link to post
Share on other sites

I do this for rescue/arrest a unit.

1) Create the player unit (with high degree) and call it pl1

2) create a civillians (hostage) called civ1;civ2 ecc...

3) create a trigger axis a-b 0-0. Act:None

Cond: pl1 distance civ1 < 3

On activ. _genAct= pl1 addaction [ "Arrest(or rescue)","script1.sqs" ]

On script write

E1 setdamage 1.0;

sleep 5; // <- 5sec delay

playmusic "a2";

[civ1,civ2,] join group pl1r;

_gen = _this select 0

_caller = _this select 1

_id = _this select 2

; remove the action once it is activated

_gen removeAction _id

Share this post


Link to post
Share on other sites

AWESOME.

Much thanks :)

I have a question for the remove action thing.

Where do you put the "_gen removeAction _id"?

In a trigger?

----------------------------------------

I've been testing this and it's not working. They won't join my group when i hit rescue. Also, there is always a rescue option in my Action Menu no matter how close i am to the hostages.

Suggestions?

Edited by 614hardcore

Share this post


Link to post
Share on other sites

just adding a reply so I can subscribe to this thread I know it will be useful for me.

Share this post


Link to post
Share on other sites
AWESOME.

Much thanks :)

I have a question for the remove action thing.

Where do you put the "_gen removeAction _id"?

In a trigger?

No. It should be part of the script.

I've been testing this and it's not working. They won't join my group when i hit rescue. Also, there is always a rescue option in my Action Menu no matter how close i am to the hostages.

Suggestions?

You should not add the action to the player... add it to your Civ's [tak] units. So the action will only be available to the player, if he is close to them.

For detail Info see: http://community.bistudio.com/wiki/addAction

So you maybe better do something like this:

Add the following to the init line to each Unit you want be able to rescue:

this addaction["Rescue","Rescue.sqf",[],false,false,true,"","_this == player";

This make the action only visible to the player unit.

And in your Rescue.sqf type the following:

private ["_target","_caller","_actionID"];
_target = _this select 0;
_caller = _this select 1;
_actionID = this select 2;
[_target] join _caller;
_target enableAI "Move";
// delte action entry
_target removeAction _actionID;

Couldn't test the code but it should work.

  • Like 1

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  

×