Jump to content
  • 0

Override init variables dynamicly


zulu

Question

Hello,

i'd like to change a variable defined in the init dynamicly.
i execute a script in the init.sqf (checkhum.sqf) which checks players humanity and if humanity is greater 10K
values of "DZE_selfTransfuse_Values" should be raised.


checkhum.sqf: (called from inside the !is_dedicated brackets )

private['_hum'];

_hum=(player getVariable["humanity",0]);

if(_hum > 10000) then {

	DZE_selfTransfuse_Values = [12000, 15, 300]
}
else {
	DZE_selfTransfuse_Values = [1000, 15, 300]
};

My humanity is above 10K, but selfTransfuse_value is 1000, 15,300 and not 12000,15,300 as expected.

I also tried
if( (player getVariable["humanity",0]) > 10000) then {....
but without success.

What am i doing wrong?

 

 

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

You set this script after compiling medical scripts. you should compile script above

EpochEvents = [...
 

Just my opinion. Dont sure, dat ll help.

 

PLUS

private['_hum'];

_hum=(player getVariable["humanity",0]);

if(_hum > 10000) then {

	DZE_selfTransfuse_Values = [12000, 15, 300];
}
else {
	DZE_selfTransfuse_Values = [1000, 15, 300];
};

You forgot two ; in script.

Link to comment
Share on other sites

  • 0

None of that will work.

 

Why? Because the script checks once, (if even! - i don`t know how and from where the script is called) and then stops.

 

What you`ll want to do is:

 

  1. Wait for player to Log in
  2. Loop the script every time the player humanity changes.
  3. Don`t put useless brackets around
    player getVariable["humanity",0]
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Discord

×
×
  • Create New...