Jump to content
Sign in to follow this  
acoustic

Simple Mobile Respawn?

Recommended Posts

I am making my first TvT mission for my clan. Currently I have a west respawn and an east respawn. I would like for the west to have a vehicle that is able to be moved around so that they can spawn there. It would need to have the option to go back to the main FOB for resupply and such. I have checked around the forums and couldn't find a thread that really answered my problem.

Also, this mission is an AI mission as well. For example there are 4 squads with human leaders and the rest are AI. Will the AI automatically respawn or will they have to wait on the player to respawn first?

Share this post


Link to post
Share on other sites

The AI won't respawn unless you write a script to make them respawn.

Share this post


Link to post
Share on other sites

AI will respawn same way as players do if they are in playableUnits, the options in description.ext defines how and why.

you can "fake" a respawn at the vehicle by placing the normal west_respawn marker somewhere out of the way, then have a repeated trigger covering the marker say 100 big.

have anyone present and condition to be:

this AND (getDammage respawnVehicleName) < 1

in on act:

{_x attachTo [respawnVehicleName,[0,-2,0]]; detach _x} foreach thisList;

you can replace with moveInCargo, etc various comands.

also maybe you should use a fade to black screen to make it "hide" the moving from marker to vehicle.

edit: if not AI in playableUnits use createUnit array or BIS_fnc_spawnGroup to "fake" respawn for AI.

Edited by Demonized

Share this post


Link to post
Share on other sites
AI will respawn same way as players do if they are in playableUnits

You know... I did not know this!! :) My bad!

Share this post


Link to post
Share on other sites

You can add two actions, one at the mobile respawn so you can go back to the base and one at the spawn to go to the mobile respawn.

Just an example...

go_to_the_base.sqf

if (side player == WEST && Alive mobile_respawn) then
{
     player setpos getmarkerpos respawn_west;
} else
{
     hint "You can't go to the base";
};

Mobile.sqf

if (side player == WEST && Alive mobile_respawn) then
{
     player setpos getpos mobile_respawn;
} else
{
     hint "You can't go to the mobile respawn";
};

Share this post


Link to post
Share on other sites

Got the mobile respawn working. My problem now though is when the vehicles respawns it doesn't hold the same name so the teleport and marker wont work. I used a couple of different vehicle respawn parameters to get it to change but the best I could do was get it to work once it respawned but only once. After it respawned ANOTHER time, it didn't work.

Share this post


Link to post
Share on other sites

you need to setVehicleVarName on the respawned vehicle so it will work correctly after respawn.

there is posted example code in link to make it work properly in SP and MP.

Share this post


Link to post
Share on other sites

I have tried both of those options but it only works for 1 respawn. When it respawns again it wont let me teleport.

Share this post


Link to post
Share on other sites

So basically you just want a mobile teleport vehicle? Are you just using default BIS respawn to base rules and a flagpole teleport kind of thing? Or are you using something like Norrin's revive which includes a mobile respawn vehicle option of it's own?

Share this post


Link to post
Share on other sites

Flagpole. The sript simply sees if said vehicle is alive, and if so it teleports u to it. If the vehicle isn't (or it can't find the vehicle) then you can't teleport to it.

Share this post


Link to post
Share on other sites

Hmmm... yeah. It's being stupid all right. The truck is being named correctly, my condition of "alive mrv" is correctly working but when you try to teleport to it it's saying null-object instead of the clearly there and properly named 'mrv'. Probably need to do something tricky like reapplying the addaction on the flagpole after respawn...

Share this post


Link to post
Share on other sites

pasting this in init of the mhq named mhq:

_null = this spawn {
_vehicle = _this;
_name = vehicleVarName _vehicle;
_type = typeOf _vehicle;
_pos = getPos _vehicle;
_dir = getDir _vehicle;

while {true} do {
	hint "waiting";
	waitUntil {sleep 5; (getDammage _vehicle) >= 1};
	sleep 5;
	deleteVehicle _vehicle;
	waitUntil {isNull _vehicle};
	_vehicle = createVehicle [_type, _pos, [], 0, "NONE"];
	_vehicle SetVehicleVarName _name;
	_vehicle Call Compile Format ["%1=_This ; PublicVariable ""%1""",_name];
	_vehicle setPos _pos;
	_vehicle setDir _dir;
};
hint "end";
};

using this on flagpole or any other object:

_id = this addAction ["teleport", "teleport.sqf", "", 0, false, true, "", "!isNull mhq AND (getDammage mhq) < 1"];

teleport.sqf:

player moveInCargo mhq;

can ofc be setPos or whatever, i just used moveInCargo name to verify, did destroy mhq vehicle 5 times, working fine.

Share this post


Link to post
Share on other sites

Thanks Demon, you shall be blessed by the BI Gods. :P

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  

×