Jump to content
Sign in to follow this  
Ringosis

Two basic questions

Recommended Posts

A couple of questions that I can't find the answer to. Can anyone help me?

How do I clear the default contents from a vehicle, ie the med kits and ammo that Hunters spawn with.

Secondly, I am using the respawn script from Escape from Stratis and I want to have a custom loadout for the playable units. Now I can get them to spawn with what I want (removeAllWeapons this; etc) but when they die and respawn they come back with their default loadout. Any way to make them use their original init?

Share this post


Link to post
Share on other sites

1 :

clearWeaponCargo this;
clearMagazineCargo this;
clearItemCargo this;

Add "global" after "Cargo" if you're spawning the hunter server side.

2: Put the equip stuff into a .sqf instead. Then just run that file when player respawns.

player addEventHandler ["Respawn",{0 = _this execVM "loadout.sqf"}];

Share this post


Link to post
Share on other sites

Sorry cuel, you kinda lost me. I'm not great at this kinda thing.

The respawn sqf from Escape from Stratis looks lie this


if (isServer) then {
[] spawn {
	while {TRUE} do {
		"respawn_west" setMarkerPos position leader BIS_grpMain;
		sleep 30
	}
}
};

waitUntil {!isNull player && isPlayer player};

BIS_grpMain = group player;

[player, "objEscape", [format ["Escape from Stratis by any means possible.%1%1Your best chances are the airfield and Kamino firing range.", "<br/>"], "Escape from the island", ""], objNull, TRUE] call BIS_fnc_taskCreate;

_null = player createDiaryRecord ["Diary", ["Briefing", format ["Attack observation posts to arm yourself properly.%1%1Try to stay together.%1%1Steal as many vehicles as you can.%1%1If your whole team is dead, the mission ends.%1%1It takes 2 minutes to respawn.", "<br/>"]]];

sleep 1;

if (time > 30) then {player setPos markerPos "respawn_west"};

[] spawn {
sleep 5;
waitUntil {{vehicle _x in list BIS_island || (!(vehicle _x isKindOf "Ship") && !(vehicle _x isKindOf "Air"))} count units BIS_grpMain == 0};
["objEscape", "Succeeded"] call BIS_fnc_taskSetState;
endMission "End1"
};

[] spawn {
sleep 5;
waitUntil {{alive _x} count units BIS_grpMain == 0};
["objEscape", "Failed"] call BIS_fnc_taskSetState;
endMission "End2"
};

All I want is for all the players who respawn to be stripped of all their items and then given this


init="removeBackpack this; removeAllWeapons this; this addMagazine ""30Rnd_65x39_caseless_mag_Tracer""; this addMagazine ""30Rnd_65x39_caseless_mag_Tracer""; this addMagazine ""30Rnd_65x39_caseless_mag_Tracer""; this addMagazine ""30Rnd_65x39_caseless_mag_Tracer""; this addWeapon ""arifle_MX_F"";

Share this post


Link to post
Share on other sites

That doesn't look like a respawn script.

Try this

player addEventHandler ["Respawn",{
removeBackpack player;
removeAllWeapons player;
player addMagazine "30Rnd_65x39_caseless_mag_Tracer";
player addMagazine "30Rnd_65x39_caseless_mag_Tracer";
player addMagazine "30Rnd_65x39_caseless_mag_Tracer";
player addMagazine "30Rnd_65x39_caseless_mag_Tracer";
player addWeapon "arifle_MX_F";
}];

Share this post


Link to post
Share on other sites
That doesn't look like a respawn script.

Try this

player addEventHandler ["Respawn",{
removeBackpack player;
removeAllWeapons player;
player addMagazine "30Rnd_65x39_caseless_mag_Tracer";
player addMagazine "30Rnd_65x39_caseless_mag_Tracer";
player addMagazine "30Rnd_65x39_caseless_mag_Tracer";
player addMagazine "30Rnd_65x39_caseless_mag_Tracer";
player addWeapon "arifle_MX_F";
}];

I put that at the top of the init and it works the first time someone dies, but then the next time they get killed they respawn with all their gear again...what am I missing?

---------- Post added at 01:02 PM ---------- Previous post was at 12:40 PM ----------

I put that at the top of the init and it works the first time someone dies, but then the next time they get killed they respawn with all their gear again...what am I missing?

Actually scratch that, it seems to work kinda sporadically. I guess it's sometimes not running for people if they lag? Should I do something to make it wait until they are fully spawned?

Share this post


Link to post
Share on other sites

You'd put that in init.sqf, not in a init line for a unit.

If it still doesn't work, try this.

if (!isDedicated) then {
waitUntil {!isNull player};
player addEventHandler ["Respawn",{
	true spawn {
		waitUntil {alive player};
		if (backpack player != "") then {removeBackpack player};
		removeAllWeapons player;
		player addMagazine "30Rnd_65x39_caseless_mag_Tracer";
		player addMagazine "30Rnd_65x39_caseless_mag_Tracer";
		player addMagazine "30Rnd_65x39_caseless_mag_Tracer";
		player addMagazine "30Rnd_65x39_caseless_mag_Tracer";
		player addWeapon "arifle_MX_F";
	};
}];
};

Share this post


Link to post
Share on other sites
You'd put that in init.sqf, not in a init line for a unit.

If it still doesn't work, try this.

if (!isDedicated) then {
waitUntil {!isNull player};
player addEventHandler ["Respawn",{
	true spawn {
		waitUntil {alive player};
		if (backpack player != "") then {removeBackpack player};
		removeAllWeapons player;
		player addMagazine "30Rnd_65x39_caseless_mag_Tracer";
		player addMagazine "30Rnd_65x39_caseless_mag_Tracer";
		player addMagazine "30Rnd_65x39_caseless_mag_Tracer";
		player addMagazine "30Rnd_65x39_caseless_mag_Tracer";
		player addWeapon "arifle_MX_F";
	};
}];
};

Tried this but it made the game crash when people respawn. Think I'm just going to try something else, this is beyond me.

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  

×