mrbean1112 0 Posted October 15, 2006 okay here is the script [] exec "w1time.sqs" #w1hunger ?(w1hunger == 0) : goto "full" ?(w1hunger == .2): goto "kinda hungry" ?(w1hunger == .5): goto "pretty hungry" ?(w1hunger == .9): goto "nearing starvation" ?(w1hunger == 1) : goto "starving" ?(w1hunger <1.2) : goto "time" #Full god globalchat "Player one is not hungry" goto "w1hunger" #kinda hungry god globalchat "Player one is getting hungry" goto "w1hunger" #pretty hungry god globalchat "Player one is very hungry" goto "w1hunger" #nearing starvation god globalchat "Player one is nearing starvation" goto "w1hunger" #starving god globalchat "player one is starving and is taking damage as a result" w1 setdammage .98 goto "w1hunger" and here is w1time #time ~.5 w1hunger = w1hunger + .01 goto "time" Problem it just wont work.. the w1hunger isnt adding.. my guy isn't getting hungry.... however, if i put something like w1hunger = 1 in a seperate trigger, it works. can anyone help me? Share this post Link to post Share on other sites
Chris Death 0 Posted October 15, 2006 Well, i've already posted you an answer in your thread you made at ofpec. w1hunger never increases, since it will instantly run the first check only over and over again. More detailed answer here. I don't want to repeat meself ~S~ CD Share this post Link to post Share on other sites
mrbean1112 0 Posted October 16, 2006 dangit.. okay well basically at ofpec i said that i actually did define w1hunger in the init.. it = 0 and, at the beginning of the first script shouldn't it exec w1time.sqs? and in w1time.. is it going to add .01 every second? cause it isn't with the current setup. Share this post Link to post Share on other sites
Metal Heart 0 Posted October 16, 2006 I think conditions w1hunger==.9 and w1hunger==1 are not met because of the way OFP handles floating point numbers. Try this script to see why: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">f=0 #loop f=f+.01 player sidechat format ["%1",f] ~0.2 goto "loop" It's some sort of rounding error having to do with floating point accuracy, binary-decimal conversion or something like that. In this case it would be better to use integer values, like 0 through 100 and only add whole numbers. Also, there's a bug with setdammage. If you setdammage somebody over 0.9 and he enters a vehicle he will get kinda stuck between life and death when he disembarks. Share this post Link to post Share on other sites
Blanco 0 Posted October 16, 2006 Not sure, but can spaces be used in label names? Try to use Kinda_hungry instead of kinda hungry Share this post Link to post Share on other sites
mandoble 1 Posted October 16, 2006 What Blanco said, also mutiply all your numbers by 100, you dont need .2 when you may use 200. This way w1hunger = w1hunger + 1 Also, notice that nothing is important for you in periods of less than 50 seconds (the shorter being the check between .9 and 1, so you dont really need to check anything very 0.5 seconds. You have also ?(w1hunger <1.2) : goto "time", but time label is defined in a different script (w1time.sqs). So, if its is not 0 (which will happen 0.5 secs after executing the script), it will try to jump to an undefined label name "time". You may try the following: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _msgs=["Player one is not hungry","Player one is getting hungry","Player one is very hungry","Player one is nearing starvation","player one is starving and is taking damage as a result"] ;Change delays between states checks as needed _delays[200,200,200,200,1] ;Change damages per state as needed _damages[0,0,0,0,.98] _countstates = count _damages _i = 0 #w1hunger _msg = _msgs select _i _dmg = _damages select _i _delay = _delays select _i ?!alive w1:exit ?_dmg > 0:w1 setDamage _dmg god globalchat _msg ~_delay _i = _i + 1 ?_i < _countstates:goto "w1hunger" exit Share this post Link to post Share on other sites
mrbean1112 0 Posted October 17, 2006 thanks guys, i managed to get it working thanks to all your help! Share this post Link to post Share on other sites
HeyHiHello 0 Posted October 18, 2006 he full after eat much dinners!!!!!!! hope you find laughs while wait for answer ..scriptings hard!!! Share this post Link to post Share on other sites