Status based on Night or Day

Hidekitakase

New member
Messages
17
Points
0
Location
Brazil
Emulator
Hey Guys i have a doubt, why this is don't work properly:

while(!isnight()){
    bonus bInt,50;
    sleep2 1500;
}


bonus bStr,50;

 When is at night give to the player 50 int points, but, when i change to morning the item don't refresh itself to the other part of the code. But, when I remove and equip again the item, then give me correctly 50 str points.

This is my question... have a script to refresh itself the item? When day give me 50 str points, and when at night, the item refresh, then give me 50 int points.

 
maybe put it in something like this instead

Code:
while(1) { 
	if (!isnight()){
		 bonus bInt,50;
	} else {
		bonus bStr,50;
	}
	sleep2 1500;
}
 
using infinite loop is bad idea. better use timers

 
Yeah, but the thing is, the bonus status don't change automatically when i change day to night or the opposite. I wanted that the bonus change automatically when the day is over... it's possible?

 
Yeah, but the thing is, the bonus status don't change automatically when i change day to night or the opposite. I wanted that the bonus change automatically when the day is over... it's possible?
maybe post the whole script and i second to @4144 its better if you use timers on this one. Look up addtimer in doc/script_commands.txt and if you haven't read the whole doc, doing a quick glance at each commands might be a big help for you in the future. You don't have to memorize them, you just need to know what's available to you.

 
Man, you don't understanding me... every way that i use to make a script, the code inside bonus item doesn't refresh itself, even with time or not... I don't know what happen but, the script doesn't work properly when it is inside bonus item..... choose one item and put this code, you'll see what i'm telling you..

 
It didn't work, i tried to make using time function but, again didn't work. I don't know what's causing this issue... it's like when the item is equipped won't change the status anymore, well by using this script for item...

 
Its hard to say without having all the infos, but if you're added your script on the OnEquipScript, the bonus will apply only when you equip it, as intended. If that's on the Script section itself, dunno how it works though, but you can add a little npc script which will check the time (night / day) each time a monster is killed and the player has this weapon equipped for instance. So you'll be able to change it on need.

 
Yes, i thought that if i make that npc it will work. I will try later ;D thanks.... Butt, just one problem, if i use an npc, i have to create an exception to apply the buff only if the player still using it. If the player change that equipment the buff is over... I'll think better...

 
Last edited by a moderator:
Back
Top