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

How to assign a value to a gloval variable inside a quest , in Topic Info


Tonycubed2
 Share

Recommended Posts

Greetings,

As part of my mod Sands of Time, which provides random ambushes while sleeping, I am making an in game menu to let the players set their own odds. Tedious because so much dialogue is needed and branching, but doable. I am using a npc that is spawned when a ring is worn and with conversation the player selects the odds for encounters. That all works, what I cannot solve is how to add either a script or papyrus frgment that does not need an Event to compile. I posted my script below. It will compile fine IF I put the code inside an Event, like

for example "Event OnActivate(ObjectReference akActionRef)" with "EndEvent" at the end will let the script compile just fine. But since there is no activate event it does not fire off. I just need the script to run and make changes to the global variable. , I do not need any events at all to be checked for. Seems simple but I am stuck. Any ideas?

Tonycubed2


Scriptname innplus10 extends TopicInfo  


GlobalVariable Property DreamsInn Auto

Int increase


if DreamsInn.GetValue()<91

increase = DreamsInn.GetValueInt()

DreamsInn.SetValue(Increase+10)

Debug.MessageBox("Increased to : "+DreamsInn.GetValue())

Elseif  DreamsInn.GetValue()<90

Debug.MessageBox("Cannot increase beyong 100%")

endif



Link to comment
Share on other sites

Let me try to eplain better. If you go the Ckit, and go to the quest sections, then right click on any quest and go to edit, you will see a box with many tabs. One of the tabs says "dialogue views". Go there. Then in the column that says "Dialog Views" (same name as the tab, yes) go ahead and highlight a dialog. On the right hand side you will see a flowchart with the dialogue mapped out. Now, if you double click on a dialogue box, you will get a "Topic Info" box. this box has a place to type in the prompt in the conversation as well as a place for the npc response text. On the bottom of this Topic info box is a place to enter scripts, you can enter scripts in the begin section, and in the end section as papyrus fragments. There is also a place for a regular script.

Since I am using dialogue options as a menu to raise or lower the odds of an encounter while sleeping, I need to run the script I posted here. To raise the odds by 10 . But it will no tlet me.

the script runs everytime the player wants to raise the likelihood of being ambuhed while sleeping.

Link to comment
Share on other sites

I got the answer from "Tunaisafish" from Nexus, may help others:

When you're editing a fragment you're only seeing part of a full auto-generated script.

The parts you write in will reside within a function body... so use syntax appropriately for that.

This means you can't declare or use properties right off the bat.

It's a 3 stage process if you want to do that.

1/ Save a dummy script in the fragment.

; Save me to create the fragment file.

2/ Go to the properties editor and Add your property there.

3/ Go back to the fragment and paste in your final function body.

See the last part of the wiki FAQ about the not so intuitive fragment interface when using your own properties. At: http://www.creationkit.com/FAQ:_My_Script_Doesn%27t_Work!

note: I had to follow the wiki instructions and rename the feragment to get access to the properties. Weird black magic stuff.

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