Jump to content
Sign in to follow this  
norrin

SQF revive script

Recommended Posts

THX

I hope i can test it in the evening

Share this post


Link to post
Share on other sites

@Hulk, I think I may have found whats cauing the disappearing units. Due to a mistake in my coding the invincibility that was meant to be toggled on unconcious units did not work so the unconcious units could be killed and were therefore transported to Respawn_west never to return (a bit like pressing the respawn while unconcious bug).

Therefore you need to change the code in the respawn_player.sqf from<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _name addeventhandler ["hit", {_name setdamage 0}];

_name addeventhandler ["dammaged", {_name setdamage 0}]; to this <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_name addeventhandler ["hit", {_this select 0 setdamage 0}];

_name addeventhandler ["dammaged", {_this select 0 setdamage 0}];

I've updated the version 020507 you can currently download to include these changes and a new version using the new code is on its way. Note: this change is already incorporated into the AI_disabled scripts.

@MCPXXL - I've thought of a way to fix the pressing respawn while unconcious bug and will hopefully have a revised version later today.

Edited by W0lle

Share this post


Link to post
Share on other sites

Hmm, not sure if it is the solution to what I experienced. The ai "fell" out of the stryker, died and disappeared more or less instantly, as far as I can tell.

The mapmarker with unit down didn't appear at all, which might suggest that the event handler didn't get added either.

The only lead I have is that it mostly seems to happen around the stryker - jumping out at high speed or being run over when it reverses.

I'll replace the lines however, and we'll see if it has any effect - we didn't have any problems a couple of days ago though. I can't test it for now, though. We're trying to complete a huge mission, and it's kinda slow with 4-6 of us wink_o.gif

It helps to use the persistent = 1 in the server config though, so we can break it down into manageable chunks.

I though of one thing though - you could set marker text to the units name in the loop where you play the uncounscious animation - that way if a player disconnects, the name will be set to the ai's name instead, and if a new player joins his name will be used.

Share this post


Link to post
Share on other sites

Now i could test the new Version with NO AI

We do not have scalar bol and can heal

But now we have two Probs

1.) When you die on an obeject u often lie under it and cannot get out ...not a big prob

2.) When you are waiting to get revieved the las animation is done again and again and additional you can shoot between if you are fast enough.

I changed the soldiernames for _unit in the init.sqs

_units = ["w_1","w_2","w_3","w_4","w_5","w_6

","w_7","w_8","w_9","w_10"];

and additional in connected.sqf and onconnect.sqf

End Mission was done when all players are died at the same time

Edited by W0lle

Share this post


Link to post
Share on other sites

Dying on an object and being put below... I read somewhere it had to do with getpos checking for nearest surface while setpos measures from the ground up. In that topic modelToWorld was suggested as a fix.

It may be particurarly troublesome if it happens on a brigde above water (or an AP minefield biggrin_o.gif )

About issue two: Are you in first person view while waiting to get revived? Because AFAIK you can't move/shoot while the camera is active.

Share this post


Link to post
Share on other sites

Firstly, thanks for your patience guys and helping me to get all the bugs sorted. If I realised when I started this how hard and life consuming it was going to be I probably would have thrown in the towel a long time a go, but your patience, enthusiasm and help have really made it all worth while and I think I can finally see the light at the end of the tunnel - just hope its not an on coming train smile_o.gif.

@MCPXXL, thanks for letting me know m8 as I wasn't aware of the the disappearing inside an object bug cause I have to admit I've never tested respawn on a building before.

I'll try using the modeltoWorld command as HulkingUnicorn suggested when I get home tonight and if it works I'll post an interim fix. As for the other bug once you fall unconcious the follow_camera should start and you shouldn't be able to move or fire, so I'm not sure whats happening there as I haven't seen this in testing.

Could you please post a link to your mission or email it to me at norrin@iprimus.com.au so I can check through your code to make sure you've got the respawn scripts set up correctly and if you do I can then try and replicate the bug and hopefully find a fix.

@Hulk, thanks once again for your suggestions m8 I'll get on it tonight smile_o.gif

By the way I'm in the process of making a fundamental change to the way the script works and thats by using the "instant" respawn type rather than "base" and so far so good. Setting it up this way gets rid of the pressing respawn bug while unconcious and should make it impossible for any units to disappear (unless its coded). It still needs some testing though and I need to fix the spawn in object bug. If this new version is stable I'll then try to re-introduce the respawn counter and with the stuff I've learnt along the way it should be much easier next time.

Share this post


Link to post
Share on other sites

ok Norrin i will create a testmission with this things in it because there are a lot of others in it.

Additional i have to say that it was a editor placed "dirthill ?"

We could move a little for about 1-2 seconds but then beamed into lying reloading anim.

But in this time you could shoot.

Share this post


Link to post
Share on other sites

good luck norrin, hope you get the bugs fixed.. looking forward to getting it to work

Share this post


Link to post
Share on other sites

Here’s a zip file containing the latest version of the revive script for use with the playable AI enabled and number of example mission folders. As I said previously I’ve now switched from the “base†respawn mode to the “instant†mode and this seems to have fixed quite a number of problems.

Revive_all.zip

Missions included: the original, units on bridge and units near enterable buildings.

Bugs fixed

1. I don’t recommend you go out of your way to see if you can break this but you can now press respawn multiple times while unconscious and it does not break the script. On rare occasions you might confuse the camera to the point that it doesn’t work but you still will find yourself unconscious and need reviving.

2. The instant respawn mode also allows you to be revived on bridges. In the previous version of the script you would fall through and end up unconscious in the water.

3. In the previous version if you died on a the roof of a small building you’d fall through the floor and sometimes into a space where you couldn’t be reached because it was not enterable. Therefore you could not be revived. Using the instant respawn mode it re-positions your body outside the building on the ground (I seem to remember that PRiMe’s original OFP revive script also did something similar). In larger buildings with multiple floors that you can enter as far as I can tell you respawn pretty much where you died .ie on the same floor.

Changes to implementation

It’s probably safer to replace all the files you are currently using with the ones in the zip file as changes have been made to most of the scripts. Then just follow the previous version implementation guide.

Bugs

I’m assuming it’s the built in collision detection code in ArmA (so a bit beyond my control) but sometimes your unconscious body will appear slightly away from where you actually died.

What’s next

I’ll update the disabled AI code with these changes and then I’ll try and re-enable the respawn counter.

@Geriec thanks m8. smile_o.gif

Share this post


Link to post
Share on other sites

Here's the new revive_AI_disabled files.

revive_AI_disabled.zip

In the zip file are two folders one with the scripts for revive_AI_disabled (all players can revive) and the second revive_AI_disabled_medic (only medics can revive).

These were alot easier to convert than I first thought so hence I'm releasing them earlier than expected. Implementation is the same as the previous versions of AI disabled scripts. See the previous post for bug fixes as they're the same as for the AI enabled version.

Bugs: its still possible to cause a null object error if you die and then quit the server while the respawn counter is counting down. Since the respawn time is set to 2 seconds is pretty hard to do this unless you are deliberately trying.

Share this post


Link to post
Share on other sites

Norrin, your getting close buddy!

I did find a problem with the previous (disabled AI, everyone revives) version and since it's not logged as a fix I will assume it escaped you?

The problem I had was that when someone was shot, they wouldn't go to "spectate mode", they would be stuck in a looped change weapon animation mode until someone could come over and revive. This is happening with my 1.06 US version. I'll try the latest version and give feedback as allways.  smile_o.gif

Share this post


Link to post
Share on other sites

@EvilNate and MCPXXL

It really sounds like the camera is not activating when a player falls unconcious. Make sure you copy across all the files from the latest version of the script cause I made some changes to the way the camera worked a little while ago and this may be causing what you 're seeing. If its still a problem send me your mission and I'll track down what's going wrong.

Thanks guys smile_o.gif

PS: This has only been tested on version 1.05 so maybe that's part of the problem.

Share this post


Link to post
Share on other sites

Mostly ok with the new version, but:

- Became invincible again, not sure when it happened

- Got stuck with the constant weapon-fiddling state EvilNate described

- Became seagull after joining on a dead ai (possibly a vanished one, not sure)

Edit: These were one-time happenings, other than those I didn't see a single bug for hours wink_o.gif

Share this post


Link to post
Share on other sites

AI Disabled Revive.SQF (with respawn counter)

Get the latest zip file from here: AI_disabled_revive_scripts

The zip file contains 3 versions

AI_disabled_west - test mission and version of the script for western forces

AI_disabled_GB - test mission and version of the script for independent forces

AI_disabled_medic  - test mission and version of the script for western forces, medics only can revive

Changes

Implemented a respawn counter that if reached results in the player’s unit dying out right and which requires the player to go back to the unit selection menu and rejoin the mission at the mission start point.  The number of revives available before a unit dies can be set in line 45 of the revive_player.sqf that can be found in the revive_sqf folder (currently set at 1 for testing purposes).

I’ve also made it simpler to convert the scripts for use with other sides.  Just change the entries at lines 41 and 42 of the revive_player.sqf.  

NB: at this time you can only use the medic only version if wish to specify that only a single unit type can revive.  For the more general version of these new scripts (eg. AI_disabled_west) just put the generic soldier class for whatever side you wish to use (eg. soldierWB or soldierEB) in both lines.  I’ve had to do this as there are some problems with the ‘typeOf’ and ‘isKindOf’ commands that if fixed will allow a more generic script to be created.

Implementation

NB: Please make sure you use the latest versions of all the files as changes have been made to quite a few of the original scripts

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 respawn_counter.sqf, connected.sqf and the onConnect.sqf files (which you can find in the revive_sqf folder) 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 Boot_Hill away from the action for the dead units – preferably on an island.

5. Create a gamelogic called Server

6. Create four triggers in the editor

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"};

For the third –

Activation: Game Logic – Repeatedly

Countdown: min 0 max 0 med 0

Type: None

Condition: connected

On Act: call{[] execVM "revive_sqf\connected.sqf"};

For the fourth

Activation: Game Logic – Repeatedly

Countdown: min 0 max 0 med 0

Type: None

Condition: onConnect

On Act: call{[] execVM "revive_sqf\respawn_counter.sqf"};

7. Make any changes to the _max_respawn variable and the _can_revive and _can_be_ revived variables in the revive_player.sqf (described above).

Bugs

If you do not get the joining mission message upon starting the mission then return to the unit selection screen and try again (I’ve only seen this a couple of times in many hours of testing so you may not ever experience it) .  

@Hulking Unicorn – thanks for the update m8, its going to be hard to fix these bugs if they are pretty much one off as its going to be very difficult to replicate them.  One thing you could do that may reduce their incidence would be to reduce the respawn timer for the AI_enabled revive version to 2 seconds (currently set at 5 sec in the description.ext file).  If the invincibility thing keeps happening we may also have to remove the addEventHandlers that protect the unconscious bodies.

Share this post


Link to post
Share on other sites

Will test it ASAP when i am back from my busines trip

Share this post


Link to post
Share on other sites

Here's the links for the latest versions of the AI-enabled revive script

and AI-disabled revive script (with respawn counter).

The zip files also contain notes for implementation of the scripts and example missions.

Changes

No change to the AI disabled script and a few minor changes to the AI-enabled scripts to ease their implementation and use with other sides.

Share this post


Link to post
Share on other sites

Hi guys,

first of all, great work Norrin. I just started using your script in one of my coop missions and have just tested it. It works great! My clan mates are now very happy campers and we look forward to playing missions with this feature in them.

The only issue I have noticed is the same one that EvilNate pointed out that intead of a player going into spectate mode having been shot, they see the same animation looping over and over again on their character. Its like the character is about to pull his weapon off his shoulder. Im using 1.05.

That aside, Norrin rocks. No question! notworthy.gif

Share this post


Link to post
Share on other sites
Hi guys,

first of all, great work Norrin. I just started using your script in one of my coop missions and have just tested it. It works great! My clan mates are now very happy campers and we look forward to playing missions with this feature in them.

The only issue I have noticed is the same one that EvilNate pointed out that intead of a player going into spectate mode having been shot, they see the same animation looping over and over again on their character. Its like the character is about to pull his weapon off his shoulder. Im using 1.05.

That aside, Norrin rocks. No question! notworthy.gif

Hi C2A.Jackal,

Can you send your mission to me at norrin@iprimus.com.au as I want to check how you've got the triggers set up as it sounds like the missionOver variable may be being set to true without the mission ending. If this is happening it will disable the unconcious camera. One way you could test for this is to comment out the call{[units]execVM "revive_sqf\mission_end.sqf"}; line in the onConnect script. ie. so it looks like this

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">// call{[units]execVM "revive_sqf\mission_end.sqf"}

If this isn't the problem your mission will help me track down this bug.

Thanks. smile_o.gif

Share this post


Link to post
Share on other sites

Hi Norrin,

I dont want to waste your time if its just me being stupid (more than likely LOL), so I'll try a couple of things first regarding the points you mentioned above, and if after that im still having trouble I'll drop you an email with my mission attached.

Many thanks for your excellent efforts mate! Your script is exactly what we are looking for!

PS. My clanmate C2A.ChipRAFP has just asked me to pass on his thanks for designing this script!

Share this post


Link to post
Share on other sites

Norrin will this work in multiplayer maps with no AI??

Share this post


Link to post
Share on other sites
Guest
Norrin will this work in multiplayer maps with no AI??

Have you actually read what this script is about?

[fun]

This is a revive script with AI disabled to be used in SP.

xmas_o.gif

[/fun]

Share this post


Link to post
Share on other sites

I want to use it in MP maps I know how it is normally used I was hoping it would work in multiplayer which is why I asked

Share this post


Link to post
Share on other sites

@El nino Foxhound icon_rolleyes.gifsmile_o.gifsmile_o.gif

@Breeze, yep that's exactly what its for m8 these scripts will only work in multiplayer on either local or dedicated servers. You'll want the AI disabled script you can find here

There's two versions of the script in the zip file one for use with playable AI disabled (ie using disabledAI = 1; in the description.ext) where all players can revive and another version for playable AI disabled and medics only can revive.

Last night my clan (I think it was around 15 players on the server) ran through a big co-op mission that used the AI disabled medic only script. Unfortunately half the team came up with a null variable error in the revive script and couldn't revive whereas the rest of the guys had no problems and it worked well. I think I know what happened so I'll make some changes to the script over the next day or so and post my revision.

Share this post


Link to post
Share on other sites

New versions of both groups of scripts are available AI-enabled revive script

and AI-disabled revive script (with respawn counter).

Once again the zip files contain notes for implementation of the scripts and example missions.

Changes

1. Found what was causing the invincibility bug and fixed it.

2. Hopefully also fixed the null variable error associated with line 150 of the revive_player script that happened occasionally

I've updated the link in the post a couple back as well

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  

×