Home   Help Login Register  

Author Topic: SQF revive script (ACCEPTED)  (Read 20797 times)

0 Members and 2 Guests are viewing this topic.

Offline norrin

  • Tutorial Writer
  • **
SQF revive script (ACCEPTED)
« on: 01 Mar 2007, 05:44:57 »
SQF Revive Scripts

AI_disabled revive script release version x_1.52



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 :)

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. :)

Good luck,

norrin :)

Latest version of the AI_enabled revive beta (Version 0.61 beta, 22nd Feb 2009)

Download from the link at the end of the post.

Latest changes:
* Optimistaions to scripts to reduce cpu overhead
* Call for help button
* Many new unconscious camera features including a free cam mode

Many thanks to hoz for his help with the latest 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 here

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.

OFPEC Download  AI_en_revive_test_61e.sara.rar
OFPEC Download  AI_disabled_x_152c.Intro.rar
« Last Edit: 26 Feb 2009, 05:31:41 by hoz »

Offline IGWedge

  • Members
  • *
  • Internal Coordinator @ www.ic-arma.com
    • International Conflict Armed Assault
Re: SQF revive script
« Reply #1 on: 03 Mar 2007, 08:53:09 »
Good job mate

Will test this tonight

Wedge

Offline Fangschuss

  • Members
  • *
    • Forces-of-War
Re: SQF revive script
« Reply #2 on: 03 Mar 2007, 09:49:01 »
moin moin

any update to this fine script ?

greetings

Offline norrin

  • Tutorial Writer
  • **
Re: SQF revive script
« Reply #3 on: 04 Mar 2007, 10:15:37 »
@ Fangschuss  I've been a little distacted with some other scripts I've been working on over the last few days and other than quickly checking that it seems to be working OK in ver 1.05 I haven't looked at it but thanks for the encouragement.

I should start working on it again over the next couple of days first by adding the Spectator script and the fade to black while unconcious and then I'll start working on the AI coming to the rescue bit.

Offline Fangschuss

  • Members
  • *
    • Forces-of-War
Re: SQF revive script
« Reply #4 on: 05 Mar 2007, 00:25:41 »
No hecticness  made  :good:

So far it work's realy great in my missions  :yes:


Quote
I should start working on it again over the next couple of days first by adding the Spectator script and the fade to black while unconcious and then I'll start working on the AI coming to the rescue bit

Sound's great ...can't wait  ;)

Offline pexmo

  • Members
  • *
  • I'm a llama!
Re: SQF revive script
« Reply #5 on: 08 Mar 2007, 08:31:09 »
Downloaded the mission but cant get it unpbo:ed..... just get a empty forlder when i do. Where can i get the scripts etc?

Offline norrin

  • Tutorial Writer
  • **
Re: SQF revive script
« Reply #6 on: 08 Mar 2007, 10:46:19 »
You can download a rar containing the mission files and the scripts from here

Offline pexmo

  • Members
  • *
  • I'm a llama!
Re: SQF revive script
« Reply #7 on: 08 Mar 2007, 14:58:59 »
Super thanks mate!

Offline norrin

  • Tutorial Writer
  • **
Re: SQF revive script
« Reply #8 on: 13 Mar 2007, 01:39:13 »
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 script 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.  Not sure how to remove this body so any suggestions would be greatly appreciated.

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.

Offline norrin

  • Tutorial Writer
  • **
Re: SQF revive script
« Reply #9 on: 14 Mar 2007, 13:15:20 »
Just posted this on the BI forums this new version of the script allows you to specify the number of times the units are revived.

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
Code: [Select]
_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
Code: [Select]
_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

EDIT: Just been told that there is another bug with the script when using it on a local server (ie. hosting and client at the same time) that is the hosting player cannot revive other players.�  Many thanks to HulkingUnicorn for testing this script for me.�  A new version of the script will hopefully be released in the next couple of days.

EDIT (27th March 07) The latest version of this script is available from here (Beta version 27th March 2007) updated initial post.
« Last Edit: 27 Mar 2007, 03:03:40 by norrin »

Offline shameless

  • Members
  • *
Re: SQF revive script
« Reply #10 on: 23 Apr 2007, 20:43:39 »
Hi norrin,

I have manged to get the revive script working, although when i tested it on our dedi server with another member... I shot him and then he got shot by the AI. After that, the mission never ended even though both of us are dead. There are no AI to bring us back aswell.

I have 3 squads... alpha, bravo and delta.

Any ideas?

Offline norrin

  • Tutorial Writer
  • **
Re: SQF revive script
« Reply #11 on: 01 May 2007, 02:53:13 »
Revive SQF

Sorry m8 I've been away and only just seen your post.

Firstly there's a new version available:
revive_010507.intro.zip

Description:
This latest version uses a single script for both players and playable AI units and therefore playable AI units will revive downed team mates if within a four metre radius and if unconscious can be revived as well.

I’ve simplified things by removing the respawn counter that allowed mission builders to specify how many times each unit could be revived as it was causing too many JIP problems.  I’ve also used HAILO’s JIP script to ensure the revive script is run on each joining player.

In addition, I’ve changed the implementation of the revive action so that its always available to the player but it is in the action list (default middle mouse) and will only heal someone if you are within a radius of 4 metres.

If you join on an unconscious player you now join the mission unconscious and will require reviving before you can join the action.  The latest version also allows the joining player to get all the other units states (ie either conscious or unconscious) so there are, as far as I can tell, no desync problems when someone joins.

There is also a short black-out period prior to a player joining a mission with the message “joining mission”.  This allows the JIP player to get all the surrounding units states so he does not witness the unconscious players and himself lying down.  It also activates the camera so if a player joins in an unconscious unit slot they cannot fire and they get a message that they are waiting to be revived.

To implement:
You no longer need the start markers but you still need to place a Respawn_west marker on an island away from the action.  Then just copy across the code from the init.sqf (this includes the code to execute HAILO’s JIP script, you’ll also need to change the playable units names here) and the description.ext.  Then copy across the three folders: revive_sqf, events and scripts (the last two for JIP) to your mission folder.  You’ll also need to change the unit names in the _units array in the onPlayerConnected.sqf file (which you can find in the events folder).

You'll also need to define two arrays at the start of the revive_player.sqf (where it is commented - one with the playable unit names in quotation marks and the other without.

In my example mission the two arrays defined at the start of the revive script look like this:

Code: [Select]
_units = [alpha_1,alpha_2,alpha_3,beta_1,beta_2,beta_3,gamma_1,gamma_2,gamma_3];
_unit_names = ["alpha_1","alpha_2","alpha_3","beta_1","beta_2","beta_3","gamma_1","gamma_2","gamma_3"];

Tested on version 1.05 with JIP

Bugs:

Now for the bugs, for some reason occasionally the "joining mission" screen doesn’t appear when a player joins so if the unit is unconscious the camera doesn’t fire up and he doesn’t get the message he is unconscious and may find himself lying on the ground when he joins. 

I'm still having some problems with players joining on units while the respawn timer is counting down, this has been decreased to 4 seconds to reduce the likelihood of this happening but its still a possibility.  It seems if you join under these conditions there is desync between the exisiting players and the one who joins.  Everyone sees the joining player as unconcious whereas he sees himself as alive. The joining player also gets a null object error if he joins on a dead unit, the only time I've seen it in the current version, so if this happens just go back to the unit selection menu and reselect the same unit and everything will go back into sync again.

If a player joins on an unconscious group leader and is then revived the player draws the units pistol but still shoots out the primary weapon on its back.  I seem to remember reading about this somewhere on the forums but a way around it is once revived respawn and revive again and you should be able to choose the primary weapon properly.

Now to finally answer your question :)

At the moment I haven't got the script set up to end the mission when all the playable units are unconscious. If I get a chance over the next few days I'll try and put something together and post it with the latest version of the script.

EDIT:
Another update with changes to the init.sqf code, camera_follow.sqs, revive_player.sqf, a new trigger placed in the mission editor and a new script "mission_end.sqf".

This new script in combination with the other changes keeps track of the number of concious players and ends the mission if all the players are unconcious.

It can be switched on or off by commenting out the line
Code: [Select]
call{[_units] execVM "revive_sqf\mission_end.sqf"}; in the init.sqf file by placing // at the start of the line ie.
Code: [Select]
//  call{[_units] execVM "revive_sqf\mission_end.sqf"};
The trigger that needs to be added in the editor looks like this in the example mission
Code: [Select]
class Item0
{
position[]={2955.998779,21.107906,2461.976563};
a=1.000000;
b=1.000000;
activationBy="LOGIC";
timeoutMin=10.000000;
timeoutMid=10.000000;
timeoutMax=10.000000;
interruptable=0;
type="END1";
age="UNKNOWN";
expCond="mission_Over";
class Effects
{
track="ATrack8";
titleType="TEXT";
title="Mission Failed - all players are unconcious ";
};

You can get the new version here (ver 010507) or from the link earlier in this post

« Last Edit: 01 May 2007, 16:06:29 by norrin »

Offline norrin

  • Tutorial Writer
  • **
Re: SQF revive script
« Reply #12 on: 02 May 2007, 06:46:27 »
Revive.SQF

Firstly sorry about the double post mods but the last one was getting pretty long winded (even for me :)) and I didn't want the new instructions lost in all the verbage.

New version available: ver 020507

Description
A revive/respawn script in sqf format that allows all playable units to revive other playable units and be revived.  While unconscious a camera is activated that follows the closest alive friendly unit if it is within 100 metres.  In addition, the mission maker has the option of running an additional script that forces the mission to end if all the human players are unconscious.  If you join the mission on a playable unit that is unconscious in game it triggers the camera when you join and you start the mission unconscious and will require reviving before you can move about.   

Changes
I’ve moved from using HAILO’s JIP script (which wasn’t always activating for the joining player) to a variation on a trigger method described by Przemek_kondor to execute the revive_script and the “joining mission” screen when a player joins.  As far as I can tell this new method always works. :)

Now if you join on a unit while its respawn timer is counting down you get the correct message which is “Unit selected is dead please press escape, return to the unit selection menu and choose the same or another playable unit" and as long as you follow these instructions you shouldn’t run into any problems – lol, famous last words :).

I’ve also simplified the implementation of these scripts so now you only need to define the _unit array (ie the playable unit names in quotation marks) in the init.sqf and the onConnect.sqf files.

There also improvements to the follow-cam and I have managed to remove almost all of the null object errors thanks to suggestions from HulkingUnicorn (only one in 3 hours of intensive testing - yippee).

To implement the latest version in your missions.
1. Copy across the text from the init.sqf and the description.ext files into your init.sqf and description.ext files.

2. Copy the folder revive_sqf across to your mission directory.

3. Update the _unit array in the init.sqf and the onConnect.sqf (which you can find in the revive_sqf folder) files where commented to reflect the playable unit names used in your mission (remember to put them in quotation marks like in the example mission).

4.  Create a marker on the map called Respawn_west away from the action – preferably on an island.

5. Create a gamelogic called Server

6. Create two triggers
   For the 1st put -
   Activation: Game Logic – Once
   Timeout: min 10 max 10 med 10
   Type: End #1
   Condition: mission_Over

   For the 2nd put -
   Activation: Game Logic – Repeatedly
   Countdown: min 0 max 0 med 0
   Type: None
   Condition: onConnect
   On Act: call{[] execVM "revive_sqf\onConnect.sqf"};

7. You can toggle the mission_Over.sqf script (which ends the mission if all players are unconscious) on and off by commenting out its activation (ie. using //) in the init.sqf file.

Tested
On version 1.05 on both dedicated and local servers.  Works with JIP.

Bugs
Still occasional problem if you join on an unconscious group leader – you have the pistol in hand but shoot from the rifle on your back, just respawn and get someone to revive you and the bug disappears.
« Last Edit: 03 May 2007, 02:54:22 by norrin »

170th

  • Guest
Re: SQF revive script
« Reply #13 on: 04 May 2007, 13:18:28 »
Is there a way that only the Medic can reviwe the other Players? And the whole script doesnt work on 1.05 beta full of script failures.
« Last Edit: 04 May 2007, 19:34:11 by 170th »

Offline norrin

  • Tutorial Writer
  • **
Re: SQF revive script
« Reply #14 on: 05 May 2007, 02:18:29 »
This was a feature of an earlier version but with all the changes made I've taken it out.  I've now spent an hour trying to reimplement it and its seems there are a few problems.  If I set it up for both human players and playable AI using the "typeOf" command it breaks the ability of Ai to revive other units but as an alternative I can set it up so that all playable AI, no matter what class can revive, but only human players that are medics can revive if you want.

I'm also having some trouble if I use the "isKindOf" command which works well for both playable AI and human players on a local server but for whatever reason doesn't work on a dedicated server (we might have to wait for the next patch and see if this is fixed).

Anyway if you want me to post any of these options let me know.

# removed unnecessary quote - bedges
« Last Edit: 05 May 2007, 10:54:24 by bedges »