Jump to content
Sign in to follow this  
Megahurt50

Hostage in random building?

Recommended Posts

I would like to make a hostage rescue mission more interesting by having the hostage held in one of 5 or six buildings instead of having the hostage in the same place all the time.

As it stands now ive created a unit that has "addaction join group" in the init with the apropriate sqs file.

When any player approached the hostage a new action "Join Group" appears and he joins the players squad when the option is selected. It all works fine.

Id like to have this same unit appear (with the addaction) in a different building and specified position whenever you play the mission so you can search for him rather than go to the same place everytime.

Any ideas?

Thanks.

Share this post


Link to post
Share on other sites

Make a temporary radio trigger:

Activation: Radio Alpha, Repeatedly

OnAct: if (isnil "p") then {p = []}; p set [count p,getposasl player]; copyToClipboard str p

Hit preview and go run around, visit each possible hostage position and on them use the trigger. After you've done that, go into Notepad, or whatever text editor and hit paste. You should get a line with alog of numbers, something like this:

[[3460.97,3589.02,19.0014],[3449.96,3595.83,19.0014],[3445.34,3612.19,19.0014]]

Put this into the hostage's init field. Just don't forget to replace the example array of numbers with your own:

if isserver then {
 private ["_pos","_arr"];
 _arr = [[3460.97,3589.02,19.0014],[3449.96,3595.83,19.0014],[3445.34,3612.19,19.0014]];
 _pos = _arr select floor random count _arr;
 this setposasl _pos;
};

Share this post


Link to post
Share on other sites

interesting solution there shk, I think i might have to play around with the clipboard as well, more control in where you want a unit to be positioned.

Share this post


Link to post
Share on other sites

Give the hostage a placement radius that encompasses all the possible buildings. If this is unacceptable, there is another solution that uses gamelogics placed on the possible buildings.

Then, run a script like this:

_towndest = nearestbuilding vip;

_pos = 0;
while { format ["%1", _towndest buildingPos _pos] != "[0,0,0]" } do {_pos = _pos + 1};
_pos = _pos - 1; 
vip setpos (_towndest buildingpos (round (random _pos)));

Where vip is the name of the hostage. Will place the hostage in a random position inside its nearest building.

Share this post


Link to post
Share on other sites

Problem with using default building positions is that often the unit will be placed on a roof of a building, which is and looks silly.

Share this post


Link to post
Share on other sites

I used the example Shk made and it worked like a charm.

I made the hostage join the rescuer's group with an add action button when the rescuer finds him. He has no weapons and will stay put.

Heres what i put in the hostage's init.

removeallweapons this; this allowfleeing 0; Join = this addaction ["Join Group","Join.sqs"]; if isserver then { private ["_pos","_arr"]; _arr = [[8931.14,5229.42,275.785],[8931.14,5229.42,275.785],[8956.14, 5244,275.572],[8931.14,5229.42,275.785],[8956.14,5244,275.572] ,[8955.84,5243.42,278.431],[8931.14,5229.42,275.785],[8956.14,5244,275.572],[8955.84,5243.42,278.431],[8953.48,5261.04,266.539],[8953.48,5261.04,266.539]]; _pos = _arr select floor random count _arr; this setposasl _pos; };

***The Join.sqs needed for joining the group is to be included in the mission folder is as follows

private ["_obj","_caller","_id"];

_npc = _this select 0;

_caller = _this select 1;

_id = _this select 2;

_npc removeAction _id;

[_npc] joinSilent _caller;

The paremeters in the hostage init put him in random buildings in Tarmaclay on the Takistan Map.

Enjoy.

Thanks for everyones help here. So great to get a quick response to a daunting problem.

?6i5ngkf64oquygi

If youd like to try the mission, its a Blackwater team finding one of their own in Afghanistan, Download it here

http:////www.mediafire.com/?e51kx5n7yiyq576

Edited by Megahurt50

Share this post


Link to post
Share on other sites

careful naming some handles, join is already a command, and naming it as a handle will only cause problems.

best to name it with handle at the end so you know what it is (incase you want to terminate it or use it as a condition afterwards)

joinhandle = this addaction ["etc",.......

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  

×