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

Need help with script involving Random Int


TripleSixes
 Share

Recommended Posts

Scriptname BookTeleTristram02 extends ObjectReference

{This script teleports the player to a random tavern in Skyrim, from Tristram.}

;----------------------------------

;PROPERTIES

;----------------------------------

Message Property QuestionReturn Auto

Message Property YesReturn Auto

Message Property NoReturn Auto

ObjectReference Property SleepingGiant1 Auto

ObjectReference Property BannerMare2 Auto

ObjectReference Property Frostfruit3 Auto

ObjectReference Property DrunkenHuntsman4 Auto

ObjectReference Property DeadMansDrink5 Auto

ObjectReference Property TavernHelgen6 Auto

ObjectReference Property BeeBarb7 Auto

ObjectReference Property VilemyrInn8 Auto

ObjectReference Property RaggedFlagon9 Auto

ObjectReference Property SilverBlood10 Auto

ObjectReference Property OldHroldan11 Auto

ObjectReference Property WinkingSkeever12 Auto

ObjectReference Property FourShields13 Auto

ObjectReference Property Moorside14 Auto

ObjectReference Property Windpeak15 Auto

ObjectReference Property Nightgate16 Auto

ObjectReference Property FrozenHearth17 Auto

ObjectReference Property Candlehearth18 Auto

ObjectReference Property NewGnisis19 Auto

ObjectReference Property Braidwood20 Auto

Book Property TheBook Auto

WorldSpace Property Tristram Auto

Cell Property Dungeon01 Auto

;----------------------------------

;VARIABLES

;----------------------------------

Int ReadBook

Int Function RandomInt(int aiMin = 1, int aiMax = 20);Determines which tavern they appear at

;----------------------------------

;THE GOOD STUFF

;----------------------------------

Event onRead()

Int Random = Utility.RandomInt() ;Assigning the random number to the variable "Random".

if Game.GetPlayer().GetWorldSpace() == Tristram

Debug.Trace("You're In Tristram")

ReadBook = QuestionReturn.show()

if ReadBook == 0

YesReturn.show()

if Random == 1

Game.GetPlayer().MoveTo(SleepingGiant1)

Debug.MessageBox("You find yourself at The Sleeping Giant Inn")

elseif Random == 2

Game.GetPlayer().MoveTo(BannerMare2)

Debug.MessageBox("You find yourself at The Bannered Mare")

elseif Random == 3

Game.GetPlayer().MoveTo(Frostfruit3)

Debug.MessageBox("You find yourself at Frostfruit Inn")

elseif Random == 4

Game.GetPlayer().MoveTo(DrunkenHuntsman4)

Debug.MessageBox("You find yourself at The Drunken Huntsman")

elseif Random == 5

Game.GetPlayer().MoveTo(DeadMansDrink5)

Debug.MessageBox("You find yourself at Dead Man's Drink")

elseif Random == 6

Game.GetPlayer().MoveTo(TavernHelgen6)

Debug.MessageBox("You find yourself at The Destroyed Tavern in Helgen")

elseif Random == 7

Game.GetPlayer().MoveTo(BeeBarb7)

Debug.MessageBox("You find yourself at The Bee and Barb")

elseif Random == 8

Game.GetPlayer().MoveTo(VilemyrInn8)

Debug.MessageBox("You find yourself at Vilemyr Inn")

elseif Random == 9

Game.GetPlayer().MoveTo(RaggedFlagon9)

Debug.MessageBox("You find yourself at The Ragged Flagon")

elseif Random == 10

Game.GetPlayer().MoveTo(SilverBlood10)

Debug.MessageBox("You find yourself at The Silver-Blood Inn")

elseif Random == 11

Game.GetPlayer().MoveTo(OldHroldan11)

Debug.MessageBox("You find yourself at Old Hroldan Inn")

elseif Random == 12

Game.GetPlayer().MoveTo(WinkingSkeever12)

Debug.MessageBox("You find yourself at The Winking Skeever")

elseif Random == 13

Game.GetPlayer().MoveTo(FourShields13)

Debug.MessageBox("You find yourself at Four Shields Tavern")

elseif Random == 14

Game.GetPlayer().MoveTo(Moorside14)

Debug.MessageBox("You find yourself at Moorside Inn")

elseif Random == 15

Game.GetPlayer().MoveTo(Windpeak15)

Debug.MessageBox("You find yourself at Windpeak Inn")

elseif Random == 16

Game.GetPlayer().MoveTo(Nightgate16)

Debug.MessageBox("You find yourself at Nightgate Inn")

elseif Random == 17

Game.GetPlayer().MoveTo(FrozenHearth17)

Debug.MessageBox("You find yourself at The Frozen Hearth")

elseif Random == 18

Game.GetPlayer().MoveTo(Candlehearth18)

Debug.MessageBox("You find yourself at Candlehearth Hall")

elseif Random == 19

Game.GetPlayer().MoveTo(NewGnisis19)

Debug.MessageBox("You find yourself at New Gnisis Cornerclub")

elseif Random == 20

Game.GetPlayer().MoveTo(Braidwood20)

Debug.MessageBox("You find yourself at Braidwood Inn")

EndIf

elseif ReadBook == 1

NoReturn.show()

endif

endif

endEVENT

COMPILER ERROR:

C:\Program Files (x86)\Notepad++>cd "C:\Program Files (x86)\Steam\steamapps\comm

on\skyrim\Data\Scripts\Source"

C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source>if defi

ned ProgramFiles(x86) ("C:\Program Files (x86)\Steam\SteamApps\Common\Skyrim\Pap

yrus Compiler\PapyrusCompiler.exe" "BookTeleTristram02.psc" -f="TESV_Papyrus_Fla

gs.flg" -i="C:\Program Files (x86)\Steam\SteamApps\Common\Skyrim\Data\Scripts\So

urce" -o="C:\Program Files (x86)\Steam\SteamApps\Common\Skyrim\Data\Scripts" )

else ("C:\Program Files (x86)\Steam\SteamApps\Common\Skyrim\Papyrus Compiler\Pap

yrusCompiler.exe" "BookTeleTristram02.psc" -f="TESV_Papyrus_Flags.flg" -i="C:\Pr

ogram Files (x86)\Steam\SteamApps\Common\Skyrim\Data\Scripts\Source" -o="C:\Prog

ram Files (x86)\Steam\SteamApps\Common\Skyrim\Data\Scripts" )

Starting 1 compile threads for 1 files...

Compiling "BookTeleTristram02"...

C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\BookTel

eTristram02.psc(43,0): no viable alternative at input 'Event'

No output generated for BookTeleTristram02.psc, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.

Failed on BookTeleTristram02.psc

C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source>pause

Press any key to continue . . .

Any suggestions? No viable alternative at input 'Event'. What does that mean

Link to comment
Share on other sites

Since it does not like your 'Event OnRead()'

My guess is your 'Function' call just above it, is probably the culprit. Dont you need an endFunction or something like that?

I don't feel functions are necessary so I never use them. Any calculation I want I place directly in the code.

Link to comment
Share on other sites

Alright, the good news is that I went with your recommendation, and didn't use the function and now it works like a charm. Now I just have to figure out how to check if the player is in certain cells... I'll take your recommendation from the other post, and try to get the entire script complete. You are a wonderful help willie! Thank you so much!

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