Jump to content
Sign in to follow this  
ghosttracer71

Absolute Frustration = Respawn

Recommended Posts

:confused: :mad:

Well, I'm at the frayed ends of my sanity. I've been trying to get a simple base respawn to work in a single player mission for 3 days and have yet to get it work. I've searched every possible "respawn" parameter on every Arma2 site that I can think of, and I've tried several different methods without luck.

I'm going crazy. I'm not new to this, but I've been inactive for a few years and the old addage "it's like a riding a bike" has yet to take hold.

I've read read several tutorials and yet even when following the instructions to the letter... failure, every time.

To make the description.ext file I've tried both Arma Edit 1.3.4 and making one with notepad. I've tried every combination of caps and lowercase I can think of because I know how case sensitive everything is. I've tried making the respawn-west marker every way it can be made. Am I supposed to have a script.sqs file somewhere? Gah!!!

I'm guessing the locations of my files are incorrect when I export to single player missions, it's the only thing I can think of at this point unless the description.ext I created is wrong or bad. In several of the tutorials I've seen this file path mentioned:

C:\Documents and Settings\username\My Documents\ArmA 2\MPMissions

That path does not exist in my folder structure.

C:\Documents and Settings\username\My Documents\ArmA 2\

does, but within the ArmA 2 folder there are only 2 files, ArmA2.cfg and my username.ArmA2Profile.

I'm also curious as to where the editor exports those single player missions to, because I cannot find them anywhere. I've got a ton of scenarios that I'd like to clean out since they don't work but I cannot find where to delete those files.

I spent years modding and editing OFP with good success, but I'm flat on my back right now and I feel like an idiot. I can't make a simple respawn script work? Seriously?!? Cmon!!! I hate asking for help, but I'm at my wit's end.

Share this post


Link to post
Share on other sites

Ah, americans :) Respawn will only work in Multiplayer missions, so if you wish to be the only one to play, you should run it on a LAN server (host LAN server, simply). It is possible to introduce a system similiar to respawn (with switching selectable characters) in Singleplayer, but the MP option is so much easier :)

Share this post


Link to post
Share on other sites

saved "export to single player / multiplayer mission" files are in the game install dir under missions and MPmissions folders.

the edited files, not exported are in the my documents/my A2profilename/missions or MPmissions folders, thats where you add the description.ext, etc... before exporting the mission.

Edited by Demonized

Share this post


Link to post
Share on other sites

I have editor missions in Documents\Arma 2 other profiles\Celery\missions

Missions exported to MP go to Arma 2 install directory\MPMissions

Share this post


Link to post
Share on other sites

If you set up a lan server and then work on an editor (Create mission i belive thats called), you will create a missions folder in Documents\ArmA 2 (other profiles)\MPMissions and use it just like regular SP editor.

Share this post


Link to post
Share on other sites
Respawn will only work in Multiplayer missions

:yay: Success!

Thank you! That was my problem. If even one of the tutorials I read had mentioned that single sentence I wouldn't have had a problem. I knew it was something silly like that. Finally I can sleep!

If you set up a lan server and then work on an editor (Create mission i belive thats called), you will create a missions folder in Documents\ArmA 2 (other profiles)\MPMissions and use it just like regular SP editor.

:o Ah ha! That's how that folder gets created, thank you for that tip!

Thanks to everyone who replied, you guys are great. I love this community. I really hate to ask stupid questions but I'll exhaust every possibility I can think of before I ask one. Thanks again for bearing with me!

Share this post


Link to post
Share on other sites

I test new missions I work on and sometimes die and hate having to restart the mission from scratch, so I use norrins revive script in the mission and then it allows me to respawn in singleplayer. I once found a script that gave the ability to respawn in singleplayer missions without the need of any addons, but I never used it and now I can't find it anywhere. Does anybody know where I can find it? It was a very simple and short script. If I remember correctly, I think it used "this addEventHandler ["killed", blah blah blah..." in the players init. I can't remember much other than that.

There are a couple of singleplayer respawn downloads at armaholic.com, but they required an addon to be installed. I was hoping to avoid using an addon. Norrin's revive doesn't use any addons, and I've tried to figure out how to write my own simplified respawn script by analyzing how Norrin's script works, but I kinda gave up on that.

Well, if somebody knows how to do this, it would be very helpful.

Share this post


Link to post
Share on other sites

one helpful command when testing something in SP or MP for that sake, is to use allowDammage, here below a re a few optins i use when testing different missions, sometimes need 1, sometimes all, sometimes none.

god mode:

this allowDammage false;

invicible /civilian mode: (will not activate any west, east, resistance triggers, nor any shooting will atract enemys)

this setCaptive true;

teleport on map click:

onMapSingleClick "player setPos _pos; true;"

tracking markers following a unit:

_null = this spawn {while {alive _this} do {sleep 1; "markername" setMarkerPos (getPos _this); };};

Share this post


Link to post
Share on other sites

Small correction on Demonized code.

teleport on map click:

onMapSingleClick {vehicle player setPos [_pos select 0, _pos select 1, 0]; true;}

I never use the true myself though, but forcing zero altitude ensures compatibility if operating land vehicles due to _pos select 2 being a bit - weird (never understood why it is what it is).

Share this post


Link to post
Share on other sites

When you click on the map, only god (and BIS) knows what altitude your click is considered to be, so I'm not surprised you get weird results with simple setPos.

That said, I really wish there was a direct simple scripting solution to convert positions to ASL positions.

Share this post


Link to post
Share on other sites

Yeah, I use "this allowDamage false;" all the time, but I actually want to die and respawn at base in this mission I'm trying to make. I am making it for singleplayer and multiplayer. My jet gets shot down, I die, the jet respawns and activates a script that unassigns me from vehicle, then reassigns me back to the vehicle and then I'm given the order to get back in. I want to play it single player with AI, this way we are all assigned to a vehicle. We die, respawn and get back in and keep fighting. In the multiplayer version, nobody is assigned to any vehicles. Normally, with Norrin's revive, the enemy die and respawn at the ralley point spawn location that I added, because it's the closest spawn point. I tried to shorten the spawn timer for the mission I'm working on now, but what's the point of using Norrin's revive script if I don't want to use any of the revive abilities in this 1 particular mission. Norrin somehow get's the players and AI to actually respawn, so it should be possible to create a more simplified script just for respawning in singleplayer. If I could borrow Norrin's brain for an hour, I would be writing the script right now, lol. The most I would need is to respawn with same weapons I started the mission with. Edit... Actually, we don't need any weapons, we got jets with rockets, heh.

---------- Post added at 06:35 PM ---------- Previous post was at 06:12 PM ----------

Honestly, out of all the scripts I've seen for this game, I can't believe that nobody has ever written a simple singleplayer respawn script.

I've been looking at the Norrin's "respawn.sqf" file trying to figure out how to remove all the stuff that I wouldn't need. So maybe when the player dies, it fades to black with a message saying "you will respawn at base in 10 seconds", leaves the player in somekind of captive state, then set's his position back to the "respawn_west" marker and then the black screen fades away and your back in the game.

This is Norrin's "respawn.sqf" file:

// respawn.sqf

// © JULY 2009 - norrin

_unit = _this select 0;

_respawn_position = NORRN_revive_array select 28;

_respawn_at_base_addWeapons = NORRN_revive_array select 11;

_respawn_at_base_magazines = NORRN_revive_array select 34;

_respawn_at_base_weapons = NORRN_revive_array select 35;

_respawnAtBaseWait = NORRN_revive_array select 68;

_no_respawn_points = NORRN_revive_array select 12;

_Base_1 = NORRN_revive_array select 13;

_Base_2 = NORRN_revive_array select 14;

_Base_3 = NORRN_revive_array select 15;

_Base_4 = NORRN_revive_array select 16;

_mobile_spawn = NORRN_revive_array select 51;

waitUntil{call compile format["!isNull %1",_unit]};

_name = call compile format["%1",_unit];

_unconscious_body = objNull;

_pos = [];

sleep 2;

_base_weps = [];

_base_mags = [];

if (_respawn_at_base_addWeapons == 1 && count _respawn_at_base_magazines == 0 && count _respawn_at_base_weapons == 0) then

{

_base_weps = weapons _name;

_base_mags = magazines _name;

};

hint "No revive";

while {true} do

{

waitUntil {local (call compile format["%1",_unit])};

_name = call compile format["%1",_unit];

waitUntil {!alive _name || !local _name};

if (local _name) then

{

if (_name == player) then {titletext["","BLACK FADED", 5]};

_pos = getPos _name;

_weps = weapons _name;

_mags = magazines _name;

waitUntil{alive call compile format["%1",_unit]};

_name = call compile format["%1",_unit];

// Give player weapon and mag loadout they had prior to dying

removeAllWeapons _name;

{_name removeMagazine _x} forEach magazines _name;

removeAllItems _name;

{_name addMagazine _x} forEach _mags;

{_name addWeapon _x} forEach _weps;

_name selectWeapon (primaryWeapon _name);

if (_respawn_position == 2 && isplayer _name || _respawn_position == 3 && isplayer _name) then

{

if (_mobile_spawn == 1) then

{

if (NORRN_camo_net) then

{

_no_respawn_points = NORRN_revive_array select 12;

_Base_1 = NORRN_revive_array select 13;

_Base_2 = NORRN_revive_array select 14;

_Base_3 = NORRN_revive_array select 15;

_Base_4 = NORRN_revive_array select 16;

}else{

_no_respawn_points = NORRN_revive_array select 12;

_no_respawn_points = _no_respawn_points - 1;

_Base_1 = NORRN_revive_array select 14;

_Base_2 = NORRN_revive_array select 15;

_Base_3 = NORRN_revive_array select 16;

};

};

closedialog 0;

if (_no_respawn_points == 1) then {_dialog_5 = createDialog "respawn_button_1map"};

if (_no_respawn_points == 2) then {_dialog_5 = createDialog "respawn_button_2map"};

if (_no_respawn_points == 3) then {_dialog_5 = createDialog "respawn_button_3map"};

if (_no_respawn_points == 4) then {_dialog_5 = createDialog "respawn_button_4map"};

if (_no_respawn_points > 0) then {ctrlSetText [1, _Base_1]};

if (_no_respawn_points > 1) then {ctrlSetText [2, _Base_2]};

if (_no_respawn_points > 2) then {ctrlSetText [3, _Base_3]};

if (_no_respawn_points > 3) then {ctrlSetText [4, _Base_4]};

};

if (_respawn_position == 1) then {_respawn_at_base = [_name, _pos] call Norrn_RespawnPos1};

// Unit respawns at chosen location if player

if (_respawn_position == 2 && isplayer _name || _respawn_position == 3 && isplayer _name) then {_respawn_at_base = [_unconscious_body] call Norrn_RespawnPos2};

// Unit respawns closest to leader if not player

if (_respawn_position == 2 && !isplayer _name || _respawn_position == 3 && !isplayer _name) then {_respawn_at_base = [_name, _pos] call Norrn_RespawnPos2AI};

if ((_respawnAtBaseWait select 1) != 0) then

{

_timer = (_respawnAtBaseWait select 1);

_name disableAI "anim";

_c = 1;

_name setCaptive true;

while {_timer >= 0} do

{

if (_c >= 1 ) then

{

if (_name == player) then

{

_timer_message = format ["You will respawn in %1 seconds", _timer];

titletext [_timer_message,"BLACK FADED", 0.3];

};

_timer = _timer - 1;

_c = 0;

};

sleep 0.05;

_c = _c + 0.05;

};

_name setCaptive false;

_name enableAI "anim";

};

// Add respawn at base weapons if this option is being used

if (_respawn_at_base_addWeapons == 1) then

{

// Added code for respawning at base with original mission load-out - 260409

if (count _respawn_at_base_magazines == 0 && count _respawn_at_base_weapons == 0) then

{

removeAllWeapons _name;

{_name removeMagazine _x} forEach magazines _name;

removeAllItems _name;

{_name addMagazine _x} forEach _base_mags;

{_name addWeapon _x} forEach _base_weps;

_name selectweapon primaryweapon _name;

} else {

removeAllWeapons _name;

{_name removeMagazine _x} forEach magazines _name;

removeAllItems _name;

{_name addMagazine _x} forEach _respawn_at_base_magazines;

{_name addWeapon _x} forEach _respawn_at_base_weapons;

_name selectweapon primaryweapon _name;

};

};

};

sleep 1;

};

Edited by A-SUICIDAL

Share this post


Link to post
Share on other sites

ive never had any issues with using the simplified version i posted onmapclick.

not when in vehicles, airborne or ground, the only thing that happens is that the unit play the exit animation when teleporting from inside a vehicle.

i always end up at 0 height.

issue is if you click on a building, the floor rarely is at 0 height, its most likely 0.3 or something, varies with buildings ofc, but then you may end up on the ground wich the house is placed, and inside the foundation of the building, this will happen no matter if you force the 0 height or not, and as we know, jumping isnt at its best in arma.

also a note on allowDammage, if you are inside a vehicle and only you the man unit is allowDammage false, you will die if vehicle explodes, ofc putting the allowdammage on thevehicle itself negates that giving the vehicle god mode instead.

@galzohar

i know this is more of a workaround, but using a hidden allowdammage false, cone or something similar small object, placing that at the pos and getPosASL from there works, minimal effort but not a direct scripting solution.

---------- Post added at 12:57 AM ---------- Previous post was at 12:37 AM ----------

creating a single player resapwn is kindof easy to do.

example, not taking into account custom weapons etc.

instant respawn, place one marker called graveYard somewhere out of sight.

place one marker called SP_respawn where you wish to respawn.

*snip* editing hold on.

---------- Post added at 01:21 AM ---------- Previous post was at 12:57 AM ----------

Edit: continous Single player respawn.

place this in player initline.

graveYardGrp = createGroup (side this); _idx = this addEventHandler ["killed", {_null = _this execVM "SP_respawn.sqf";}];

save this as SP_respawn.sqf

_dead = _this select 0;
_type = typeOf _dead;
_grp = group _dead;
_dead setPos (getMarkerPos "graveYard");
_unit = _grp createUnit [_type, (getMarkerPos "SP_respawn"), [], 0, "NONE"];
addSwitchableUnit _unit;
selectPlayer _unit;
_idx = this addEventHandler ["killed", {_null = _unit execVM "SP_respawn.sqf";}];
waitUntil {_unit == player};
[_dead] joinSilent graveYardGrp;
_dead hideObject true;

Edited by Demonized

Share this post


Link to post
Share on other sites

Works nice. I love it. I'm trying to understand exactly what the script is doing. Is there a way to leave the player dead for a moment, fade to black, then have a 10 second timer over the blackness, then the player finds himself back at the SP_respawn marker?

---------- Post added at 09:22 PM ---------- Previous post was at 09:01 PM ----------

Like, maybe right after the player respawns do something like from Norrin's script:

if ((_respawnAtBaseWait select 1) != 0) then

{

_timer = (_respawnAtBaseWait select 1);

_name disableAI "anim";

_c = 1;

_name setCaptive true;

while {_timer >= 0} do

{

if (_c >= 1 ) then

{

if (_name == player) then

{

_timer_message = format ["You will respawn in %1 seconds", _timer];

titletext [_timer_message,"BLACK FADED", 0.3];

};

_timer = _timer - 1;

_c = 0;

};

sleep 0.05;

_c = _c + 0.05;

};

_name setCaptive false;

_name enableAI "anim";

};

[\code]

Share this post


Link to post
Share on other sites

Here's another way guys.... two scripts. No need for an EventHandler.

This second script also adds a camera view of who shot you as well as a Titletext with the name and distance.

onPlayerKilled.sqf (if it exists in your mission folder) gets executed when a player dies...so....

onPlayerKilled.sqf:-

private ["_plyr","_kilr"];

_plyr = _this select 0;
_kilr = _this select 1;

//If you want to respawn at a marker as a new player...call the script like this...
//nul = [_plyr,_kilr,"wrespawn0"] execVM "playerKilled.sqf";

//If you want to respawn as a playable AI...call the script like this...
nul = [_plyr,_kilr] execVM "playerKilled.sqf";

This executes my script "playerKilled.sqf" which is in the same folder.

playerKilled.sqf:-

/*
A script for SP Respawn.
Twirly.
July 2011.
*/

private ["_plyr","_kilr","_mrkr","_type","_group","_dist","_camera","_found","_unit"];

_plyr = _this select 0;
_kilr = _this select 1;
_mrkr = if (count _this >2) then {_this select 2};

//grab some stuff we need later
_type = typeOf _plyr;
_group = group _plyr;
_dist = _plyr distance _kilr;

//camera initialisation
_camera = "camera" camCreate getpos _plyr;
_camera cameraEffect ["internal","back"];

//camera look at player
_camera camSetTarget vehicle _plyr;
_camera camSetRelPos [0.2,0.4,2];
_camera camSetFOV 0.143;
_camera camCommit 0;
waituntil {(camCommitted _camera)};

//camera zooms out over 5 seconds
_camera camSetRelPos [0,8,3.5];
_camera camSetFOV 0.7;
_camera camCommit 5;
waituntil {(camCommitted _camera)};

if (not (isNull _kilr)) then {
titleText [format ["Player killed by %1 at %2m",name _kilr,round _dist],"plain down"];
} else {
titleText ["Player killed by UNKNOWN","plain down"];
};

//hide and delete the body
hideBody _plyr;
sleep 3;
deleteVehicle _plyr;

//check if killer exists.... skip if killed by artillery, bomb, unknown etc...
if (not (isNull _kilr)) then {

//camera move to killer
_camera camSetTarget vehicle _kilr;
_camera camSetRelPos [2,5,2];
if (_dist > 500) then {_camera camCommit 10} else {_camera camCommit 5};
waituntil {(camCommitted _camera)};

};

_found = false;

if (count _this > 2) then {

//create the new unit.... same group
_unit = _group createUnit [_type, (getMarkerPos _mrkr), [], 0, "NONE"];
addSwitchableUnit _unit;
selectPlayer _unit;
waitUntil {_unit == player};
_found = true;

} else {

//try to find a random playable unit
while {(not (_found)) and ((count switchableunits) >=1)} do {
	_unit = switchableunits select (floor (random (count switchableunits)));
	if (alive _unit) then {
		_found = true;
		selectplayer _unit;
	};
	sleep 1;
};
};

//if no available units for respawn then end game
if (not _found) exitWith {
titleText ["No units available for respawn!","plain down"];
sleep 2;
enableEndDialog;
};

sleep 3;

//check if killer exists.... skip if killed by artillery, bomb, unknown etc...
if (not (isNull _kilr)) then {

//camera move to new dude
_camera camSetTarget vehicle _unit;
_camera camSetRelPos [2,5,2];
if (_kilr distance _unit > 500) then {_camera camCommit 10} else {_camera camCommit 5};
waituntil {(camCommitted _camera)};
};

sleep 2;

//quick fade-in on internal point of view of the next unit
_camera camSetTarget _unit;
vehicle _unit switchCamera "INTERNAL";
_unit cameraEffect ["terminate","back"];

//fade from black 3 seconds
titlecut [" ","black in",3];
camDestroy _camera;

//run any initialization scripts for the player here
//nul = [] execVM "blahblahblah.sqf";

Demo mission is here. Hack and chop as you see fit.

Edited by twirly
Fixed an error / updated link

Share this post


Link to post
Share on other sites
When you click on the map, only god (and BIS) knows what altitude your click is considered to be, so I'm not surprised you get weird results with simple setPos.

That said, I really wish there was a direct simple scripting solution to convert positions to ASL positions.

No, setPos vs other methods is not the source of the problem. It's related to what's inside _pos. Try the following:

onMapSingleClick {hint format ["pos: %1",_pos]}

and notice how _pos select 2 (altitude) is negated. So if you use _pos directly on a man, it tends to work for some reason. Use it on a vehicle, and it tries to put you way underground, snaps you backup, and often ruins the vehicle leaving you sitting there like a living question mark :p. So _pos seems to refer to x and y data as inputted, and z (height) data at the maps sea level even if ground is present.

Another example that causes confusion:

onMapSingleClick {hint format ["dist: %1",_pos distance player]}

Now click closely around you, shouldn't distance be pretty close to zero?

Lol, it's even weirder - just figured this one out :p

onMapSingleClick {hint format ["alt: %1",_pos select 2]}

And click on land at the same exact spot a few times. Same height, right?

As expected. Try the same on Utes, but click several times on same spot out on sea. Jeez :D

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  

×