Jump to content
Sign in to follow this  
Prv_Jezz

Random Intel Suitcase Spawn

Recommended Posts

Hi you great Arma Scripters!

I wannt to realize a "smal" MP-COOP Mission. You got 15 Soldiers and 3 Helicopters and place around on chernarus Citys some Intel-Suitcases what the

Player should find and for sure some Enemy Soldiers in the citys. Works so far Great but after 2 or three times playing it sucks becouse you know in which

Citys are the Suitcases. So i think i need some randomness.

But my Script will not work. And how can i do an distance check like ((player distance intel1) < 5);

working. Many Questions i know but I would be grateful for any help. :)

intel_spawn.sqf

//
// To Call it: nul = ["markerscount"] execVM "intel_spawn.sqf";
//
if (!isServer) exitWith {};

private ["_markerscount","_markcreate","_i","_prim","_marker","_intel"];

_markerscount = _this select 0;
_prim = ["Suitcase"];

_markcreate = [];
for "_i" from 0 to _markerscount do 
{
_marker = format ["marker_%1",_i];
_markcreate = _markcreate + [_marker];
_intel = createVehicle ["Intel", getPos _marker,0, "CAN COLLIDE"];
hint format ["intel %1 added",_i];
sleep 1;
};
if (true) exitWith {};

//
//End

thanks a lot

Prv.Jess

Share this post


Link to post
Share on other sites

Why don't you do the simple way and just place ALOT of empty markers on the map and group the suitcase to these markers? You could even place small triggers over the markers to detect if the suitcase is present, and then do things with the suitcase. Like placing it onto a table, chair, floor etc.

Share this post


Link to post
Share on other sites

This is what i use to select a random town and place a downed Heli , you could modi for you needs:-

_towns = nearestLocations [getPosATL player, ["NameVillage","NameCity","NameCityCapital"], 25000];

_pos = position (_towns select (floor (random (count _towns))));
_size=20;
_wreck = "UH60_wreck_EP1" createVehicle [(_pos select 0) + 2*_size - random 4*_size,(_pos select 1) + 2*_size - random 4*_size,0];


Share this post


Link to post
Share on other sites

Thanks for the sweet replay.

Very nice Ideas but i am a newbie in Scripting. :o

So i hope i understand what you mean. What you think about that way:

I create a trigger with on Bluefor exist (in the spawn area of the units or better over the init.sqf?) in

that are and call then the Script: nul = [suitcase_count 1-15] execVM "intel_spawn.sqf"; Now i put in every City 1-5 markers

in ~10 Citys makes good 30-50 Markers so possible Spawn Positions. But how can i make then an distance check and count the

Founded suitcases? I think i need more help then a normal user. :(

Thats my idea now:

And the intel_spawn.sqf

//
// Spawn my Random Suitcases
//

private ["_SuitcaseCount","_markers","_spawnhold"];
_SuitcaseCount = _this select 0;

if isserver then  
{

        _markers = ["mkr1","mkr2","mkr3","mkr4","mkr5","mkr6","mkr7","mkr8","mkr9","mkr10","mkr11","mkr12","mkr13","mkr14","mkr15"] call BIS_fnc_selectRandom;

_h = 0;
while {_h != _SuitcaseCount} do {

       _spawnhold= createVehicle ["Suitcase", getPos player, _markers,0, "CAN COLLIDE"];
       _spawnhold setVehicleInit "HERE NOW A DISTANCE CHECK FOR THE SUITCASE?";
       processInitCommands;
sleep 2;

_h = _h+1;
};

sleep random 5;
hint "Its gone...";
};

//
//End

PLEASE PLEASE HELP ME! :D

Share this post


Link to post
Share on other sites

Do you have to use scripts? If not I can show you a way to get total randomness, placing the suitcase in buildings, onto tables,chairs,floors,upstairs etc etc. All with a few markers, some triggers and some commands.

Share this post


Link to post
Share on other sites

So i use other Scripts for Repair etc. i heard with scripts it takes less Performace but if you know how to do it i would be very thanksfull. :)

Share this post


Link to post
Share on other sites

Well, it depends on the mission. How often and how many suitcases you would want to place. If it's just a simple mission where you have to spawn a suit case randomly, and you are having trouble finding the correct script solutions, then use triggers & markers until you find a more elegant solution. You can detect if the suitcase is in a trigger by grouping the suitcase to the trigger, and then do things with the suitcase if it's present. Like placing it onto furniture with the different setpos/vector commands.

about the distance check..i'm not sure exactly what your trying to do (how your mission intends to work). When I do a distance check it usually something like this:

if (_spawnhold distance leader _grp < 5) then {hint"someone is close to the suitcase} else {hint"not so close to the case"};

or

waitUntil {_spawnhold distance leader _grp < 5};

hint "close to the case";

Edited by Iceman77

Share this post


Link to post
Share on other sites

Thanks mate for your replay. So its a Mission with 3 "Parts" the First Mission is to rescue an Helicopter Pilot and bring him back to Base. The second Mission is Destoy his crashed Helicopter that

all i get working perfectly. The third Mission is the Helicopter has a lot of Intel on Board and on the Crash the Suitcases where spread over the map and the Takis steal it and wannt so sell them.

The Player should try to find them the only hint is show in City A,B,C,D,E,F,G. It should be 10 Suitcases. I don't need a hint "that your in the near of them". just if the player is <5 the Suitcase shut

invisible and a count should start 1/10...2/10... if all 10/10 found mission successed. :) Thats my plan. But i am to newbie to know how to do it randomly. The Helicopter crashes at 4 different Locations

that Works just with 4 markers and a bis_fnc_random the Pilot spawns in a Taki vehicle and the drive him to a different Location with 4 random markers. But the damed suitcases sucks my blood out. :D

Share this post


Link to post
Share on other sites

How do you make trigger activate when *any* WEST unit is <1m to the suitcase, not just the leader?

Share this post


Link to post
Share on other sites

Thats my problem i don't know how. But i think i need to do it like this: :D

{ if ((_x distance _Suitcase > 5)) then { _Suitcase + [_x]}} forEach _Suitcase;

Share this post


Link to post
Share on other sites

For the suitcase distance check, place a functions module on the map.

Trigger, activation none, repeatedly

condition:

count (nearestObjects [player,["SuitCase"],5]) > 0

on activation:

{deleteVehicle _x} forEach (nearestObjects [player,["SuitCase"],5]);
if (!isNil "TAG_suitcases") then {
 TAG_suitcases = TAG_suitcases + 1;
} else{
 TAG_suitcases = 1;
}; 
publicVariable "TAG_suitcases";
[nil,nil,rHint,format ["You've found a suitcase! \n (%1 / 10)",TAG_suitcases]] call RE;

Share this post


Link to post
Share on other sites

Cuel your awesome and I thank you very much! Thats exactly what i need. :)

One more smal Question if I may then all is perfect. I would have if you near the Suitcase to output a sound in an ~50 Meters Radius on the Suitcase that it will play a Sound to find it easyer like a "Beep...Beep...Beep". I think the Multiplayer Framework will be the better solution but i dont understand the playsound function in it. So i tried that way

but it don't loops the sound too.

I put this in my Description.ext:

class CfgSounds {
sounds[] = {ping};
class ping
{
	name = "ping";
	sound[] = {ping.ogg, db + 100, 1.0};
	titles[] = {0, ""}; }; };

I make a Trigger: AxiA & B = 0. Activation: Any, Condition: count (nearestObjects [player,["SuitCase"],50]) > 0

OnAct:

[nil,(nearestObjects,player,["SuitCase"]), rSAY, ping] call RE; 

But don't works to far. Maybee there is a problem with the vehiclename.

Share this post


Link to post
Share on other sites

Do you want it to play for the guys who are close to the suitcase or everyone?

Share this post


Link to post
Share on other sites

Just for the Guys (every Bluefor Unit) near by in a ~50Meter Radios or something would be great.

Share this post


Link to post
Share on other sites

Try this in your init.sqf

if (!isdedicated) then 
{
0 spawn 
{
	waitUntil 
	{
		while {count (nearestObjects [player,["SuitCase"],50]) > 0} do
		{
			player say "beep";
			sleep 1;
		};
		sleep 1;
		false;
	};
};
};

Change the sleep delay to match the length of the sound.

I also do not suggest using db+100, that's insane. Try db-10 or something.

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  

×