Advertisement

Author Topic: Revive Script  (Read 13603 times)

0 Members and 1 Guest are viewing this topic.

Offline norrin

  • Tutorial Writer
  • **
Revive Script
« on: 14 Jun 2009, 11:34:25 »
Revive Beta

ArmA2 revive (corresponds to the old AI_enabled scripts) - it can be used with the AI_enabled or disabled:

http://www.norrin.org/downloads/ArmA2/revive/AI_enabled/Revive_TEST_042.utes.rar (v0.42 - 110110)

Added compatibility option in revive_init.sqf for ACE2 rucks

Full implementation notes and explanation of features are now contained in a pdf file included in the download but you can also check here: http://www.ofpec.com/tutorials/index.php?action=show&id=125&page=132

A couple of other things:
1. interface size must be set to normal otherwise the dialog formats freak out.
2. Kegetys spectator script needs updating so it might cause a popup when you run out of lives and die.
3. I've completely rearranged the revive_init - all the old settings are there I've just tried to re-order them to be make it more logical.
4. You'll also notice plenty of variables that are not implemented yet - they are just placeholders until I can get some more features sorted - I'm hoping I won't have to change the revive_init in future so all you'll have to do is swap the revive_sqf in your mission folder.
5. You need to have the new health system disabled ie. remove any health game logics as these cause respawning units to be immortal once they respawn - unfortunate game bug that I'm hoping will be fixed:http://forums.bistudio.com/showthrea...hlight=respawn

One final thing is that please only use these scripts for the time being if you have had experience with them in the past as at the moment I'm very busy trying to get the AI disabled scripts done (amongst other things) so I don't really have the time to help you to get these scripts implemented in your missions - sorry bout this but hopefully its only temporary.

If you get a chance please let me know what bugs you come across.

PS: Thanks to vengeance1 for his testing over the week-end :)
« Last Edit: 11 Jan 2010, 00:53:57 by norrin »

Offline monty67t

  • Members
  • *
Re: Revive Script
« Reply #1 on: 14 Jun 2009, 20:45:09 »
The download link isn't working.

Offline norrin

  • Tutorial Writer
  • **
Re: Revive Script
« Reply #2 on: 15 Jun 2009, 03:11:03 »
Seems OK here.  Maybe the server was down when you tried, either way I've added the script to the bottom of the first post.  Also just to let you know I've got some bug fixes on the way including create gamelogic error, not defined NORRN_pos_x, adding double maps etc - will test when I get home tonight and post if they are OK.

EDIT: Script updated see first post for download.
« Last Edit: 15 Jun 2009, 14:34:48 by norrin »

Offline loki72

  • Former Staff
  • ****
    • Loki's Nightmare
Re: Revive Script
« Reply #3 on: 15 Jun 2009, 20:36:51 »
very glad to see this norrin

 :good:

Offline norrin

  • Tutorial Writer
  • **
Re: Revive Script
« Reply #4 on: 18 Jun 2009, 02:04:23 »
Revive Script Update (18th June 2009)

Please only use these scripts if you are familiar with it and can tolerate a few bugs.
Down load
http://www.norrin.org/downloads/ArmA2/revive/AI_enabled/ArmA2_revive01f.utes.rar

Possible fixes
* Multiple appearance of drag and revive options
* Drag action not working when using a secondary item - note if you attempt to drag while using a launcher (eg M136) you'll assume the drag position but won't be able to move until you switch to your primary weapon
* When all lives are expended the scripts now deal with death properly - for the time being you can't use Kegetys' Spectator cam as it causes a crash to desktop so make sure you leave _kegetys_spectator set to 0 - I'll start work on my own simpler spectator cam for death.
* Respawn at base without weapons - added a 2 second wait before these are defined so if you are giving units an alternate load-out at mission start please make sure it occurs quickly after mission initialisation

Known Issues
* Dialog errors in ArmA2 report resulting from respawn buttons.
* Bug whereby the map dialog is not moving to possible respawn points (not sure what's causing this but it may result from disableserialisation).
* Report error relating to name of dead unit - you'll have to live with this I'm afraid as I haven't found another solution for this yet
* Reported problem with the mobile respawn tent disappearing - I haven't been able to replicate this bug yet so please let me know if you come across it and let me know what happened prior to it occurring

Please let me know if you are still having issues with any of the proposed fixes

Other Issues
* There's a few new variables in the revive_init.sqf - sorry about this but if as MC suggests I should try to make a one script fits all situations solution then this was necessary
New variables in revive_init.sqf
_kegetys_spectator = 0;
also
Code: [Select]
// OPTIONS FOR PLAYER'S DEAD BODIES AND EQUIPMENT - Additional revive functions with many thanks to alef (0 - off, 1 - on except for _bury_timeout)
_drop_weapons = 1; //array no.93  - should the respawned player drop his weapons where he died?
_cadaver         = 0; //array no.94 - should the respawned player's body remain there?
_bury_timeout = 12; //array no.95 - if drop weapons OR player body, how long before the body is buried?
// 0=maximum (1200s) , n=seconds up to 1200s (hard coded)
* Ran a quick test blowing up 4 AI in a Hummer without lag (constant 40-45 FPS).  That being said these scripts are quite complicated and if you have too many playable AI enabled there is a possibility they will cause lag.

New Features
* You can now drag unconscious units to vehicles with empty cargo spaces and load them onboard, once they are loaded you can unload them - as this is new if you try it let me know how you get on.
* PDF file containing implementation notes and explanation of features

Finally, many thanks to all of you for testing :)

Offline norrin

  • Tutorial Writer
  • **
Re: Revive Script
« Reply #5 on: 23 Jun 2009, 08:10:25 »
Revive Update (version 0.2b - Updated 240609)

I'm very sorry but the revive_init.sqf has been changed again as new options have been added that I hadn't envisaged, these are: _medic_stable, _unit_stable, _reward_function, _revives_required, _team_kill_function, _no_team_kills

Download
http://norrin.org/downloads/ArmA2/revive/AI_enabled/ArmA2_revive02b.utes.rar

Fixes
* Fixed the "You're dead" dialog zooming on respawn points
* Hopefully, fixed lag when many players are unconscious
* Fixed loading wounded action on a dedicated server
* The long unconscious camera panning that was causing crashes has been removed

New features
* unconscious_drag/carry - players can drag and carry the bodies of unconscious players and playable AI - units must be dragged before the carry action appears
* load_wounded - unconscious units can be loaded/unloaded onto vehicles with empty cargo space - units can only be loaded if they are being dragged (not carried)
* CASEVAC  - units can be taken to a hospital etc to be revived, needs to be an array eg.
  • not used or [1, ["MASH"]]; the second internal array ["MASH"] represents the type of object at which you'd like the units to automatically revive, note: you can put a list of objects here.

* deadSpectator_cam - whether the screen turns black or a unit can spectate other friendly units when it has run out of lives - currently using a simple spectator script (see readMe for more details).
* _medic_1 - allows you to specify an additional class which can have more medpacks or bandages than the standard unit. Can only be used in conjunction with medpacks and bleeding.  
* medpacks - give units a limited number of revive kits
*bleeding - make units bleed and require bandages
medic_medpacks - no of medpacks for units specified in the _medic variables - they are required for reviving units         
* unit_medpacks - no of medpacks for units specified in the _can_revive variables - they are required for reviving units
* medic_bandages - no of bandages for units specified in the _medic var - bandages stop bleeding
* unit_bandages - no of bandages for units specified in the _can_revive var
Note: Resupply of medical items can be obtained by players by going up to a MASH tent and using the "Take medical supplies" action.  Playable AI are automatically resupplied if they are within 5 metres of a MASH tent.  Also for the time being playable AI do not bandage themselves so you'll have to take care of them
* reward_function - whether a unit receives bonus lives for reviving other units
* revives_required - number of revives required before receiving a bonus life
* team_kill_function - specify whether a unit loses a life for killing team mates
* no_team_kills - number of team kills before punishment

New Issues
* The unconscious camera is jerky when spectating other players on a dedicated server - currently looking into ways to fix this
« Last Edit: 24 Jun 2009, 14:57:26 by norrin »

Offline norrin

  • Tutorial Writer
  • **
Re: Revive Script
« Reply #6 on: 29 Jun 2009, 04:00:27 »
Revive Script Update (version 0.2c)

Download
http://norrin.org/downloads/ArmA2/revive/AI_enabled/ArmA2_revive02c.utes.rar

Fixes
* Camera changing issues between 1st and 3rd person
* JIP issues
* Fixed issue with Leader JIP while AI units unconscious
* Fixed mission end function - NB: this function only detects players so when it is enabled even if there are conscious AI team mates if all players are down the mission

ends.

New features
_JIP_respawns   
Two element array
1st element in array - 0 - off or the number of lives players receive when they join in progress,
2nd element of array - JIP time after the mission starts
eg1. [0,0] Off
eg2. [2,30] Players JIP with 2 lives if they JIP 30 seconds after the mission starts

_chance_ofDeath
Two element array
1st element in array - switches off/on (0/1) chance of death when shot, increases dues to hit location and number of times revived
2nd element of array - switches on/off the decreasing respawn timer based on how many times you have been revived, if using set respawn-time to at least 300 seconds.
eg1. [0,0] Off
eg2. [1,1] both options on

Code for chance of death
Code: [Select]

        case "": {_respawn_chance = 500};
case "hands": {_respawn_chance = 200};
case "legs":   {_respawn_chance = 70};
case "body":   {_respawn_chance = 50};
case "head_hit": {_respawn_chance = 20};
};
if (_respawns == 2) then {_respawn_chance = (_respawn_chance/2)};
if (_respawns == 3) then {_respawn_chance = (_respawn_chance/3)};
if (_respawns == 4) then {_respawn_chance = (_respawn_chance/4)};
if (_respawns == 5) then {_respawn_chance = (_respawn_chance/5)};
Code for respawn time
Code: [Select]
switch (_body getVariable "NORRN_body_part") do
{
case "": {_revive_time_limit = _revive_time_limit};
case "hands": {_revive_time_limit = _revive_time_limit};
case "legs":   {_revive_time_limit = (_revive_time_limit * 4)/5};
case "body":   {_revive_time_limit = (_revive_time_limit * 3)/5};
case "head_hit": {_revive_time_limit = (_revive_time_limit * 2)/5};
};
if (_respawns == 2) then {_revive_time_limit = (_revive_time_limit/2)};
if (_respawns == 3) then {_revive_time_limit = (_revive_time_limit/3)};
if (_respawns == 4) then {_revive_time_limit = (_revive_time_limit/4)};
if (_respawns == 5) then {_revive_time_limit = (_revive_time_limit/5)};

NB: This may need a little tweaking

_respawnAtBaseWait         
Two element array
1st element in array - if = 1 makes players that respawn at base wait for (parameter 2) seconds before being able to see surroundings  
2nd element of array - the number of seconds that players are forced to wait if they respawn at base
eg1. [0,0] Off
eg2. [1,10] When players respawn at base they have to wait 10 seconds until they can see and move about.

Other notes
If you press escape while in the spectator cam you'll see the players body from a slightly different view - to get the game menu to quit the mission etc press escape a second time.

Many thanks to my daughter Olivia for helping me test the script :)
« Last Edit: 29 Jun 2009, 04:02:14 by norrin »

Offline norrin

  • Tutorial Writer
  • **
Re: Revive Script
« Reply #7 on: 04 Jul 2009, 01:35:52 »
Revive Script Update (Version 0.2e)

Download
http://norrin.org/downloads/ArmA2/revive/AI_enabled/Revive_02e.Chernarus.rar

New Features
* Added several of the new healing and wounded animations from ArmA2 as per Bravo6's request, set _altUnc_animation = 1 in the revive_init.sqf to use the new animations. To use the "classic" revive animations set it to 0. NB: the new healing animations currently only work for players ie. AI will use the "classic" animations when healing. Also because of the new animations players will only get the revive action when they are within 2 metres of an unconscious unit not 4 metres as in previous versions.

* Added an option so that revive missions can be played without the revive scripts enabled. To do this make sure _max_respawns is set to 2000 in the revive_init.sqf. You can do this using param2 in the description.ext for instance. If this option is enabled, when the players and playable AI units die they will either get the all dead respawn dialog and have a choice of which free respawn point to spawn at or they will automatically respawn at the nearest free respawn point as per the settings in _respawn_position variable in the revive_init.sqf. In addition, if a time greater than zero is set in the second parameter of the _respawnAtBaseWait array then players will get a black window with a respawn timer for this length of time and playable AI's movement will disabled for this period of time when they respawn. NB: To work you must have at least one spawn point named in the revive_init.sqf other than mobile.

Fixes
* In this release there are several fixes to the revive cam, which hopefully fix the camera lock-up while spectating a unit that is shot (as described by SnR, gonza and VanhA) and also fixed the all dead dialog not appearing.

* Removed some superfluous variables from the revive_player.sqf

* Removed dialog blink buttons from unconscious camera, rationalised variable usage

* Fix for load units on vehicle

* Added fixes for call for help function

If you are already using revive 0.2c then all you need to do is replace the revive_sqf folder in your mission with the new one in the rar file

Offline Kremator

  • Members
  • *
Re: Revive Script
« Reply #8 on: 04 Jul 2009, 11:19:43 »
norrin,

This is great to see mate .... testing it now.

Will feedback what I find.

[TAO] Kremator

Offline norrin

  • Tutorial Writer
  • **
Re: Revive Script
« Reply #9 on: 05 Jul 2009, 12:59:08 »
Revive Script Update (version 0.2f)

Download
http://norrin.org/downloads/ArmA2/revive/AI_enabled/Revive_02f.utes.rar

NBIf you are already using a revive script version of 0.2c or above just replace the revive_sqf folder in your mission with the one in the rar file.

Fixes:
*Replaced a called function with a spawned function to prevent the revive_player.sqf from locking up, this may have been causing players to respawn at  respawn_west
*Tidied up the new revive animation

New Features
You can now respawn on the carrier or in a chopper using the following method:
1.   Copy the respawnSpecial folder into your mission file
2.   IN the revive_init.sqf on the line NORRNCustomExec3 put
Code: [Select]
NORRNCustomExec3 ="[_name,'USS Khe Sanh','chopper']execVm 'respawnSpecial\respawnSpecial.sqf'"; where: 'USS Khe Sanh' and 'chopper' are the names of the respawn points.
3.    Create an APC on the USS Khe Sanh, name it Respawn_Carrier in the editor.  In the init line of the APC put:
Code: [Select]
this setPosASL [(getposASL this select 0), (getposASL this select 1), 15.90].  Also create a marker near the Khe Sanh and call it "USS Khe Sanh".
4.   Create a chopper with cargo positions on the map and name it Respawn_Chopper in the editor.  In the init line of the chopper put
Code: [Select]
nul = [this] execVM "respawnSpecial\Spawn_chopperInit.sqf";5.   Underneath the chopper create a marker called "Chopper";

The chopper is placed at 1000 metres above the land.  AI units will automatically eject and use standard parachutes.  This way the AI units will land near the marker and I thought this was preferable to them ending up thousands of metres away or in the ocean.  Players will HALO when they eject.

When players respawn at the boat they will need to eject/get out of the APC to gain access to the deck.  Playable AI units auto eject the APC but unfortunately they cannot move across the deck of the carrier so its probably best to only use this option for playable units.

NB:[/] These scripts can be adapted for extra chopper spawn points etc.

Offline Kremator

  • Members
  • *
Re: Revive Script
« Reply #10 on: 05 Jul 2009, 21:21:52 »
norrin,

Been testing the scripts and they are very good.  However I have found that if I send the AI over to the fallen comrade sometimes they do NOT revive them.

Is there a way that I can force the fallen to call for help from a close AI ?

The chopper respawn is great - although it's a little annoying to have the rotor sound all mission - any solutions ?

[TAO] Kremator


Offline norrin

  • Tutorial Writer
  • **
Re: Revive Script
« Reply #11 on: 06 Jul 2009, 04:40:22 »
Not sure if there's much I can do about the rotor sound - maybe put the chopper up a bit higher - in the spawn_chopper_init.sqf (in the respawnSpecial folder) on line 10 change the 1000 to a 2000 or higher - just remember that any playable AI that use this respawn point are going to take a lot longer to reach the ground.  I could make the units just spawn in air but I like the idea that if all the players respawn together they can sit in the chopper and discuss tactics and wait for each other before they HALO as a group.

As for your AI team mates not reviving are you using the medpacks option by any chance as they may not have a medpack to allow them to revive.  Something else you could try would be to enable the _goto_revive option in the revive_init.sqf that way AI units will automatically moveTo downed comrades if they have a medpack available.
« Last Edit: 06 Jul 2009, 04:42:20 by norrin »

Offline loki72

  • Former Staff
  • ****
    • Loki's Nightmare
Re: Revive Script
« Reply #12 on: 06 Jul 2009, 23:28:42 »
howdy...

just spent a while reading the .pdf.. very nice b.t.w....

but it says the mobile respawn should be named: "r_mobile_spawn_vcl"

no addaction appears.. but when i names it "mobile" it worked?

Code: [Select]
_Base_1 = "Mobile"; //array no.13 - spawn position names  
_Base_2 = "Insertion"; //array no.14
_Base_3 = ""; //array no.15
_Base_4 = ""; //array no.16
_Base_free_respawn = [0,1,0,0]; //array no.36 - select whether to allow respawning at spawn points even if enemy troops are present (options OFF = 0, ON = 1)
_respawn_at_base_addWeapons = 1; //array no.11 - unit respawns with waepons it commenced the mission with  
_respawn_at_base_magazines = []; //array no.34 - If using the respawn_at_base_addWeapons option then place the magazine and weapon
_respawn_at_base_weapons = []; //array no.35   types in the following arrays, if left blank respawns with weapons from mission start
_respawn_position = 2; //array no.28 - 0 - respawn at base_1; 1 -  the closest enemy free respawn point; 2 - players choice; and 3 -  dies
_respawnAtBaseWait = [0,0]; //array no.68 - Two parameters: 1st if = 1 makes players that respawn at base wait for (parameter 2) seconds before being able to see surroundings  
_objectiveBasedRP = []; //array no.69 - NOT IMPLEMENTED
// Mobile Spawn Settings
_mobile_spawn = 1; //array no.51 - set to 1 if you want to use mobile spawn
_mobile_base_start = "base"; //array no.52


any thoughts?

edit... i just changed the name in the init.sqf to "r_mobile_spawn_vcl" and all is well..

so in the .pdf.. the line that says

base_1 = mobile....

should say

base_1 = r_mobile_spawn_vcl

 :good:
« Last Edit: 06 Jul 2009, 23:35:57 by loki72 »

Offline Kremator

  • Members
  • *
Re: Revive Script
« Reply #13 on: 06 Jul 2009, 23:49:14 »
Regarding the HALO is it possible to just have a quiet object that immediately kicks you out on respawn instead of a chopper ?

Loving the scripts - will change the goto revive function.

Cheers mate!

Offline norrin

  • Tutorial Writer
  • **
Re: Revive Script
« Reply #14 on: 07 Jul 2009, 02:53:25 »
co5 Deep in the Woods

Here's a very simple revive mission that is designed so that players that are new to the revive script can try it out under combat conditions.

Download
http://www.norrin.org/downloads/ArmA2/revive/AI_enabled/missions/Deep_in_the_Woods_02h.Chernarus.pbo (updated to version 0.2h on the 080709)



Background
As a result of our previous raids on Russian forces, several days ago a small Russian garrison was stationed in the nearby village of Myshkino to train local insurgents in their fight against CDF and US forces.  This garrison represents a clear and present danger to our activities in this area and it must be destroyed at all costs.

Objective
Proceed through the forest west of Myshkino and clear the village of hostile forces.

Intelligence
We have had reports from locals friendly to our cause that enemy forces are patrolling the woods in an attempt to locate our FOB and weapon cache

Other notes
* The mission is designed to be played by a single player on a multiplayer server with the AI enabled or with a couple of mates with AI enabled or disabled.  Make sure you have the grass enabled its meant to be hard to spot your enemies!  

* When you are unconscious you can use the A/D keys to switch your view to other team members and W/S changes the camera type

* If the are AI enabled don't forget that pressing the key H will make them come to your position to revive you if they have a medpack available - also if unconscious it is sometimes better to let the other team members finish the contact before calling for help

* Playable units receive 2 medpacks and 3 bandages whereas the medic carries 5 of each.  Med supplies are replenishable from the MASH tent at mission start.  There's also some ammo crates under the netting that have basic US and soviet weapons.  

* In this mission never forget to check your six!

@Loki - Sorry for the confusion mate - but could you also post the next 5 or six lines of code from the revive_init.sqf that are directly underneath the ones you've posted as I have a feeling that your set up is not quite right
  
@Kremator - I'll have to think about a solution for the HALO - I quite like it the way it is but I understand that the chopper noise is annoying.

EDIT

Revive Script Update 0.2i

I've finally found a fix for the dialog bugs that cause the massive report logs.  ViperMaul actually told me how to fix these some weeks back but in my infinite stupidity its taken me some weeks to sink in and for me to process what he was saying - bloody inheritance bane of my life.

Download
Test Script: http://www.norrin.org/downloads/ArmA2/revive/AI_enabled/Revive_TEST_02i.utes.rar

Important
If you are updating an older mission (post 0.2c) with this version of the script you will need to replace the revive_sqf with the one in the rar file.  In addition, you need to update your description.ext file.
In the description.ext:
1. Make sure you change the respawnDelay to 4 seconds eg.
Code: [Select]
respawndelay = 4;2. Make sure you include the revive resources in the following order
Code: [Select]
#include "revive_sqf\dialogs\config.cpp"
#include "revive_sqf\dialogs\define.hpp"
#include "revive_sqf\dialogs\rev_cam_dialog.hpp"
#include "revive_sqf\dialogs\respawn_button_1.hpp"
#include "revive_sqf\dialogs\respawn_button_2.hpp"
#include "revive_sqf\dialogs\respawn_button_3.hpp"
#include "revive_sqf\dialogs\respawn_button_4.hpp"
#include "revive_sqf\dialogs\respawn_button_1b.hpp"
#include "revive_sqf\dialogs\respawn_button_1c.hpp"
#include "revive_sqf\dialogs\respawn_button_2b.hpp"
#include "revive_sqf\dialogs\respawn_button_3b.hpp"
#include "revive_sqf\dialogs\respawn_button_4b.hpp"
#include "revive_sqf\dialogs\respawn_button_1map.hpp"
#include "revive_sqf\dialogs\respawn_button_2map.hpp"
#include "revive_sqf\dialogs\respawn_button_3map.hpp"
#include "revive_sqf\dialogs\respawn_button_4map.hpp"
#include "revive_sqf\dialogs\OK_map.hpp"
#include "revive_sqf\dialogs\dead_cam_dialog.hpp"
If you don't do this then you're going to get dialog errors and the game may crash to desktop.

Fixes
* Dialog bugs - all gone yippee !
* I've also changed some code around in an attempt to fix the camera lock-up that happens very occasionally and relates to a break down in the transfer of some global variables relating to the unconscious unit's position.
* A couple of fixes to the dead spectator cam (its still not perfect but it'll get there eventually).

Acknowledgements
I must send a special word of thanks to Z-Special Unit whose bug reports from large multiplayer games have been invaluable ( http://www.zspecialunit.org/forums/ ) - next time I update the readMe guys I'll make sure you are included in the acknowledgements.

Other Notes
I can confirm errors like
Code: [Select]
Error: cannot load sound 'ca\dubbing\global\radio\female01\cz\veli.wss', header cannot be loaded. relate to the ambient civilian module and not the revive scripts.
« Last Edit: 12 Jul 2009, 12:42:54 by norrin »