Jump to content
Sign in to follow this  
norrin

SQF revive script

Recommended Posts

SQF Revive Scripts

AI_disabled revive script release version x_1.52

revive_5.jpg

There are two versions one for ArmA ver 1.14 + and the other for ArmA 1.08 (make sure you get the version that you want)

1. Version x_1.52 AI_disabled revive for ArmA 1.14 is available from here (14th October 2008 - readMe contained in rar file)

NB: this script can be used with either standard ArmA or Queens Gambit by making a simple change in the revive_init.sqf file (see ReadMe for more details)

2. Version x_1.46 AI_disabled revive for ArmA 1.08 is available from here (29th March 2008)

Description

Creates playable units that fall unconcious when killed which can then be revived – designed for use with AI-disabled CO-OP missions

Features and Options

• max_no_respawns - can specify how many times a player can be revived before he dies outright

• can_revive - can specify what sort of units can revive other players, for instance all ground troops or medics only

• mission_end_function – end the mission when all player units are unconscious or dead.

• reward_function – the number of revives of other players required to earn the reviving player an extra life.

• team_kill_function – the number of team kills a player can commit before he is penalised one life.

• Respawn dialogs – from 0 - 4 respawn points can be placed on the map at which unconscious units can respawn giving the units the option of revive or respawn. *These respawn points can be set-up so that they only become accessible if all enemy units surrounding the respawn points are killed or destroyed. *They spawn point markers are also colour coded so that they appear red when they are not accessible and green when they are.

Respawn Dialog sub options

a. all_dead_dialog - *allows the automatic appearance of the respawn dialog if all units are unconscious.

b. JIP_spawn_dialog - the mission maker can now set the amount of time before JIP players can access the respawn dialog when they first join the mission.

c. nearest_teammate_dialog - measures the distance between the unconscious unit and the nearest friendly unit if the set a distance is exceeded the respawn dialog automatically appears

d. Option of specifying up to 2 enemy sides. *If units from these enemy sides are within 50 metres of the spawn point the option to spawn at that point is not available

• unconscious_markers – create markers on the map showing where the unconscious units are.

• unconscious camera – while the player is unconscious it switches to a camera that either (a) focuses on the unconscious player’s body or (b) you can switch between following friendly units. *

• call_out function - causes the unconscious player to call out at random intervals (between 15 and 35 seconds) to help you find his body and revive him. *There is also an option to view an on screen revive timer count-down

• the amount of post-revive damage a player has can be set

• revive timer option. - revive time limit - if the time runs out the player respawns at base, has choice of respawn points or is declared dead. *A visible respawn timer count down can be enabled.

• heal_yourself_option *Adds an action to the player to heal himself.

• kegetys_spectator_script option for dead players to use kegetys script

• Players are revived with the weapons they died with.

• Can be set up easily for use with any side eg BLUFOR (default), OPFOR and RACS

• Incorporates anti-water code

• No addons needed but is compatible with other addons

Several other sub-options are present but read the notes in the zip file for more info on these.

Changes from previous version

*The damaged player upon revive feature. *

*A fix for the the unconscious unit not being set captive properly.

*A global broadcast for who has revived the player and the name of the player revived.

*An option that allows players to choose respawn point upon the revive timer elapsing.

*A color change for the markers to show which respawn points have been captured and are available for respawn.

*A timer showing the amount of revive time left.

* A number of other tweaks and fixes.

Implementation

Please read the latest readme before using the new scripts

Missions included

Test mission and version of the script for BLUFOR forces

Bugs

Occasionally when using the revive timer option a dead player’s body will disappear

There are potentially some problems with Kegetys script if you use this option but I've hopefully sorted most of them out. *For instance, if you are following a unit that is killed your view will change to the ocean and you’ll need to select the next unit in the view menu. *Also if using the mission_end_function players will get the message that the mission has failed but will not return to the debriefing screen until they press escape. *

Tested

On version 1.08/1.09 on both dedicated and local servers. *Works with JIP.

Based Upon

Concepts by PRiMe, toadlife, [APS]Gnat and Mongoose_84. *

Special Thanks to

HulkingUnicorn and MCPXXL for their scripting advice, testing and many suggestions

Also to satexas69, SNKMAN, sickboy, vengeance1 (JAAF), Legislator, Xeno and Raedor for all their suggestions, advice and support and to all at the BIS forums.

Last but by no means least to Foxhound and ArmAholic for their great support and providing mirrors for all my scripts

Other Scripts Used

Some of the voice arrray stuff stolen with the permission of SNKMAN from ArmA Group Link II Plus! *As well as the general layout for this readMe

And of course thanks to Kegetys for his amazing spectating script and to ViperMaul for his script fix

Chris'OFP editor.

Additional Comments

This version's based off xeno’s enhanced 1.25 code and you may notice the x in the version number, this is to acknowledge his enormous contribution in helping rewrite these scripts late last year and his good grace in allowing me to take over their development again. *Thanks m8 it is truly appreciated smile_o.gif

The scripts are set up in exactly the same way as the last version and the revive_init is almost identical however there is a new option _HULK_rProne = 1. *This option switches on a fantastic script by HulkingUnicorn that stops the player from standing after he has been revived until he’s been properly healed by a medic. *This option must be used in conjunction with the revive with damage option and the revive damage must be set to greater than equal to 0.8.

If this version is stable then I just want to add a couple more changes including HulkingUnicorn’s set up recommendations and we should be close to a final release.

Finally to MCPXXL couldn’t have done this without your help, time and patience m8 – thank you. smile_o.gif

Good luck,

norrin smile_o.gif

Latest version of the AI_enabled revive beta

You can get a new version (Version 0.62b beta) here (07/05/2009)

OFPEC AI_enabled Revive Tutorial

The OFPEC AI Enabled Revive Tutorial can be found here. *

* This tutorial describes the various features and functions available in the script in detail and provides a step by step guide on setting-up and configuring the latest (0.61 version) of the AI _enabled revive scripts.

Here's the latest changes:

* Script optimisations.

* Call for help button

* New unconscious camera features including free cam mode

Many thanks to Hoz at OFPEC for his help with this version.

Bugs

If you spawn into an unconscious group leader when you are revived you may be armed with your secondary weapon. However, when you shoot the rifle on your back fires. *The only way I've found to resolve this bug is to respawn and be revived.

Additional bugs identified by SNKMAN

*In my first test i got a lot of "Empty Vehicles" in the Spectating name select list after i was killed but i think it was solved after i put "gw1 = group this" into the init of the group leaders.

*After i was revived by a AI i alwasy have to put ESC to return from the Spectating View to the player view.

*Sometimes the Action "Revive" will not be delete from my Action Menu after i had Revived a Ai unit.

Most importantly please make sure you check out the readMe in the zip file before using these scripts.

In action

For a short vid of the AI_enabled script in action from different player perspectives click

PvP AI_disabled Revive Script

You can get the latest beta version from here (version 1.35, 30th June 2008)

The ReadMe is contained in the rar file

There's actually an updated version of the PvP script contained in the PvP mission here: http://norrin.org/downloads/Missions/PvP_test_QG3.Porto.pbo

Somewhat "more realistic" AI disabled revive script (ver 0.2c beta)

This is probably more of an oddity than anything else but it may be of use to some one. *You can get it here

Differences from normal AI_disabled script

1. Depending on where a player is hit there is a possibility that the player will die rather than fall unconscious, the more times a player has fallen unconscious the more likely he will die each time (there is a maximum of 3 respawns if you’re lucky). *

2. The amount of time that player has to be revived before dying is also determined by where he was damaged and also the number of times he has been killed.

3. Bleeding – players who receive more than 0.4 damage will start to bleed until they fall unconscious this is accompanied by temporary losses of vision.

4. Bandages – Players have a number of bandages that they can use to stop bleeding. *Players can bandage other players if they have bandages available.

5. Revive-kits – Players are given a number of revive kits at mission start

6. Medical supplies both bandages and revive kits can be replenished at ambulances and MASH tents.

7. Once a player is revived he will have a certain amount of time to receive medical attention (_time_post_revive) either from medic, MASH or ambulance otherwise he will fall unconscious again, during this time he will not be able to stand.

8. There are three classes of units that can be specified in the medic_init.sqf not 2 as in the normal revive

9. Medics can be given more supplies than normal unitsode]

10. There’s no respawn points!

ACE Revive Scripts

ACE_revive (can be used when AI is enabled or disabled): http://www.norrin.org/downloads/ACE_revive/ACE_revive_03d.sara.rar (080509)

ACE_AI_disabled_revive (best script for large AI_disabled missions): http://www.norrin.org/downloads/ACE_revive/ACE_revive_AI_dis_03c.Intro.rar (080509)

Database of Revive Missions

tomcat_ from Reality Friends has set up a database of AI_disabled revive missions here: http://www.realityfriends.com/forum/viewforum.php?f=45

These missions have either been designed from the outset to use revive or have been converted. *In the converted missions you have a choice of revives at mission start-up, no respawn, everyone can revive everyone, AI-disabled and a revive timer of 4 minutes before you are dead outright. The guys at the site are testing the missions as they can and we are fixing any bugs where possible.

If you have any missions you'd like added to this list or want help converting your missions please contact me or add your missions to this thread: http://www.flashpoint1985.com/cgi-bin....1166915 and tomcat_ will see that they get added to the list.

Edited by norrin
Updated script releases

Share this post


Link to post
Share on other sites

i maybe able to help with first one try replacing.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _body = "Body" createVehicle _pos;

_body setPos [(_pos select 0),(_pos select 1), 0];

_body setDir _dir;

with

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_body = "Body" createVehicle _pos;

_relpos = [0,0,0];

_worldpos = _unit modelToWorld _relpos;

_body setpos _worldpos;

_body setdir _dir;

i havent tried it with an array as in _pos you could try it i suppose.but i think it will error . lemme know

if that dont work try replacing _unit with player.

i think setpos the old way has kinda suffered because of the new collision and it dosent like placing things , in another objects space ,more so than ofp.

Edited by W0lle
code tags fixed

Share this post


Link to post
Share on other sites

Thanks for the suggestions deanosbeano but unfortunately using both _unit and player in your code gave me the same result as I was getting.  You got me thinking and I also tried moving the dead player before creating the new body but once again got the same result.

I've tried running as two separate players on my dedi and in the dead players view his body is in the correct spot whereas in the alive players view its about 5 metres away.  This can cause some probs when reviving as you need to be where the player died rather than where the created body is to start to revive.

I guess if all else fails I'll increase the radius in which the revive is allowed.

Share this post


Link to post
Share on other sites

hmm i have had probs too, but i use 1.02 still not sure about you.

something is missing somewhere , i havent checked all ya code because of time.

but what i wil say is this. in 1.02 theres some weird things going on. inits not working unless a bullet is fired by the player. wapoint positions not corresponding to the actaul point placed on maps.

i hope 1,05 will sort alot of this things out .

i personally havent had the chance to use setpos in mp.

there is so many ways now to use setpos.

1 yur original example

2 my suggested second

3 createvehiclelocal

4 gettposasl

5 worldtomodel < untested but can assume its opposite of modeltoworld ,lol

anyway hope ya sort it out.

Share this post


Link to post
Share on other sites

I've discovered if I put a sleep after the

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (!alive player) then

{

so it lookls like this

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (!alive player) then

{

     sleep 6;

the blanket covered body spawns in the correct position.

Only problem is now if put a sleep directly after I exec the camera.sqs ie:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[_body, _pos] exec "camera.sqs";

sleep 2;

I get two bodies spawning.  If I delete this sleep I get a single body but it mucks up the continuity when the camera initialises.  Oh the pain, the pain.  Hopefully I'll get this sorted and get a new version up later today.

PS: still got the problem with the shiftmove though for the player who is reviving his team mate

PS: @deanosbeano I'm also using 1.02 the Morphicon version

Edited by W0lle
code tags fixed

Share this post


Link to post
Share on other sites

I've updated the script and the the body placement and camera works well now.  

You can get a new version of the script from here.(Version 29)

I've got some ideas on how to fix the other bug and may have another new version available in a few hours.

The only problem with the body placement now is if another unit is right next to where you die due to the collision rules as mentioned by deanosbeano it displaces the body by a few metres.

EDIT: As promised here is the revised revised version (ver 29) of this script. smile_o.gif

The player now bends to revive the body and can no longer shoot while healing his fallen comrade.

I've also updated the links above.

For any one interested the revised code looks like this <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

//*****************************************************

//** Operation Flashpoint Script File

//*****************************************************

//Script by norrin Feb 2007

//contact me at norrins_nook@iprimus.com.au

//Based on concepts by PRiMe, toadlife and Mongoose_84

//Note: players will respawn with the weapon load out they died with

// and it will only work with human players not with playable AI

// remember to add a game logic called server to your mission.

//revive.sqf

_unit = _this select 0;

_name = _this select 1;

_grp = _this select 2;

_revive_cutoff = 60;

_heal_time = 5;

_can_respawn = "SoldierWB";

_respawn = false;

_spawn_point = getMarkerPos "Respawn_west";

_run = true;

sleep 1;

for [{}, {_run}, {_run}] do

{

while {alive player && !_respawn} do

{

_heal = time + _heal_time;

sleep 1;

while {player distance (nearestObject[player, "body"]) <= 3 && time < _heal} do

{

player switchMove "AinvPknlMstpSlayWrflDnon_medic";

sleep 5;

};

if (player distance (nearestObject[player, "body"]) <= 3 && time > _heal) then

{

player switchMove "AinvPknlMstpSlayWrflDnon_medic";

sleep 7;

};

};

if (!alive player) then

{

[player]join grpNull;

_pos = getPos player;

_dir = getDir player;

_bee = "butterfly" createVehicle _pos;

[_bee, _pos] exec "camera.sqs";

sleep 6;

{_x disableAI "Move"}forEach units _grp;

enableRadio false;

_pos = getPos player;

_dir = getDir player;

_weapons = weapons player;

_mags = magazines player;

_prigun = primaryWeapon player;

_body = "Body" createVehicle _pos;

_body setPos [(_pos select 0),(_pos select 1), 0];

_body setdir _dir;

player setPos [(_spawn_point select 0), (_spawn_point select 1), 0];

_pos_body = getPos _body;

_dir_body = getDir _body;

_respawn = true;

sleep 1;

waitUntil {alive player};

_heal = time + _heal_time;

while {_body distance (nearestObject[_body, "SoldierWB"]) > 5}do

{

_heal = time + _heal_time;

sleep 1;

};

_list = position _body nearObjects ["SoldierWB", 5];

while {!alive(nearestObject[_body, "SoldierWB"])} do

{

sleep 1;

};

while {_body distance (nearestObject[_body, "SoldierWB"]) <= 5 && time < _heal && alive(nearestObject[_body, "SoldierWB"])} do

{

nearestObject[_body,"SoldierWB"]switchMove "AinvPknlMstpSlayWrflDnon_medic";

nearestObject[_body,"SoldierWB"] doWatch _body;

sleep 1;

nearestObject[_body,"SoldierWB"] doWatch _body;

sleep 5;

};

if (_body distance (nearestObject[_body, "SoldierWB"]) <= 5 && time > _heal && alive(nearestObject[_body, "SoldierWB"])) then

{

nearestObject[_body, "SoldierWB"]switchmove "AinvPknlMstpSlayWrflDnon_medic";

player switchMove "AinvPknlMstpSlayWrflDnon_healed";

{_x enAbleAI "Move"}forEach units _grp;

nearestObject[_body,"SoldierWB"] doWatch _body;

//Player returns to body

player setPos [(_pos_body select 0), (_pos_body select 1), 0];

player setdir _dir_body;

player switchMove "AinvPknlMstpSlayWrflDnon_healed";

enableRadio true;

[player]join _grp;

//Remove body

deleteVehicle _body;

deleteVehicle _bee;

//Add weapons player carried when they died

removeAllWeapons player;

  {player addMagazine _x} forEach _mags;

  {player addWeapon _x} forEach _weapons;

  player selectweapon _prigun;

  if(_prigun == "M16A2GL")then

  {

player selectweapon "M16Muzzle";

  };  

  if(_prigun == "M16A4GL")then

  {

player selectweapon "M16Muzzle";

  };

  if(_prigun == "M16A4_ACG_GL")then

  {

player selectweapon "M16Muzzle";

  };

  if(_prigun == "M4GL")then

  {

player selectweapon "M4Muzzle";

  };

  if(_prigun == "M4A1GL")then

  {

player selectweapon "M4Muzzle";

  };

  if(_prigun == "AK74GL") then

  {

player selectweapon "AK74Muzzle";

  };

sleep 5;

_respawn = false;

sleep 10;

};

};

};

Edited by W0lle
code tags fixed

Share this post


Link to post
Share on other sites

Here is a new version of my revive script.

The new version (revive_follow_cam_6.Intro.pbo) has a camera that at first focuses on the downed player’s body and then moves to a behind/follow view of the nearest friendly foot unit.  If the camera targeted unit dies the view returns back to the player’s body before finding the next closest friendly unit.

There are a couple of exceptions for instance if the closest friendly unit is more than 50 metres away the camera focuses on the players body.  However, if a friendly unit moves to within the 50 meter radius of the body the camera attaches itself to this friendly unit.

In addition, the closest friendly AI unit will now move to the downed player if there is not a player unit closer and revive.  The downed player must be no more than 50 metres away for this to occur however.

This is the best I can do so far as I although I can get the Kegetys’ spectator script running for the downed unit I can’t switch it off when the player is revived.  For some reason the terminate command does not seem to be working.

Bugs:

1. Although, JIP in progress does work there can be some problem with the player joining becoming a member of the correct group.  

2. If a player leaves the mission while a corpse his body is left on the map and this can cause problems for both AI and playable units. The closest AI if within 50 metres will move to the body even though it won’t revive and playable units that get to within the 5 metre revive distance will automatically attempt to revive.  In either case you’ll quickly work out that its an empty corpse and will not revive and you can move away or order the AI unit away.

Future work:

Still like to Kegetys spectator script working but if not possible I’ll also set it up so that the camera will follow a vehicle if it contains the closest friendly unit.

Despite the bugs the script seems to be working well.

Share this post


Link to post
Share on other sites

Sounds great

i will give it a try wink_o.gif

Is there a way to limit the number of respawns ?

like 5,10,20 or more ?

Share this post


Link to post
Share on other sites

@Fangschuss

Here's a version (ver 14) just for you where you can limit the number of revives per player. smile_o.gif  

The variable you need to change at the start of the script is: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_max_respawns = 2; As you can see I've got it currently set to 2 for testing purposes but just adjust this value to whatever you want.

Once the maximum number of respawns is reached the next time the player dies Kegetys spectating script kicks in.

There are some major limitations with this "limited number of revives" version however and they relate to problems with the current implementation of join in progress and therefore they are a bit beyond my control.

So if you play missions with the "limited number of revives" version (ver 14) of the script and you want to use JIP you'll need to disable the playable AI when you start the mission.

Even with the playable AI disabled you will occasionally come across a camera error with units joining in progress in this version.

Please let me know if you run into any other problems.

For everyone else I currently recommend you use the previous version of the script (revive_follow_cam_6.Intro.pbo)

Edited by W0lle
code tags fixed

Share this post


Link to post
Share on other sites

@Fangschuss,

I think I may be able to get around some of the JIP progress probs in the "limited number of revives" version of the script if I don't use Kegetys' script and use my simpler camera-follow script instead.

These changes may also allow you to use the AI units. I'll hopefully give it a try a bit later today and let you know how it goes.

Share this post


Link to post
Share on other sites

moin moin norrin

So far i only tested v14 on non-dedi server ...

but one thing... i can't join my group after been revived by an ai unit huh.gif

...trying to test more today...can you make a short "readme" for a future release ? to check everything is correct

...i past it in to my mission... and changed the _unit array in the ini.sqs right ?

great work so far norrin smile_o.gif

P.S.: please forgive my poorish english crazy_o.gif

Edited by W0lle

Share this post


Link to post
Share on other sites

The latest version 17 can be downloaded from here

OK, I’ve managed to fix almost all of the join in progress problems in the previous "limited number of revives" version of the script and it’s now as stable as any of the previous versions so you may as well use this version now.  

I’ve removed Kegetys spectating script and replaced it with my own simpler camera follow script discussed in the previous posts.

I’ve managed to trick the game into thinking the players are permanently dead when their revive limit is reached so that if someone leaves and then joins in this slot they are transported to the start point of the mission and not the Respawn_west marker on the island.

The only annoying thing about this is that the text that the player is dead keeps coming up in the left hand bottom corner of the screen until the player gets sick of spectating and leaves.  So if anybody knows how to get rid of this text could they please let me know.

There is also a message displayed telling you how many revives you have remaining each time you are revived

Instructions for use

1. unPBO the mission file

2. Place this in your init.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_units =[alpha_1,alpha_2,alpha_3,alpha_4];

{if(isplayer _x)then {s = [this, _x, alpha] execVM "revive.sqf"};} forEach _units;

{if(!isplayer _x)then {[_x, alpha] exec "Revive_AI_heal.sqs"};} forEach _units;

The playable units in my test mission are called alpha_1, alpha_2 etc so change these to match the names you are using.

Alpha is the name of the group that these units belong to so you will need to change the alpha in the execVM "revive.sqf" line to whatever the group name is for your units.

3. Then copy across the following files to your mission directory:

Description.ext

Revive_AI_heal.sqs

Revive.sqf

Camera_follow.sqs

4. In the Revive.sqf script 20 lines from the top, including blank lines, there is the following code <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _max_respawns = 2;

Just set this to the number of revives you want for each player.

Bugs

If players quit while they are a corpse when players join in their slot they are transported to the island respawn point, which has been a problem for all versions to date.  I’ve just thought of a way to fix this bug but it’ll have to wait until tomorrow.

The annoying text prob discussed above

Edited by W0lle

Share this post


Link to post
Share on other sites

Hi, this thing looks good - I'm going to try to put it in my WIP mission. I have a question and a suggestion for you:

#1: Is there any reason for giving playable ai a grave instead of making them revivable?

#2: Maybe you could make a list over the dead players. Then if a JIP player isn't on the 'death list' their chosen unit is respawned (or made revivable).

Edit:

Just found out that I need to execute the script with group name... Since I have four different groups, would I need to run four versions of the script?

Share this post


Link to post
Share on other sites

I have created on where it uses respawnType 3 and then uses triggers to run gear setup

in the gear setup i use my onRespawn.sqf

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_unit = _this select 0;

_position = _this select 1;

if(local _unit)then{

// creates a _unit to copy standard gear from.

_agent = (typeOf _unit) createVehicleLocal (_position);

_magazines = magazines _agent;

_weapons = weapons _agent;

// adds all the gear to local _unit.

removeAllWeapons _unit;

{_unit addMagazine _x;}forEach _magazines;

{_unit addWeapon _x;}forEach _weapons;

// deletes the agent to copy gear from.

deleteVehicle _agent;

};

exitWith;

in the same trigger i move the unit into a M113 that can be moved around as a progressive spawnPoint

in the same time I have this running on the "killed" eventHandler onKilled.sqf

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_unit = _this select 0;

// if unit is local and a player then show black screen until

// respawn is done.

if((isPlayer _unit) && (local _unit))

then {

titleText["Respawning","BLACK OUT", (respawnTime + 1)];

sleep respawnTime + 1;

titleText["Respawning","BLACK IN", 1];

sleep 1;

};

// deleting the old unit that is laying around

if(_unit isKindOf "LandVehicle" OR _unit isKindOf "Air" OR _unit isKindOf "Ship")

then{

sleep 60;

}

else{

sleep 30;

};

deleteVehicle _unit;

ExitWith;

I haven't had a chance to test it on at dedicated server yet

so I dont know if its mp safe because I just started to make scripts again for ArmA, so im not into it all yet.

Edited by W0lle

Share this post


Link to post
Share on other sites

Hey norrin, smile_o.gif

why trying to make a Revive Respawn Script if there still exist a pretty good one?

Check out my Mission: Operation_Crossfire_v-1-2_Beta

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">;-------------------------------------------------------------

;ArmA - REVIVE RESPAWN Script - By Doolittle

;-------------------------------------------------------------

;Updated by PRiME to work with multiply unit types.

;Updated for ARMA By Michael --- www.zonekiller.ath.cx --- zonekiller@iinet.net.au

;Optimized by =\SNKMAN/=

;-------------------------------------------------------------

Michael did the Main part to convert it from OFP to ArmA and i just optimized some things and added the sound. smile_o.gif

I tryed to convert it to .sqf but i failed. ( Missing knowledge ) confused_o.gif

Well just check it out and i bet you will love it. thumbs-up.gif

Edited by W0lle

Share this post


Link to post
Share on other sites

@Hulking_unicorn, I'm working on the Ai respawn thing and may have found a solution but I won't get to it until later.

You should send the group name when you execute the script so you should only need once instance of the script in your mission.  If you post your unit names and the groups they belong to I'll write the code that you'll need to put in the init.sqs

@SNKMAN  I've come so far with this dam SQF script that I want to see it working ie. I'm bloody stubborn.

More importantly when I started writing the script every mission that we tried on the XGN-GSA servers that used the Revised Doolittle script didn't work very well so I started working on one and my clan like it hard core so they wanted a black screen while you were unconcious so I was originally writing it for them.  

The problems with the Doolittle script may have been fixed since then as it was a month or so ago but as I said I've spent alot of time on this now and want to see it out and its kinda of cool playing around and seeing how things work.  

The good news is I think I've found a solution to all the remaining problems. By adding an onPLayerConnect cmd that runs a short sqs script that sends the player to the mission start point if he joins in a slot where a player has left while he was a body may just do it smile_o.gif

Share this post


Link to post
Share on other sites

Guess I misunderstood your 'installation'  instruction then - thought you could only pass 1 group to each instance of the script.

Anyway:

wGLdr: wG1_1

wGrp1: wG1_2, wG1_3, wG1_4, wG1_5

wGrp2: wG1_6, wG1_7, wG1_8, wG1_9

wGrp3: wG2_1, wG2_2, wG2_3

Share this post


Link to post
Share on other sites

Sorry 'bout the instructions I'll keep working on them to try and make things clearer.

Try replacing the code in your init.sqs with this:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_units_0 =[wG1_1];

{if(isplayer _x)then {s = [this, _x, wGLdr] execVM "revive.sqf"};} forEach _units_0;

{if(!isplayer _x)then {[_x, wGLdr] exec "Revive_AI_heal.sqs"};} forEach _units_0;

_units_1 =[wG1_2, wG1_3, wG1_4, wG1_5];

{if(isplayer _x)then {s = [this, _x, wGrp1] execVM "revive.sqf"};} forEach _units_1;

{if(!isplayer _x)then {[_x, wGrp1] exec "Revive_AI_heal.sqs"};} forEach _units_1;

_units_2 =[wG1_6, wG1_7, wG1_8, wG1_9];

{if(isplayer _x)then {s = [this, _x, wGrp2] execVM "revive.sqf"};} forEach _units_2;

{if(!isplayer _x)then {[_x, wGrp2] exec "Revive_AI_heal.sqs"};} forEach _units_2;

_units_3 =[wG2_1, wG2_2, wG2_3];

{if(isplayer _x)then {s = [this, _x, wGrp3] execVM "revive.sqf"};} forEach _units_3;

{if(!isplayer _x)then {[_x, wGrp3] exec "Revive_AI_heal.sqs"};} forEach _units_3;

I hope it works for you.

Don't forget to change the <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_max_respawns = 2 in the revive.sqf to however many revives you want.

I'm hoping to have a revised version of my revive script later today (in about 10 hours) that fixes the body JIP bug and the text issues I mentioned previously and may allow AI respawning as well, so you may want to hold off with the modifications to your mission until then.

Edited :left off some semicolons from the ends of lines fixed

Edited by W0lle
code tags fixed

Share this post


Link to post
Share on other sites

Thx mate!

But theres something I don't quite get...

You execVM the same script four times, doesn't that mean that there are four instances of the script running at the same time?

I'm not in much of a hurry, so I can wait for the update smile_o.gif

JIP players might be disappointed if the truck with the ai got some punishment from a bmp and there was no body to jump into crazy_o.gif

Have you tried using both the sqf and sqs 'versions' under the same conditons to compare performance?

Share this post


Link to post
Share on other sites
But theres something I don't quite get...

You execVM the same script four times, doesn't that mean that there are four instances of the script running at the same time?

Its my understanding and I could be completely wrong that there is an instance of the revive.sqf script running for every player using it, so if there are 12 human players there are 12 instances of the script running. If somebody knows more about this please post.

In answer to the sqf and sqs versions question I don't know as I haven't had a chance to try SNKMAN's script yet.

Share this post


Link to post
Share on other sites

I looked some more into your scripts... I've never tried executing scripts like that before, but you may very well be right - that the revive.sqf will launch on every client (I think scripts launched through init.sqs/sqf isn't launched on JIP clients, so it may be better to put it in a trigger instead).

However, it seems the "Revive_AI_heal.sqs" is run for every playable ai on the server (if the leaders of the groups are ai) - which might bog down the system more than nescessary (atleast if I'm hosting...). This might be changed with your update however, but if not: consider making the ai script run in one instance on the server, or atleast only once per group smile_o.gif

This might be lack of sleep talking, but I didn't really see the need for running it using groups - a playable units array looks like it could do just as well (I might do a little hack about that - at this early stage of my mission, the groups are kind of dynamic, as the main leader can make the other groups join him).

Share this post


Link to post
Share on other sites

I've done quite a bit of JIP progress testing with these scripts on a dedicated server and as far as I can tell as long as the player doesn't join in the position of another player who has quit while still a body JIP works perfectly and there doesn't seem to be a problem with the sqf executing for the joining player.  Things seem to also be working well for players leaving the server and the units revert to player leader control.

Hopefully the last of the JIP problems (described above) will be fixed in the changes I'll make shortly.

The AI_revive script was deliberately set up as an sqs script as I wanted it to be able to be stopped (exit) if a human player joined the game in this slot and up to this point I haven't been able to get the new teminate "script" cmd to work.  

I've also tried to minimise computer usage by including many sleeps/rests but you could be right and these scripts could be cpu intensive but only time will tell.  I really initially envisaged these scripts for use in small co-op missions where this won't be a problem but that's not to say they won't work on larger missions as well.  All I can really say is in a small 4 player mission verses a small number of respawning AI enemies (done using some of my other scripts) there seems to be very little cpu utilisation using these scripts.

I'll think more about what you said about player arrays and running a single instance of the Revive_AI_heal.sqs and see if I can incorporate this but it may not be possible.

EDIT:  Things didn't go quite as smoothly as I hoped last night (when do they ever do that smile_o.gif) and although I fixed a couple of problems there is still more work to do.  Unfortunately I won't get to it again for a couple of days now so sorry for the hold-up.

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  

×