Jump to content
Sign in to follow this  
Forxtop

Uncontrollable aim after running a script

Recommended Posts

Hello!

 

So for my scenario, i designed a little script to forbid players to left an area. To avoid desertion

 

1/ There is a trigger (PRESENT / ANYBODY), repeatable, with condition. Its area is a rectangle (like a border, very large but not long 10m).

 player in thislist && isTouchingGround player

Activation : nothing, Desactivation : null = [decl_DesertionPartie1] execvm "scripts\desertion.sqf";

 

2/ The script :

_declencheur = _this select 0;
if (isNil "desertion") then {desertion = true};
if (desertion) then 
{
 TitleText ["VOUS DESERTEZ, VOUS AVEZ 10 SECONDES, REVENEZ EN ARRIERE", "PLAIN", 2];
 _compteArebours = 10;
 _ValeurDegat = 0.01;
 While { !(player in list _declencheur) } do 
 {
  sleep 1;
  _compteArebours = _compteArebours - 1; 
  if (_compteArebours <= 0) then  
  {
   player setDamage _ValeurDegat;
   _vie = 1 - (getDammage player);
   hint format ["VOTRE VIE RESTANTE : %1 REVENEZ EN ARRIERE!",_vie];
   _ValeurDegat = _ValeurDegat + 0.01;
  };
 };
 player setDamage -1;
 _vie = 1 - (getDammage player);
 hint format ["VOTRE VIE RESTANTE : %1",_vie];
 TitleText ["Vous êtes revenus au combat, Dieu merci! Votre vie a été restauré!", "PLAIN", 2];
 desertion = false;
};

Everythings is working perfectly. But i've encountered a bug (at each execution of this script), wich surprise myself, happened when i back in the good area : the aim is going to a corner of my screen and impossible to take again control of it. It's independent of the view. Do you have any ideas ? 

 

A capture of the problem

1476457582-20161014170215-1.jpg

 

Thanks for your help!

Share this post


Link to post
Share on other sites

For my tests, i had to put an allowdamage false on my body. Without it, there is no problem.

Share this post


Link to post
Share on other sites

hi,

 

Have a look in setDamage comments

 

"Setting a unit's damage to a negative value will set it's health to full, but impair their aim."

 

cya.

 

Nikiller.

  • Like 1

Share this post


Link to post
Share on other sites

Hey! Yes i read this comment but it was not that. When you are hurt, you have a bad aim. For me, the aim was not bad, just buggy, impossible (litteraly) to control. Thanks for your answer:p

 

Edit : oh yes it could be a problem when i reset the life. Ok thanks ;)

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  

×