Jump to content
Sign in to follow this  
norrin

SQF revive script

Recommended Posts

I'll try out the current version for now then - good luck smile_o.gif

Edit:

Got some problem with it: The ai could revive me and the other players, but we only performed the healing animation over and over again - again: players could not revive neither player nor ai sad_o.gif

Share this post


Link to post
Share on other sites

M8, can you please send me your mission as I've never had the problem you're describing and I'd like to see how you've got it set up so if there is a problem I can fix it.

My email's: norrins_nook@iprimus.com.au

I'm very close now with the revised script all the JIP problems are fixed, even when the player quits while he's a body.

The one remaining problem is that the AI keeping going back to the quit player's body and trys to heal it so I've either got to delete these bodies when a player quits (I only wish I knew how) or deactivate the AI 's ability to auto heal.

Share this post


Link to post
Share on other sites

Mail sendt...

Also, maybe do a check to see if the closest ai has disabled ai (I tested a bit in my home base, where the ai in the watchtowers had ai disabled. Watching those won't help anyone, I guess.

Share this post


Link to post
Share on other sites

As I said in my email when I re-enable the script and turned the respawn back to "base" it seemed to be working OK on both my local and dedicated servers - that's running two instances of the game as well as the dedicated server on my dual core processor so maybe that's why it works on my box.

So to tell you the truth I'm not sure what's happening.

Maybe somebody else knows the answer to this but is there a difference between testing like this on "local" dedicated server to running a dedicated server on a separate box?  

So you don't waste a lot of time maybe you should wait until the new version of the script is finished and try again then or try the  pbo with the changes I've made that I sent.  

Sorry for the hassle m8 and thanks for trying out the script smile_o.gif

PS: From the little I've seen of your mission it looks really good.

Share this post


Link to post
Share on other sites

Well... I just did a test- found two problems. I was HOSTING the mission, that seems to make a difference.

-The ai can heal me and other players.

-Other players can heal me.

-I cannot heal other people. I do the animations repeatedly, but nothing happens sad_o.gif

Once I was shot while doing kneeling down, and ended up on the respawn_west spot, but in complete control. So it seems the host (client and server at the same time) cannot heal people in the current version sad_o.gif

Also, it would be nice to be able to trigger the resurrecting with an action or something - being stuck in the animations in a firefight is a bad situation wink_o.gif

Good luck mate!

Edit: Thx btw - but it will get better!

Share this post


Link to post
Share on other sites
Well... I just did a test- found two problems. I was HOSTING the mission, that seems to make a difference.

-The ai can heal me and other players.

-Other players can heal me.

-I cannot heal other people. I do the animations repeatedly, but nothing happens sad_o.gif

Once I was shot while doing kneeling down, and ended up on the respawn_west spot, but in complete control. So it seems the host (client and server at the same time) cannot heal people in the current version sad_o.gif

Also, it would be nice to be able to trigger the resurrecting with an action or something - being stuck in the animations in a firefight is a bad situation wink_o.gif

Good luck mate!

Edit: Thx btw - but it will get better!

Thanks for the feedback and giving it another try HulkingUnicorn the sort of info you've given me is invaluable. smile_o.gif

Interesting but not good about the bug when hosting a local server as other than quickly trying the script on one I've spent most of the time testing on a dedicated for JIP bugs and I wasn't aware of this bug.  

You're absolutely right about triggering the revive action and I will look into it ASAP.  

Hopefully, I'll have a much improved script for download in the next few days. smile_o.gif

Share this post


Link to post
Share on other sites

Revive Alpha

Dare I say it but I have a new version of this script. It’s still not perfect and needs some testing. So far I’ve tested on a dedicated server but I’m not sure what will happen on a local server or when many players are using these scripts on a dedi.

You can get a rar file containing the new version and a simple mission from here (Updated 25th March 07)

Changes

* The player now has the option to revive when adjacent to a downed player – Moving next to the unconcious unit for a few seconds will bring up a revive action in the player action menu (Default: middle mouse button)

* I’ve removed the automatic move to unconcious player by the playable AI units.

* All of the JIP bugs are gone (fingers crossed).

* There are no longer sheet covered corpses left confusing players when a player leaves the server when unconcious.

*Also a marker appears on the map with the unconcious unit's name so you can locate him

Bugs:

Sometimes the AI do not revive when adjacent to an unconscious player.

To other players when the unconscious player respawns at his body he is momentarily standing prior to falling to the ground unconscious. For the unconscious player himself this is not an issue.

There may be an occasional problem with the camera if two players die at the same time but I have not been able to confirm this (This would be fixed if I change to sqf format for the camera script but although I’ve written one I ‘m having trouble with the exitwith cmd and returning control to the revived player)

The biggest problem is sometimes for some reason the timing of the script goes crazy and your body is not transported to where its meant to be. I don't know for sure but this may be related to delays in calling scripts between client and server. This requires a mission restart. It can occur the first couple of times you load a mission on either a local or dedicated server so if it does just reload the mission and try again (Hopefully fixed 250307)

Things I’ve tried and discarded for the time being.

* Running a single revive.sqf script for both players and playable AI which resulted in a terrible mix of variable states destroying the logic of the script.

* When I ran one version of the revive sqf for the playable AI and a second for the players it placed an enormous strain on my cpu.

* camera scripts in sqf format. I can get the thing to work just can’t get it to stop.

To implement in your own missions.

1. Copy across the text from the description.ext

2. Set up some exec statements in the init.sqs using my init.file as an example.

3. Copy camera.dead.sqs, camera follow.sqs, heal.sqf, revive_AI_heal.sqs and revive_player.sqf to your mission directory.

4. In the revive_player.sqf you can set the number of revives and set up the script for use with a team other than the US. You can find where to change these settings as its marked in the revive_player.sqf file.

5. Place a marker Respawn_west a long way away from the mission area preferably on an island.

6. Place a second marker at the point on the map where the players start called start_west. Any players that then JIP in a dead AI slot or an unconcious player slot will be transported here when joining a map.

PS: Any advice from people more in the know would be much appreciated. smile_o.gif

Share this post


Link to post
Share on other sites

I'll try it out later today, I think wink_o.gif

Some early suggestions:

Line in Revive_player.sqf:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_mrkr = format["%1 is down", _unit];

This would return something like unit1 is down instead of say HulkingUnicorn is down yes (in MP I mean, in the editor I think it works). I always use (name _unit).

Can you post the camera scripts in sqf format (so the pros can see it (not talking about myself here)). I did have some problems with exitWith at first (like the script ignoring it or returning errors).

If I use <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (a == b) exitWith {}; it works ok.

But if I use <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (a == b) then {c = a; exitWith {};}; it doesn't work. As a workaround I used two ifs (exitWith in the latter). Don't know if that was your problem, but let's hope so wink_o.gif

Edited by W0lle
code tags fixed

Share this post


Link to post
Share on other sites

Thanks for the tip on the name function I'll give it a try a bit later.

EDIT: I've finally updated the initial post in the thread to reflect the changes and the current state of the script  

I've hopefully fixed the timing problem but there maybe a bug with the markers not being removed when a player is revived.

Here's the sqf camera script - it hasn't been fully bug and playtested and it was designed to work with an earlier version of the revive script.

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

//**

//** ArmA Script File

//**

//**     camera_follow.sqf

//**

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

//**  Version 1.0

//Script by norrin March 2007

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

//Start camera_follow.sqf

_Object = _this select 0;

_unit = _this select 1;

_pos = position _Object;

_run = true;

//set camera to target body

_camx = getpos _Object select 0;

_camy = getpos _Object select 1;

_camz = getpos _Object select 2;

sleep 4;

_cam = "camera" CamCreate [_camx,_camy+5,_camz+1];

_cam CamSetTarget _Object;

_cam CameraEffect ["INTERNAL","Back"];

_cam CamCommit 0;

titlecut [" ","BLACK IN",1];

sleep 7;

_near_units = nearestObjects [_pos,["soldierWB"],100];

_near_unit = _near_units select 1;

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

{

if (animationState player != "AmovPpneMstpSnonWnonDnon_healed") exitWith

{

titlecut [" ","BLACK IN",2];

_cam CameraEffect ["Terminate","Back"];

CamDestroy _cam;

sleep 2;

};

while {animationState player == "AmovPpneMstpSnonWnonDnon_healed"} do

{

while {alive _near_unit && _pos distance getPos _near_unit <= 100} do

{

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

_cam camsettarget _near_unit;

_cam camsetrelpos [0,-2, 2];

_cam camcommit 2;

sleep 0.2;

};

while {alive _near_unit && _pos distance getPos _near_unit > 100} do

{

_cam CamSetTarget _Object;

_cam CameraEffect ["INTERNAL","Back"];

_cam CamCommit 0;

_near_units = nearestObjects [_pos,["soldierWB"],100];

_near_unit = _near_units select 1;

sleep 0.2;

};

if (_near_unit == objNull) then

{

_cam CamSetTarget _Object;

_cam CameraEffect ["INTERNAL","Back"];

_cam CamCommit 0;

_near_units = nearestObjects [_pos,["soldierWB"],100];

_near_unit = _near_units select 1;

sleep 0.2;

};

if (animationState player != "AmovPpneMstpSnonWnonDnon_healed") exitWith

{

titlecut [" ","BLACK IN",2];

_cam CameraEffect ["Terminate","Back"];

CamDestroy _cam;

sleep 2;

};

};

};

Latest version of revive script is available here (updated 25/03/07) and a couple of posts up.

Edited by W0lle
code tags fixed

Share this post


Link to post
Share on other sites

Another new version of the revive script is available here (updated 25/03/07). I've also updated the links in my last couple of posts as well.

Changes:

*fixed timing bug.

*other players seeing unit standing before falling unconcious (ie. continuity error)

* removed markers as they weren't working correctly

* fixed error when players entered vehicle

* fixed some camera bugs

Share this post


Link to post
Share on other sites

Haven't tried the most recent, but the one before that one wink_o.gif

-Got error when inside vehicle (presumably gone in the new version) and couldn't revive anyone who died inside.

-We seem to respawn with double the ammo/weapons - I even saw two M136 in the action menu! I had to select one of them and then go back to the m16 before I could fire it.

-Revive action popped up even when there was no bodies nearby (happened near ammo crate, don't know if that was the case).

-Consider putting your scripts in a folder - less mess, and easier to know what to copy over (I think you forgot to mention that we need the heal.sqf)  wink_o.gif

Edit:

Just tested the newest version (on dedicated with several players)

- Don't get error when entering vehicles anymore (good).

- If ai soldier dies, and a new player joins the game, he will end up on the respawn marker 'hopping' up and down while lying down (other players will see him as standing)... He can fire his rifle and it looks like its fireing from his back  crazy_o.gif  I'm not sure if a person can be respawned when this happens. The same happens if a player dies and disconnects/returns to lobby.

- When someone dies their body sinks into the ground. Then the person spawns standing, before lying down. The 'dead' will then look up and down at regular intervals (I guess I preferred the bodybag whistle.gif )

- Forgot to check if ai can be revived; was it put back in or not?

Oh, and thanks for removing the need to put group in init file smile_o.gif

Shame about the markers - what was the problem?

Share this post


Link to post
Share on other sites

Argh not good, not good but thanks once again for the info m8.   Sounds like I'm going backwards. banghead.gif

Haven't seen any of these bugs when testing but I have learnt about another bug where if a player is killed while unconcious he respawns at respawn_west on the island and this may be explaining a little of what you are seeing regarding AI hopping up and down etc.

Thought I got rid of the player standing up bug but maybe on a dedicated server with variable pings the timing differences between the client and server are causing this.

Moved away from the body bag version as it was causing many JIP bugs. The dead looking up and down is related to the cycling of the unconcious animation used. I wanted to make a clear difference between players who were dead outright and those who ere unconcious thats why I used this method.

Double weapon bug once again may be related to the timing of the script.

Will look into it tonight.

PS Did you put the script into your own mission or just use mine if you did put it in your own mission could you send it to me so I can see if I can replicate these bugs.  

Share this post


Link to post
Share on other sites

Mission sent.

Btw, it isn't the ai that's hopping up and down - it's the player. From first person you can see your hands almost folded in front of you - it's the lying-down-without-weapons animation. You can turn all you want and fire your gun, but not open map or move anywhere. Also, you do little 'bunnyhops' every few seconds (might be once every second).

I prefer regarding them as braindead, and the soldiers carrying some brand new medicine tounge2.gif

Didn't test this, but do enemies attack the 'bodies'? They are alive I suppose... but you probably used setCaptive tounge2.gif

Share this post


Link to post
Share on other sites

I'm at work and haven't had a chance to play through your mission yet HU but I've checked out your code and I've discovered that I forgot to include one other important thing thats needed when implementing the code in missions and thats to add a marker position where the players first begin the mission called "start_west".

Any players that then join the mission in progress in the place of dead AI or unconcious players should then be transported to the mission start point when joining.

I'm not sure but I'm hoping this will fix many of the problems you are experiencing (I've updated the instructions on implementing the scripts to reflect this see above).

I also think I've found a solution to the add action revive problem that you're seeing and I'll set it up so future versions run from the a dedicated revive folder as you suggested to try and simplify its implementation. At a later stage I'll try and reimplement the markers.

Thanks again for your help m8. If you ever come to Melbourne I'll buy you a beer or three smile_o.gif

Share this post


Link to post
Share on other sites

Hmm... It's better than spawning them on an island, but - when you see my mission you'll understand that it won't really help much sad_o.gif

I know you had trouble with the markers, but what about creating an m_nameOfUnit marker for each playable unit at start (in the bottom left corner of the map and created by the script)? Then setPos the marker to the place where someone dies, and use that marker instead of start_west?

After reviving, the marker will be "put away" again.

It sounds doable at least smile_o.gif

Share this post


Link to post
Share on other sites

Revive beta

Here's version 300,000,00…… (Beta version 27th March 2007)

Changes:

*Improved the continuity between the player being killed, the body disappearing and the unconscious player appearing (hopefully no more standing bugs or disappearing bodies smile_o.gif)

*Fixed revive action bug triggering when unwanted.

*Fixed the ability of the playable AI units to auto heal players when within 4 metres. *I have removed the automatic "doMove" to downed player function for playable AI as I prefer it being left up to the leader of the group to order the AI to a position to revive an unconscious player.

*Fixed the respawn in wrong location bug if player shot while unconscious.

*Re-added the marker for downed players and fixed most of the bugs.

*Fixed a couple more camera bugs.

*Placed the scripts in a folder called revive_sqf and updated their execution so that they would run correctly - hopefully this will ease implementation of these scripts.

*Removed the respawn with weapons code as I couldn't fix the double ammo bug quickly and replaced it with Toadlife's old tried and trusted weapon_Respawn script which I converted to ArmA format some time ago, so now you've got the choice of the players reviving with the loadout they started with (0) or the ones they died with (1). This can be set in the execution code in the init sqs file - see the weapons_respawn.sqs for more details.

*As long as you place the "start_west" marker in the editor there should be no more spawning on the island problems.

Bugs: There's still one marker bug that if a player quits while unconscious his player is down marker is not removed from the maps of all players that continue playing. This is not a problem for people who join after this.

Instructions to implement in your own missions. (Updated 27th March 2007)

1. Copy across the text from the description.ext

2. Set up some exec statements in the init.sqs using my init.file as an example.

3. Copy the revive_sqf folder into your mission directory.

4. In the revive_player.sqf (which can be found in the revive_sqf folder) you can set the number of revives and set up the script for use with teams other than the US. You can find where to change these settings as its marked in the revive_player.sqf file.

5. Place a marker Respawn_west a long way away from the mission area preferably on an island.

6. Place a second marker at the point on the map where the players start called start_west. Any players that then JIP in a dead AI slot or an unconcious player slot will be transported here when joining a map.

@HulkingUnicorn - I played around with a spawn on leader function, rather than spawn at "start_west" but I kept on getting bugs when someone joined in the group leader slot after a previous player had left this position while unconscious so I've stuck with the "start_west" option for the time being. With this method if someone JIPs in the slot of an AI unit that is still alive they will spawn at the current location of the AI unit, if the AI unit is dead they spawn at "start_west".

If this is a problem just update the position of the start_west marker as the mission progresses ie. whenever an objective or a geographical feature has been reached with a trigger and using the setMarkerPos command.

I need a rest from this for a while cause its starting to drive me crazy and I've got some other scripts waiting but I will look at the m_nameOfUnit marker option you suggested sometime in the not too distant future.

Share this post


Link to post
Share on other sites
Quote[/b] ]I need a rest from this for a while cause its starting to drive me crazy*snip*
Dude, I totally get that wink_o.gif

Didn't think of moving that pesky little marker - now it's moved to the operation leaders position periodically.

Something strange happened while testing though:

I entered a mg hummer (after being revived once, having 19 revives remaining), and had someone fire at it with m136... After the blast, I was still sitting inside the burning wreck, and could change positions within it. The other players couldn't see me though, they were looking for my body   tounge2.gif

Thing is, after I stepped out of the vehicle/wreck, I was invincible! The others expended all their ammo trying to kill me  crazy_o.gif

Being hit with an m136 made me soar into the the air and land with a sickening thud a kilometer away - but still standing  rofl.gif

I haven't tried to reproduce this yet, and I don't know if your script has anything to do with it (though I can't see how it could).

Dying while uncounscious did not send me to the island, but enemies will stand shooting at uncounscious enemies until they run out of ammo  confused_o.gif

About that marker thing - I might give it a go, and if it works I'll leave streamlining/integrating it to you wink_o.gif

Two more things:

- When the deathcam is in "follow" mode, it will stop following if the player enters a vehicle - it will focus on the spot where he entered the vehicle and won't return to the body.

- Living people can't see the markers of the dead (is that a feature?)

Share this post


Link to post
Share on other sites

@HU wierd about the dying in Hummer thing as I thought that when a player died in a vehicle their body was automatically ejected by the game but if you weren't either from a game bug or some other reason the revive script would do the things you are describing as it makes the unconcious body immortal so that you cannot be killed until you are revived. It sounds like 'cause of the vehicle bug you missed the unconcious part.  I'll add some code that makes the player eject when dead and it should be fixed.  

Also sounds like I need to setcaptive on the player while he's unconcious as that will stop the enemy attacking him (didn't think of that).  I'll look into the marker thing cause I'm sure when I tested it you could see the death markers of the other players.  Yeah I knew about the vehicle camera but just forgot to fix it I'll get on it shouldn't be too hard now you've reminded me.

Other than these bugs did you feel it was flowing better and on the whole working OK?

PS:  I don't know if you noticed but I've included a big thank you for all your help at the start of the revive_player.sqf script.  smile_o.gif

Share this post


Link to post
Share on other sites

Just for a change a new version is available. (Beta ver 2.0)

Fixes:

*Enemy no longer targets unconcious players

*Players ejected from vehicles if destroyed with a rocket launcher

*Fixed camera bugs.  Now if the unit targeted by the camera gets in a vehicle the camera switches to a behind vehicle view until the unit leaves the vehicle.

Played around with a start_point update every two minutes based on the group leader's position (as long as he wasn't in a vehicle or dead) but it kept locking up the game so I've dropped it for now.  I think its best for the time being to update this position by adding triggers to the map which when crossed or objectives are completed updates the start point's position.

Edit: When I test on a dedicated server both players can see the player is down markers.

Share this post


Link to post
Share on other sites

Did you test to see if they weren't ejected normally? It might just have been a once-in-a-lifetime bug wink_o.gif

After looking at your code I see nothing that should prevent living players from seeing the markers - the other guy might have missed them or something.

Other than the bugs I mentioned in my previous post, it seemed to be running fine smile_o.gif

Edit: Didn't notice my name in the credits before you told me smile_o.gif

Share this post


Link to post
Share on other sites

OK it looks like I've got the spawn on leader working - you will now only spawn at the base when you join in progress if the leader is unconcious so as I've said a couple of times before you may want to progressively update the position of the start marker during your missions.

The new version is available here. (Beta ver 3.0).

All the previous links for the beta version of the script have now been updated.

I'm not that worried about the marker bug for the moment ie. when a player leaves the mission while unconcious it leave a marker on the map showing his position because when a new player joins, is shot and falls unconcious this marker updates to the new unconcious position and its easy to tell which unconcious markers are current as they have green player's bodies over them on the maps.

The only other bug I can find (and its a problem with the weapon respawn and not the revive script) is that in extreme circumstances (ie. if a player joins in the place of player who has quit while the respawn timer is still counting down) then it defaults to the standard weapon load out players normally respawn with.

Share this post


Link to post
Share on other sites

Norrin, outstanding work. I've been trying to implement your script into one of my COOPs.

Coming from a Joint Ops background, having a revive feature was something I was used to and it gives us mission makers another option.

Keep up the great work! notworthy.gif

Share this post


Link to post
Share on other sites

Still gettings some odd results mate... Sometimes markers end up in the bottom-left corner of the map (not sure if the uncouncious person is put there as well, they tend to disconnect at that point banghead.gif ). Haven't tested the respawn on leader thing, as we all died the last time smile_o.gif

I'll send you the mission so you can see if it works for you.

Share this post


Link to post
Share on other sites

I've checked out your misson Hulk and I think there maybe a problem with the way you are defining the groups and its confusing the script (please see my email).

Your mission has highlighted another problem with the script in that if groups have radically different start points, as they do in your mission, if a player joins in a dead AI or unconcious player spot while the group leader is also unconcious or dead he will go back to the start_west point which may be miles away from where that group actually started the mission.  Therefore it might be best to send the start point names for the different groups to the script when its first executed (shouldn't be hard to fix).

EDIT:I’ve now updated the code so that you can send the start point marker name to the script for different groups that start at different points on the map.

For each group you will now need a separate execution line in the init.sqs file.

For instance if I have two BLUFOR groups, alpha and beta, that start at different points on the map I would place start markers at the original mission start points for each group called “start_alpha†and “start_beta†and then place this code in the 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 =[alpha_1,alpha_2,alpha_3,alpha_4];

{if(isplayer _x)then {s = [_x, "start_alpha"] execVM "revive_sqf\revive_player.sqf"};} forEach _units_alpha;

_units_beta =[beta_1, beta_2, beta_3];

{if(isplayer _x)then {s = [_x, "start_beta"] execVM "revive_sqf\revive_player.sqf"};} forEach _units_beta;

Beta ver 3.0b (Previous beta links also updated)

Edited by W0lle
code tags fixed

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  

×