Home   Help Search Login Register  

Author Topic: My Simple Script  (Read 1075 times)

0 Members and 1 Guest are viewing this topic.

joe_mamma518

  • Guest
My Simple Script
« on: 06 Aug 2003, 07:38:26 »
I just read a thing on how to make scripts and i read the thing about the guy makeing the people who are injured die.  Now i decided to make a similar script but without the whole medic thing... This is what it looked like:



;bleeding...

_man = _this select 0
_dammage = getdammage _man

#start
? (_health > 0.0) : goto "bleeding"
~ 2
goto "start"

#bleeding
~ 1
_dammage = _dammage + 0.1
? _dammage = 1 : goto "end"
? _dammage < 1 : goto "bleeding"

#end
exit


It doesnt work. I just want a guy when injured to slowly die until he is....... dead.
There is gonna be a really simple answer to this and i know i just made some stupid mistake but i dont know what it is........

Oh yeah and is it possible to make blood on the ground where the guy is with like a little:

_bloodpos = getunitpos _man
 
then like:

create bood _bloodpos
lol i know nothing....

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:My Simple Script
« Reply #1 on: 06 Aug 2003, 08:32:49 »
even though you're increasing _dammage value you're not 'setting' it  :D

#bleeding
_man setdammage _dammage
~ 1
_dammage = _dammage + 0.1
? _dammage = 1 : goto "end"
? _dammage < 1 : goto "bleeding"


And may I suggest a little less fast loop. With 1 second delay the _man will die under 10 seconds when adding 0.1 of damage to him.

It is possible to cacreate blood to the units position. Search this site for OFPEC Blood addon and learn from it.
Not all is lost.

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:My Simple Script
« Reply #2 on: 06 Aug 2003, 10:07:35 »
Quote
#bleeding
_man setdammage _dammage
~ 1
_dammage = _dammage + 0.1
? _dammage = 1 : goto "end"
? _dammage < 1 : goto "bleeding"

da main prob w/ dat script is dat wen da man dat da script is used on is shot (again) - da script wil set him back 2 da dmg he was b4

also da part in da start were it sayz

Quote
#start
? (_health > 0.0) : goto "bleeding"
~ 2
goto "start"

wont work good cuz da comp dont knnow wat health meenz ;) :P

so edit da script 2 b like dat

Code: [Select]
_man = _this select 0

#start
? (getdammage _man > 0) : goto "bleeding"
~ 2
goto "start"

#bleeding
_man setdammage ((getdammage _man)+0.1)
~ 1
? not alive _man  : goto "end"
? getdammage _man == 0 : goto "start"
goto "bleeding"

#end
exit

i also added line (? getdammage _man == 0 : goto "start") dat meens dat if he gets healed (medic) he wil stop bleeding - but u can remove it

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

joe_mamma518

  • Guest
Re:My Simple Script
« Reply #3 on: 06 Aug 2003, 11:16:07 »
lol yeah i had it set for _health but then i got confused cuz the numbers go up with more dammage so i set it to _dammage and never changed the other part.... lol

ok well thats sweet, but is there a way i can make it so that this script will run for everyone (or most of the people) in the game without 100 of these things????
« Last Edit: 06 Aug 2003, 11:21:05 by joe_mamma518 »

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:My Simple Script
« Reply #4 on: 06 Aug 2003, 11:49:08 »
just exec it 4 every1 :P

u use local varis (varis w/ _ @ da start ;)) so u can use da same script on infinite num of units ;D

[unitname] exec "scriptname.sqs"

or 4 lots of units in 1 line

"[_X] exec {scriptname.sqs}" foreach [unit1,unit2,etc]

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

joe_mamma518

  • Guest
Re:My Simple Script
« Reply #5 on: 07 Aug 2003, 03:10:19 »
When u do that tho wont it make it so that 1 script is running for each guy and that would make some lag?  

Would it make less lag if i changed this:

? (getdammage _man > 0) : goto "bleeding"

To this:

@ (getdammage _man > 0) : goto "bleeding"

If that would even work.......

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:My Simple Script
« Reply #6 on: 07 Aug 2003, 21:19:07 »
u got a point ;D

change it somin like dis (even tho 2 secs is les lagy dan @ condition i think)

#start
@ (_health > 0.0)

instead of

#start
? (_health > 0.0) : goto "bleeding"
~ 2
goto "start"

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta