Jump to content

quest script hot to assign a number to a global variable


tonycubed2

Recommended Posts

Greetings,

 

Ignore word "hot" from title. Typo.

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

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.

Link to comment
Share on other sites

You know what? It worked!!!!!!!! Thank u thank u thank u! Three days trying! Looking for a logical obvious solution. This is like when the city came to knock down Arthurs house in Hitch hikers guide to the galaxy, and they asked him if he had not seen the posted notice about it. The one he found out was hidden in the basement of city hall behind a door that read "beware the leper".

 

Thanks again.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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