IRONFRONT FANS FORUM
Sign up Latest Topics
 
 
 


Reply
  Author   Comment  
Tayuk

Avatar / Picture

RM Team
Registered:
Posts: 456
Reply with quote  #1 
Download based on last posts:  Insurgency_Respawn.ivachev(Template)

EDIT:- THIS SCRIPT IS NOT WORKING FOR ME AT ALL NOW, EVEN THOUGH IT DID WHEN I FIRST TRIED IT (TAY-UK)


Insurgency style respawn for those not familiar with the Arma 2 game mode, is a respawn that allows you to respawn next to the position of  any living member of your group rather than at a base, whether he be a player or an AI member of your group. This script has been put together by:- bardosy 

Your mission will need to be set to "BASE" respawn in your description.ext file and you will need a "respawn_Guerrila" or  "respawn_west" or "respawn_east" marker to suit the playable factions placed at a base position.

In the init field of each playable unit put
xhandle = this addEventHandler ["killed", "_this execvm 'lackoRespawn.sqf'"]


In your mission folder put these 2 scripts

lackorespawn.sqf

_unit = _this select 0;

private ['_magazines','_weapons','_backpack','_backpackweap','_backpackmags'];

_weapons = weapons _unit;

_magazines = magazines _unit;

_backpack = typeOf unitBackpack _unit;

_backpackmags = getMagazineCargo unitBackpack _unit;

_backpackweap = getWeaponCargo unitBackpack _unit;

 

if (_unit == player) then {

setPlayerRespawnTime 500;

_squad = group player;

lck_livingmates = [];

{

if (alive _x and _x!=player) then {lck_livingmates = lck_livingmates + [_x];};

} foreach units _squad;

lck_actualmate = 0;

_elozoactual=lck_actualmate;

keyout = 0;

openMap false;

0 fadesound 0;

disableserialization;

keyspressed = compile preprocessFile "lackoRespawn_keydown.sqf";

_displayID = (findDisplay 46) displaySetEventHandler ["KeyDown","_this call keyspressed"];

_cam = "camera" camcreate [0,0,0];

_cam cameraeffect ["internal", "back"] ;

showCinemaBorder false;

_cam camsettarget (lck_livingmates select lck_actualmate);

_cam camsetrelpos [0,-5,2.5];

_cam camcommit 0;

TitleText["Right Arrow = next squadmate\nLeft Arrow = previous squadmate\nEnter = respawn","PLAIN DOWN"];

_ido=0;

while {_ido<=500} do {

if (_ido mod 10 == 0) then {

TitleText["Right Arrow = next squadmate\nLeft Arrow = previous squadmate\nEnter = respawn","PLAIN DOWN"];

};

if (keyout > 0) exitwith {};

_currentmate = lck_livingmates select lck_actualmate;

_tempcnt=0;

lck_livingmates = [];

{

if (alive _x and _x!=player) then {

lck_livingmates = lck_livingmates + [_x];

if (_x==_currentmate) then {lck_actualmate = _tempcnt;};

_tempcnt = _tempcnt + 1;

};

} foreach units _squad;

if (count lck_livingmates == 0) exitwith {};

_cam camsettarget (lck_livingmates select lck_actualmate);

_cam camsetrelpos [0,-5,2.5];

_cam camcommit 0;

waituntil{camCommitted _cam};

_ido = _ido + 0.02;

sleep 0.02;

};

TitleText[" ","PLAIN DOWN"];

(findDisplay 46) displayRemoveAllEventHandlers "KeyDown";

setPlayerRespawnTime 5;

_ido=0;

while {_ido<=5} do {

_cam camsettarget (lck_livingmates select lck_actualmate);

_cam camsetrelpos [0,-5,2.5];

_cam camcommit 0;

waituntil{camCommitted _cam};

_ido = _ido + 0.5;

sleep 0.5;

};

_newpos = getPos glbase;

if (keyout > 0) then {

_newpos = getPos (lck_livingmates select lck_actualmate);

//player globalchat format ["cel=%1, x=%2, y=%3", name (lck_livingmates select lck_actualmate),(_newpos select 0),(_newpos select 1)];

if ((_newpos select 0)>50 and (_newpos select 1)>50) then {

player globalchat "good respawn";

} else {

player globalchat "base respawn";

_newpos = getPos glbase;

};

} else {

player globalchat "baserespawn";

_newpos = getPos glbase;

};

player cameraEffect ["terminate","back"];

camdestroy _cam;

0 fadesound 1;

waituntil {alive player};

player setPos _newpos;

_unit = player;

removeallweapons _unit;

removeAllItems _unit;

removeBackpack _unit;

{_unit addmagazine _x} foreach _magazines;

{_unit addweapon _x} foreach _weapons;

_primw = primaryWeapon _unit;

if (_primw != "") then {

_unit selectWeapon _primw;

// Fix for weapons with grenade launcher

_muzzles = getArray(configFile>>"cfgWeapons" >> _primw >> "muzzles");

_unit selectWeapon (_muzzles select 0);

};

if(_backpack != "") then {

_unit addBackpack _backpack;

clearWeaponCargo (unitBackpack _unit);

clearMagazineCargo (unitBackpack _unit);

for "_i" from 0 to (count (_backpackmags select 0) - 1) do {

(unitBackpack _unit) addMagazineCargo [(_backpackmags select 0) select _i,(_backpackmags select 1) select _i];

};

for "_i" from 0 to (count (_backpackweap select 0) - 1) do {

(unitBackpack _unit) addWeaponCargo [(_backpackweap select 0) select _i,(_backpackweap select 1) select _i];

};

};

};



Then this script called "lackorespawn_keydown.sqf"

_key = _this select 1;

//player globalchat format ["key=%1", _key];

//right arrow

if (_key == 205) then {

lck_actualmate = lck_actualmate + 1;

if (lck_actualmate >= count lck_livingmates) then {

lck_actualmate = 0;

};

};

//left arrow

if (_key == 203) then {

lck_actualmate = lck_actualmate - 1;

if (lck_actualmate < 0) then {

lck_actualmate = (count lck_livingmates)-1;

};

};

if (_key == 76) then {

TitleText["Right Arrow = next squadmate\nLeft Arrow = previous squadmate\nEnter = respawn","PLAIN DOWN"];

};

//Enter key

if (_key == 28) then { keyout = _key };

0
Gunter Severloh

Avatar / Picture

Admin
Registered:
Posts: 2,767
Reply with quote  #2 
Great post Tay, i was thinking that group respawn would almost do the same no?
__________________
0
Tayuk

Avatar / Picture

RM Team
Registered:
Posts: 456
Reply with quote  #3 
No mate, group respawn means that so long as you have living playable AI in your group, when you die you become one of them. So if all AI are dead or taken by other players, then there is no respawn.
0
Gunter Severloh

Avatar / Picture

Admin
Registered:
Posts: 2,767
Reply with quote  #4 
Quote:
when you die you become one of them

that would be for side, but the group respawn only works as long as there is AI to respawn on.
Quote:
    • 4 or "GROUP" - Respawn in your group (if there's no AI left, you'll become a seagull).
    • 5 or "SIDE" - Respawn into an AI unit on your side (if there's no AI left, you'll become a seagull). With this respawn type, team switch is also available to any AI controlled playable units.
I see the difference for the script, yet to try it though, have you tested it yet in IF?


__________________
0
Tayuk

Avatar / Picture

RM Team
Registered:
Posts: 456
Reply with quote  #5 
Yes I have tested it in Ironfront, and It worked for me on my own in the server, I had the option via camera view to spawn on any of my squad. But not tested in multiplayer as such.

EDIT - NOT CURRENTLY WORKING (I HAVE NO IDEA WHY AS IT DID LAST TIME I TRIED IT, its almost like the killed event handler has stopped working)

Has anyone tried this script since I posted it and if so has anyone got it to work?





This is the link to the original post on ARMA2 forums just incase anyone knows whats going on because I am totally confused.

Insurgency Style Respawn
0
Tayuk

Avatar / Picture

RM Team
Registered:
Posts: 456
Reply with quote  #6 
This script seems to be working again now  so while it was I made a small video so you can see it in action. and have also created a template to download. I would download the template rather than using the scripts above, just incase there is an error in the coding.

>>Download Template<<




There is still something not quite right about it all, since I have started it before and just spawned at the respawn marker without getting the option to spawn on a sqaudmate, but other times it works fine. It would be good if someone who knows scripting could take a look and maybe fix it?




0
BRS

Captain
Registered:
Posts: 197
Reply with quote  #7 
Not sure if this would be all, I had just a quick look into,
but there is a difference between your mission and the script.
You named the logic in your mission glbase and inside the script is safebasegl used.
I would suggest that you'll change the logic in your mission to safebasegl and try it once again.

Maybe you should add to your description.ext: respawn = "BASE";  too.
I'm not sure if this is really needed, may be this is default if you don't tell the game anything about a respawn mode in the description.ext.
0
Tayuk

Avatar / Picture

RM Team
Registered:
Posts: 456
Reply with quote  #8 
Well spotted BS, I never noticed they had changed the gamelogic name

And I did have a description.ext file with respawn = 3;  But I have changed it to "BASE" just incase. And thank you for looking

[EDIT] I made the changes above and for the 1st 2 deaths I had the option to respawn at a squad mate, on the 3rd occasion I automatically respawned at the respawn_west marker, so still no clue as to why thats happening.
0
BRS

Captain
Registered:
Posts: 197
Reply with quote  #9 
Yes, you are right. It is the same : 3 or "BASE" -> Respawn in base.
For the mission, I test-played it several times now and only sometimes I respawned at the base too.
0
Gunter Severloh

Avatar / Picture

Admin
Registered:
Posts: 2,767
Reply with quote  #10 
Now hosted on the MR:

Download:  Insurgency_Respawn.ivachev(Template)

__________________
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.