• 0
Hidekitakase

Status based on Night or Day

Question

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.

Share this post


Link to post
Share on other sites

9 answers to this question

  • 0

maybe put it in something like this instead

while(1) { 
	if (!isnight()){
		 bonus bInt,50;
	} else {
		bonus bStr,50;
	}
	sleep2 1500;
}

 

Share this post


Link to post
Share on other sites
  • 0

using infinite loop is bad idea. better use timers

Share this post


Link to post
Share on other sites
  • 0

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?

Share this post


Link to post
Share on other sites
  • 0
7 hours ago, Hidekitakase said:

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.

Share this post


Link to post
Share on other sites
  • 0

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..

Share this post


Link to post
Share on other sites
  • 0

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...

Share this post


Link to post
Share on other sites
  • 0

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.

Share this post


Link to post
Share on other sites
  • 0

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...

Edited by Hidekitakase
Yay

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now