Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

[SKY] RegisterForSleep on specific bed


bleakraven
 Share

Recommended Posts

Hey guys!

 

I have a specific bed I want to fire off the OnSleepStart event thingie. That is, after a certain part of my quest, I want it so that if the player sleeps on that one specific bed, something happens; and if they sleep anywhere else, it doesn't happen.

 

Is this even possible?

Link to comment
Share on other sites

it is. For the bed you want to use, you will duplicate any bed using a unique ID and then add a script to it... I'll see if I code something up

 

For all the other beds, you can use static beds, so the player has no interaction with them.

 

I'll see what I can do.

 

 

after a certain part of my quest

 

What is your quest ID and all that info?

 

 

Something happens

 

What do you want to happen?

Edited by DsoS
  • Upvote 1
Link to comment
Share on other sites

I'm not sure how I would code for just those "chances" but I can do a Random number picker, lets say 1 to 6 or however many you need, and if it picks "1" it does that, or if it picks "6" it does this, etc.

 

would that be okay?

 

From the shout box:

 

bleakraven: because I want two events to have a 10% chance of happening

 

Me: The chances for these events are 10, 10, 20, 25, 30, 5..... Are those correct? Why the two 10's?

Edited by DsoS
Link to comment
Share on other sites

Here's my chances for the events:

 

int randomChance = Utility.RandomInt()
	if randomChance > 20
		Debug.MessageBox("Random Event 1 - 20%")
	ElseIf randomChance == 20 || randomChance < 50
		Debug.MessageBox("Random Event 2 - 30%")
	ElseIf randomChance == 50 || randomChance < 80
		Debug.MessageBox("Random Event 4 - 30%")
	ElseIf randomChance == 80 || randomChance < 90
		Debug.MessageBox("Random Event 5 - 10%")
	ElseIf randomChance == 90 || randomChance <= 100 
		Debug.MessageBox("Random Event 6 - 10%")
	endif

:D

 

Edit: Those aren't the chances I said earlier, I was just messing with a chances script :)

Edited by bleakraven
Link to comment
Share on other sites

Your first random event is NOT FROM 1-20, its from 21 to 100. So if your value is greater than 20, this code will be executed.

if randomChance > 20

 

Your second is 20 or 1-20. It does not get the less than 50 because you have this all in an 'elseif' condition and the first true statement gets its code executed. Since #1 above takes the values from 21 to 100, the only thing left is what is less than 21.

ElseIf randomChance == 20 || randomChance < 50

 

Your third and all the following will never get executed because your first two conditions above take all numbers available from the random number generator that returns a number from 1 to 100.

ElseIf randomChance == 50 || randomChance < 80

ElseIf randomChance == 80 || randomChance < 90

ElseIf randomChance == 90 || randomChance <= 100

  • Upvote 1
Link to comment
Share on other sites

Uh, not really. Your code is confusing and probably needs some clean up too.

 

        int randomChance = Utility.RandomInt()
 if randomChance < 21
  Debug.MessageBox("Random Event 1 - 20%")
 ElseIf randomChance < 51
  Debug.MessageBox("Random Event 2 - 30%")
 ElseIf randomChance < 81
  Debug.MessageBox("Random Event 4 - 30%")
 ElseIf randomChance < 91
  Debug.MessageBox("Random Event 5 - 10%")
 Else
  Debug.MessageBox("Random Event 6 - 10%")
 endif
 

  • Upvote 1
Link to comment
Share on other sites

Even though each condition checks for values from 1 to 'the number', this works because your using an 'ElseIf' condition. The first IF condition that is true will be executed and the rest will be skipped.

 

 if randomChance < 21

*Values from 1-20 (Actual 1-20)
 ElseIf randomChance < 51

*Values from 1-50 (Actual 21-50)
 ElseIf randomChance < 81

*Values from 1-80 (Actual 51-80)
 ElseIf randomChance < 91

*Values from 1-90 (Actual 81-90)
 Else

  *(Actual 91-100)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...