Home   Help Search Login Register  

Author Topic: Self-healing power  (Read 2875 times)

0 Members and 1 Guest are viewing this topic.

Nobby

  • Guest
Self-healing power
« on: 14 Jun 2003, 19:18:50 »
Is there any way to script a healing process that recovers a soldiers health gradually?

e.g

?(getdammage player > 0.5)

player setdammage minus 0.1

player setdammge minus 0.1

etc

Cheers.

Nobby
« Last Edit: 15 Jun 2003, 01:30:11 by Noon416 »

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:Mutant healing power
« Reply #1 on: 14 Jun 2003, 19:57:32 »
If noon else check this out IÂ'll help u out. Right now IÂ've alt-tabbed out of a CTI game 8) ;D

Nobby

  • Guest
Re:Mutant healing power
« Reply #2 on: 14 Jun 2003, 20:01:37 »
Cheers mate.

So far all I've got is a trigger in game which is simply

?(getdammage player > 0.5)
player setdammage 0

However, I find with this is that if you die then you come back to life instantaneously, which dont look good.

I don't know of any way to gradually increase your health. How bout you?

deaddog

  • Guest
Re:Mutant healing power
« Reply #3 on: 14 Jun 2003, 20:16:45 »
One way is to have a simple script running:

;recover.sqs

_u=_this select 0

#loop
~15
_d=getdammage _u
?_d>0.1:_u setdammage (_d-0.1)
goto "loop"

By having this running all the time, the unit's health will gradually increase.  Change the 15 second delay to whatever you find suitable.

In the init line of the unit type:
[this] exec "recover.sqs"

Hope that answers your question.  :)

Nobby

  • Guest
Re:Mutant healing power
« Reply #4 on: 14 Jun 2003, 21:08:32 »
just tried it and it don't work.
I appreciate the help though mate.
Cheers

Gameer_77

  • Guest
Re:Mutant healing power
« Reply #5 on: 14 Jun 2003, 21:15:48 »
You probably don't notice it - change the '~15' to '~1'.

Gameer

deaddog

  • Guest
Re:Mutant healing power
« Reply #6 on: 14 Jun 2003, 21:24:11 »
I just tried it and it works perfectly.  Insert this line after the delay so you can see it working:

player sidechat format ["%1",getdammage _u]

As is, this script won't take the damage all the way to zero, just somewhere under 0.1.  
« Last Edit: 14 Jun 2003, 21:25:35 by deaddog »

Shaggy

  • Guest
Re:Mutant healing power
« Reply #7 on: 14 Jun 2003, 23:56:09 »
Yes the perfect thing that i was looking for. I wanted my players not to die until a certain point in the game. Is there a way i can get them to be more or less "GODMODE" until a certain point in the game..then they're vunerable. Because my character are playing a certain role in my game i am creating.

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:Mutant healing power
« Reply #8 on: 14 Jun 2003, 23:58:16 »
Yes the perfect thing that i was looking for. I wanted my players not to die until a certain point in the game. Is there a way i can get them to be more or less "GODMODE" until a certain point in the game..then they're vunerable. Because my character are playing a certain role in my game i am creating.

just setcaptive him instead.

Shaggy

  • Guest
Re:Mutant healing power
« Reply #9 on: 15 Jun 2003, 00:00:34 »
Jesus man that was a quick reply :) Thanks

:cheers:

Nobby

  • Guest
Re:Self-healing power
« Reply #10 on: 15 Jun 2003, 12:38:35 »
the script does heal the player, however, after the player dies he stays standing and displays his posistion and keeps sending orders, even though your dead.
I've tried combatting this with:

?alive _u
goto "loop"

?not alive _u
goto "end"

 #loop
~1
_d=getdammage _u
?_d>0.1:_u setdammage (_d-0.1)
goto "loop"

#end
exit

and this doesn't wanna work.
Please help.

deaddog

  • Guest
Re:Self-healing power
« Reply #11 on: 15 Jun 2003, 14:08:10 »
Ahhh,  I didn't think of when the unit dies.

Ok, Make the whole script like this:

Quote
#loop
~1
?!alive _u:exit
_d=getdammage _u
?_d>0.1 and alive _u:_u setdammage (_d-0.1)
goto "loop"

Hopefully that should do the trick   :)

PS. The reason your additions don't work is because they only occur when the script is first run.  The two "if" statements are not inside the loop so they never get looked at again.
« Last Edit: 15 Jun 2003, 14:10:14 by deaddog »

Nobby

  • Guest
Re:Self-healing power
« Reply #12 on: 15 Jun 2003, 17:28:59 »
Much better mate cheers. Although, 1 outta 20 times the undead thing happens.

Also, I was wondering if the setdammage 0.1 could be any smoother?
Gradually building up health etc.

Do you reckon this is possible?

Cheers

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:Self-healing power
« Reply #13 on: 15 Jun 2003, 17:35:21 »
Yea, u can change da ~1 line to perhaps ~0.1 and then just setdammage minus 0.01 everytime. Like this:

Code: [Select]
#loop
~0.1
?!alive _u:exit
_d=getdammage _u
?_d>0.1 and alive _u:_u setdammage (_d-0.01)
goto "loop"

EDIT: Just remember that the faster loops u make, the more CPU u need. So dont make it ~0.0000000000000000000000000000001 OK? ;D
« Last Edit: 15 Jun 2003, 19:14:47 by The real Armstrong »

deaddog

  • Guest
Re:Self-healing power
« Reply #14 on: 15 Jun 2003, 18:30:04 »
I don't know why the undead thing happens.

I put the "and alive _u" part in there to prevent that.  
 :hmm: