OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: schuler on 23 Apr 2009, 04:57:51

Title: script distance prob [solved]
Post by: schuler on 23 Apr 2009, 04:57:51
can someone fix this script so i works
h is a man hh is a vehicle

Code: [Select]
#loop
h distance hh < 30 (hh setdamage 0)
thanks
Title: Re: script distance prob
Post by: Worldeater on 23 Apr 2009, 07:20:55
.oO( Never write a line of code without a spec! )

What is this script supposed to do? Wild guess: make a guy repair a vehicle as soon as it is closer than 30 meters. Open question: should this happen only once or every time the condition is met?
Title: Re: script distance prob
Post by: schuler on 23 Apr 2009, 07:26:59
make a guy repair a vehicle as soon as it is closer than 30 meters. yes
and everytime
Title: Re: script distance prob
Post by: Worldeater on 23 Apr 2009, 07:57:27
Mean as I am I used the variables guy and car instead of h and hh. To prevent the car from being invulnerable when within the distance it takes the guy five seconds to fix it. If this is not what you wanted simply remove the "~5". The script will stop running as soon as the guy is dead.

Code: [Select]
[] exec "repair.sqs"
Code: (repair.sqs) [Select]
#loop

@ ((car distance guy < 30) and (getDammage car != 0))

?! alive guy : goto "exit"
~5
car setDamage 0
goto "loop"

#exit

Title: Re: script distance prob
Post by: schuler on 23 Apr 2009, 10:27:53
but i can change it to h and hh right?
Title: Re: script distance prob
Post by: JamesF1 on 23 Apr 2009, 18:12:39
Changing the variable names won't make a difference, as long as you change them all.
Title: Re: script distance prob
Post by: schuler on 23 Apr 2009, 23:35:35
thanks James and Worldeater , i have the script like this but its not working. m1 is a man and he is in a vehicle.

Code: [Select]
HEIGHT: 0  WEIDTH: 0
ACTIVATION: West - Present
TYPE: NONE
CONDITION: this
ON ACTIVATION: [] exec "repair.sqs"


Code: [Select]
#loop

@ ((stryker distance m1 < 30) and (getDammage stryker != 0))

?! alive m1 : goto "exit"
~5
stryker setDamage 0
goto "loop"

#exit
Title: Re: script distance prob
Post by: Worldeater on 24 Apr 2009, 10:33:55
I haven't checked if it also works if the guy is inside a vehicle but I'll check that later today.

You know that the script can't "resurrect" destroyed vehicles?
Title: Re: script distance prob
Post by: Sparticus76 on 24 Apr 2009, 10:58:38

HEIGHT: 0  WEIDTH: 0



The problem is if the trigger has no size, it wont be tripped because west will never be present.
Title: Re: script distance prob
Post by: schuler on 24 Apr 2009, 13:15:47
Quote
The problem is if the trigger has no size, it wont be tripped because west will never be present.
thanks for pointing out my blundering stupidity  Sparticus  :-[