Home   Help Search Login Register  

Author Topic: Countdown respawn....  (Read 2878 times)

0 Members and 3 Guests are viewing this topic.

Offline pexmo

  • Members
  • *
  • I'm a llama!
Countdown respawn....
« on: 10 Jan 2005, 04:38:49 »
OK i have a idea/request.

The script i would like to see is this one:

When you die a counter starts (saw a visible time counter in the ed depot) counting down.
If another player get to you in time the couter stops and your are saved. You get back to life with like half health (can get to max at a medic) and can continue the fight.

If time runs out you are dead and cant be saved anymore.

Can this be done you think?

I cant script but its a request :)


 

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Countdown respawn....
« Reply #1 on: 10 Jan 2005, 05:07:50 »
<unitname> addeventhandler ["killed",[<unitname>,[<listOfFriendlies>],<timeToBeSaved>] exec "save.sqs"

_dead = _this select 0
_friendies = _this select 1
_count = _this select 2

#loop
?_time = _count:exit
?{ _x distance _dead <= 2} count _friendlies > 0:_dead setdammage .5;exit
~.1
goto "loop"

did that REALLY quick, so I'm not sure it will work, I know it alone will suck for SP, but that is a basic outline....

Offline pexmo

  • Members
  • *
  • I'm a llama!
Re:Countdown respawn....
« Reply #2 on: 10 Jan 2005, 05:25:51 »
what do you meen with listoffriendlies?

Should i enter all "friendly" names here? like friend1,friend2,friend3?
« Last Edit: 10 Jan 2005, 05:26:57 by pexmo »

Offline pexmo

  • Members
  • *
  • I'm a llama!
Re:Countdown respawn....
« Reply #3 on: 10 Jan 2005, 05:28:10 »
and:

where do i put this line?
<unitname> addeventhandler ["killed",[<unitname>[<listOfFriendlies>],<timeToBeSaved>] exec "save.sqs"

Im sooo green at scripting so live with my greeen questions please :)
« Last Edit: 10 Jan 2005, 05:28:37 by pexmo »

Offline pexmo

  • Members
  • *
  • I'm a llama!
Re:Countdown respawn....
« Reply #4 on: 10 Jan 2005, 06:38:53 »
OK got it going, and yeah it works just a few probs.

1: When i get close to the other guy he gets the health idicated in this line:

?{ _x distance _dead <= 2} count _friendlies > 0:_dead setdammage .92;exit

It is like he gets his ressurected health as soon as im close to him. Not just after he has been killed.

2: It only happens ones. I can get close to him and get the res (or if hes not dead: the HARM) to happen but it only works once.

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Countdown respawn....
« Reply #5 on: 10 Jan 2005, 22:24:13 »
lemme just check:
you aren't executing the script are you?
it should be called by the killed EH
in the units init line put this:
this addeventhandler ["killed",[<unitname>,[<listOfFriendlies>],<timeToBeSaved>] exec "save.sqs"]

Offline pexmo

  • Members
  • *
  • I'm a llama!
Re:Countdown respawn....
« Reply #6 on: 10 Jan 2005, 22:35:43 »
i did that and i have the UNITNAME replaced by the name of the unit i have put the line in the init field of. And list of friendlies i list the names of those who can save him.

I does work to get him up but only ones and if he is not down when i get to him he gets hurt down to the health set in the script.

I did have the line in init the unit i controle also but with the names changed according to the above described way.

I did this beacause i want all players to be able to save each other.

Did you get it working ok Trigger?
« Last Edit: 10 Jan 2005, 22:37:37 by pexmo »

Offline OFPfreak

  • Members
  • *
  • Who is da operation flashpoint freak now, freak?!
    • OFP NFS mod
Re:Countdown respawn....
« Reply #7 on: 25 Jan 2005, 01:31:41 »
I have the feeling you didnt even make the script
uh.... thats weird.... copy this into a new text file:

Code: [Select]
_dead = _this select 0
_friendies = _this select 1
_count = _this select 2

#loop
?_time = _count:exit
?{ _x distance _dead <= 2} count _friendlies > 0:_dead setdammage .5;exit
~.1
goto "loop"

save it as save.sqs and put it in your mission folder? Its quite simple... I know how it feels becuase im a bit uh.... green/yellow right now.. And in init of a unit u put for example, this?:

this addeventhandler ["killed",[<p1>,[<medic1,medic2>],<30>] exec "save.sqs"]

Thats how you need to do it (example)! Just trying to be nice ;)!
ofp nfs REBORN! All new nitro, neon, customized cars, off-road, on-road, rally, bikes, racer models and more!
ofp nfs's homepage

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:Countdown respawn....
« Reply #8 on: 25 Jan 2005, 03:31:12 »
How's this for an idea....please tell me if its not original as i suspect it isnt.  ;)

Create a new addon, remake a soldier class just like any other ordinary class, but with heaps of armour. This can be your 'player' class. Give him an 'init' e-h with a script which constantly loops, checking his dammage. If his dammage has increased, check how much, multiply this by his total armor to see how much 'armor' he has lost, and compare this to an ordinary soldier (armor=3 or 4 i think, can't check right now). If he's lost enough armor to kill an ordinary soldier, play the relevant death animation based on whether he's in combat mode, running forward/backward/his speed etc. Your player is now 'dead'.  If a 'medic' comes up to him, play the relevant 'healing' animation, otherwise after a set amount of time let him actually die (either setdammage or camcreating a bullet). That way you could avoid the usual ofp death sequence (unless, of course, you were hit by a tank shell or a lgb or something ;D ) and implement the healing proccess in SP/with a player.

Offline pexmo

  • Members
  • *
  • I'm a llama!
Re:Countdown respawn....
« Reply #9 on: 01 Feb 2005, 10:57:48 »
well thats a nice idea man. Thats realy a good solution if it could be made. Anyone know how to make it work. I know how i can edit the values of armor in addons to get high amount of armor but the rest i have noooo idea how to make.

This, if it can be made, would make a soldier be as dead but still be able to to get revived by medical attention. Still setcaptive should be set to him so the enemy wont keep attacking the downed player and i would also like to add a % chanse of the damage to be set to 1 if this fake death accours.

Can this realy nice idea be done? Pleeeaaaase help a coop team in need  ;D


And thx OFPfreak. I did make the script but i dint exec it right :) Still it wont work for mp coop as i see it.

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Countdown respawn....
« Reply #10 on: 01 Feb 2005, 22:26:20 »
OFP has literally turned skitzophrenic on me so i can't test it. but i have a few corrections. this should work via script and addons are no fun (cause you hafta dl them). just to make sure, you didn't put the <> around everything like ofpfreak did, did you? anyway:

in the soldiers init put:
this addeventhandler ["killed", {[this, [listoffriendyunits], countdown time] exec "save.sqs"}]

DON'T PUT THAT UNIT IN THE LIST OF FRIENDLIES
(lol, CAPS)

Code: [Select]
_dead = _this select 0
_friendly = _this select 1
_timer = _this select 2

#loop
?_time = _count:exit
?{ _x distance _dead <= 2} count _friendlies > 0:_dead setdammage .5;exit
~.1
goto "loop"

i realized that i didn't put the correct syntax on the eventhandler

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Countdown respawn....
« Reply #11 on: 01 Feb 2005, 22:35:09 »
hmm... i think i know why it only works once....(by the way it worked fine)
but the guy
1) leaves your group when he dies (does he need to be in a specific group? I'll just add a simple thing)
2) wont get back up (need to use an anim)
3) i think he might lose the eh but i can fix all of this, so i'll get back to you

so it will work fine, once i get it finished up

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Countdown respawn....
« Reply #12 on: 02 Feb 2005, 00:46:26 »
I like this unique idea, and I think Triggerhappy has pretty much nailed it. I'd just add a couple suggestions to his work-in-progress:

*exit the script loop after the unit is healed back up again. It could be done by replacing this line:
?_time = _count:exit
With this one
?_time = _count || alive _dead : exit

*playing the medic animation would be a nice effect, so that there is a slight delay between when the medic gets close and when the unit is 'revived'

I think a mission that works like this could be great fun, especially in MP. You would need to have no 'medics' in the game though, or else the unit could get healed up to full again after being revived. It might even be cooler if the script kept 'reviving' you at a lower and lower life level. Eg, the first time you are revived, you get setdammaged to .8, the second time .6, the third .4, and so on, until you can't be revived any more. Of course, that would be a little more complicated to script, though.
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Countdown respawn....
« Reply #13 on: 02 Feb 2005, 02:40:07 »
heres what i've got:
Code: [Select]
_dead = _this select 0
_grp = _this select 1
_friendly = _this select 2
_timer = _this select 3

#loop
?_time = _count:exit
?{ _x distance _dead <= 2} count _friendlies > 0:goto "end"
~.1
goto "loop"

#end
_dead setdammage .5
[_dead] join _grp
_dead playmove "TreatedLyingToLying"
_dead addeventhandler ["killed",{[_dead,_grp,_friendly,_timer] exec "save.sqs"}]
~1
_dead playmove "LyingToCrouch"
exit
I added the EH in there because it only works once, (engine limitation for killed eh? or maybe because he died everything gets unassigned)
anyway none of it seemed to work, but then again ofp crashed on me while testing (i hate my comp) so i don't know if it works or not. but the ai refuse to stand up after being revived. stuck in the death anim i assume

edit:
i also added the group for when he gets revived, so the new syntax for it is:
this addeventhandler ["killed",{[this,group this,[list of friendlies],death timer] exec "save.sqs"}]

edit 2:
Barron I do exit the script when the unit gets healed...(old version and new, but this is in the old i'm talking about):
?{ _x distance _dead <= 2} count _friendlies > 0:_dead setdammage .5;exit
« Last Edit: 02 Feb 2005, 02:44:12 by Triggerhappy »

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:Countdown respawn....
« Reply #14 on: 02 Feb 2005, 03:51:46 »
OK, but i still dont see how this would work if involves you (as a player in MP or SP) being dead for any length of time, although it would work for ai. In Mp you would be seagull'd or respawned as per usual, and in Sp you would go through the usual business of death menus and such...

I dont  like having make the player(s) have yet another addon, which would add yet another hassle to getting a multiplayer game together when the process is frenetic enough already :P It would be cool to make a more universal addon which affected all units from all addons this way, but that's beyond me!

However I dont think there is any other way than having an addon. And if we do it the way i suggested, using a lot of armor as a buffer to stop actual real 'death', it seems (from various e-h discussions) that we can't really use hit/dammaged eventhandlers (because the armour's so high they dont register anything when hit). So the only way would be a looping damage check (from an init e-h in the addon config)


Incidentally, iirc, the ai doesn't always get up from the treatedlyingtolying anim, but they do always get up from the other one, the treatedlyingto*something else*. Also, if you're going to use treatedlying anims, make sure you check the angles that the corpse lands at match up to the direction that the treated animation starts at. If you do this, it can look fairly realistic. Although, you can only do this if you know for sure which of the many death animations the person will play (easy if you are telling the person which one to play, but difficult if you're trying to predict)
« Last Edit: 02 Feb 2005, 04:05:42 by Fragorl »

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Countdown respawn....
« Reply #15 on: 02 Feb 2005, 04:12:17 »
if you don't have a respawn you won't come back as a seagull or anything. so it will work perfectly

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:Countdown respawn....
« Reply #16 on: 02 Feb 2005, 04:14:09 »
Well I'll be da**ed... never knew!

EDIT: so do you just lie there indefinitely, until a medic comes, or do you get 'respawned' after a while?
« Last Edit: 02 Feb 2005, 04:18:03 by Fragorl »

Offline pexmo

  • Members
  • *
  • I'm a llama!
Re:Countdown respawn....
« Reply #17 on: 02 Feb 2005, 07:32:39 »
Nice going trigg :)

Ill test it right away. And for us its no big deal if the player is placed out of the group as we are using y2k3 and it has the script that makes the player leaders able to join in separate units into their squad.