Jump to content

Need help with sleeping-related script


Legotrash

Recommended Posts

I'm trying to make the character lose a single item (from a bunch) when waking up,for instance: Every time the char wakes up should lose one arrow.

Now,if this had to happen just once there wouldn't be any problems (i guess :P ) but because this has to happen every single time the char wakes up I'm having serious issues with the sleeping script. Most of ways I tried ended up with my char waking up and,one by one,losing every single item. With a couple of other ways that very same thing happened while sleeping.

It's not working as intended no matter how many conditions and "doOnce"-type of buttons I set. It acts as if the sleeping procedure keeps going while I'm in gamemode.

 

If it's impossible to happen with waking up then during sleep would be fine too.

 

I need either ideas about making this happen or at least helping me understand the whole sleeping procedure a bit better.

 

 

Other than that,I have an idea that I haven't tried yet: Making the event take place when the player clicks on the "rest" button but I have no clue how to do it so there goes that.

Link to comment
Share on other sites

Have you tried something like:

 

Short package

If ( package != GetSleeping )
	Return
Else
Do Stuff
EndIF

Link to comment
Share on other sites

My apologies not just for the delay but also for not making myself more clear. I was talking about the player's char,not NPCs. :sweat: Anyway,good news about the problem! I found out (accidentally) that a few other lines of mine were interfering with that event. I'm also trying to make the player lose one item during the day if he's not sleeping but it doesn't work properly for me and I can't see what I miss. I think I'm screwing up the doOnce trigger somehow since this will work just once:

 

 

scn name

 

short doOnce

 

begin gamemode

If ( Gamehour >= 6 && Gamehour <= 19 ) && ispcsleeping == 0 && doOnce == 0

set doOnce to 1

player.removeitem item 1

elseif ( Gamehour < 6 && Gamehour > 19 ) && doOnce == 1

set doOnce to 0

EndIf

End

 

 

It acts as it never gets set back to 0. Btw,this was the culprit for my previous problem.

Link to comment
Share on other sites

Here's the one I'm actually using (one of the many I tried actually):

 

 

If PCVampire >= 1

If ( Gamehour >= 6 && Gamehour <= 19 ) && ispcsleeping == 0 && vampawake == 0

set vampawake to 1

set BloodCount to BloodCount - 1

;set bloodhunger to bloodhunger +1

if ( feedcount >= 1 )

set feedcount to feedcount -1

player.removeitemNS VampiresBloodPoints 1; 12

endif

elseif ( Gamehour < 6 && Gamehour > 19 ) && vampawake == 1

set vampawake to 0

EndIf

EndIf

 

Link to comment
Share on other sites

I want to set it during any moment of the night (only at night),if I'll put II instead wont it be able to change during day time too?

 

Btw,I just thought that I haven't tried it this way: ( Gamehour > 19 && Gamehour < 6 ) :facepalm: I can't test it right now though (technical problems). +_+

 

Sorry Maskar,my bad. I took some time off to clear my mind and now I saw the obvious. I took that line off,changed the structure of the whole thing and it's all good.

 

Thanks for your replies!

Edited by Legotrash
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...