Jump to content

Quick Questions, Quick Answers


Mattiewagg

Recommended Posts

Alternatively you can reference the property in the script directly by adding the form that the original script is on as a property of that script to your seconds script. Which has probably just confused you more. Here, the wiki does a better job of explaining it than I could.

 

http://www.creationkit.com/Variables_and_Properties#Getting_Properties_of_a_Quest_Script

Link to comment
Share on other sites

  • Replies 2.6k
  • Created
  • Last Reply

Top Posters In This Topic

Alternatively you can reference the property in the script directly by adding the form that the original script is on as a property of that script to your seconds script. Which has probably just confused you more. Here, the wiki does a better job of explaining it than I could.

 

http://www.creationkit.com/Variables_and_Properties#Getting_Properties_of_a_Quest_Script

Doesn't this only apply to scripts that are on the same thing though? If so, then it won't help me since my scripts aren't on the same object.

Link to comment
Share on other sites

 

Alternatively you can reference the property in the script directly by adding the form that the original script is on as a property of that script to your seconds script. Which has probably just confused you more. Here, the wiki does a better job of explaining it than I could.

 

http://www.creationkit.com/Variables_and_Properties#Getting_Properties_of_a_Quest_Script

Doesn't this only apply to scripts that are on the same thing though? If so, then it won't help me since my scripts aren't on the same object.

 

 

Nope. Read the first line:

 

"Often you will need to get a property of a quest script, and use it in a result script somewhere else."

Link to comment
Share on other sites

 

 

Alternatively you can reference the property in the script directly by adding the form that the original script is on as a property of that script to your seconds script. Which has probably just confused you more. Here, the wiki does a better job of explaining it than I could.

 

http://www.creationkit.com/Variables_and_Properties#Getting_Properties_of_a_Quest_Script

Doesn't this only apply to scripts that are on the same thing though? If so, then it won't help me since my scripts aren't on the same object.

 

 

Nope. Read the first line:

 

"Often you will need to get a property of a quest script, and use it in a result script somewhere else."

 

Mmk... I think I'm just going to create a global variable though, so... Thanks for the information.

Link to comment
Share on other sites

Okay... I'm a bit confused... I created the global variable under Misc/Global with name recordGoldValue, made it into a property in the chest script (GlobalVariable Property recordGoldValue Auto), set a value to it in the chest script (recordGoldValue.SetValue((myGoldValue as Float)) //myGoldValue is another property within the chest script), then try to get the value of it in the button script (value = (recordGoldValue.GetValue() as Int) //value being an integer property in the button script), and try to display it (Debug.MessageBox(value + " is the value of items in your chest")). When I tested to see if it is working, however, it just says "0 is the value of the items in your chest"... did I miss something, or do something wrong?

Link to comment
Share on other sites

First off, you don't set value as int.

 

SetValue/GetValue - Sets and gets float values

SetValueInt/GetValueInt - Sets and gets int values

 

No need to cast.

 

Make sure your property is filled, and the script properly compiles. Showing us your script would be nice too.

Link to comment
Share on other sites

First off, you don't set value as int.

 

SetValue/GetValue - Sets and gets float values

SetValueInt/GetValueInt - Sets and gets int values

 

No need to cast.

 

Make sure your property is filled, and the script properly compiles. Showing us your script would be nice too.

The Creation Kit site recommends casting instead of using the SetValueInt()/GetValueInt() functions... only reason I was using cast. So you're telling me instead of passing it (myGoldValue as Float) I could just pass it (myGoldValue) since myGoldValue is an Int property?

Link to comment
Share on other sites

 

First off, you don't set value as int.

 

SetValue/GetValue - Sets and gets float values

SetValueInt/GetValueInt - Sets and gets int values

 

No need to cast.

 

Make sure your property is filled, and the script properly compiles. Showing us your script would be nice too.

The Creation Kit site recommends casting instead of using the SetValueInt()/GetValueInt() functions... only reason I was using cast. So you're telling me instead of passing it (myGoldValue as Float) I could just pass it (myGoldValue) since myGoldValue is an Int property?

 

Alright...

 

You can do that. It may be true that the int functions are a little slower. If:

 

You are setting a float, or something that doesn't need to be cast as an int (i.e. 1.000000 is the same as 1 when used as a bool, no need to cast that). Use SetValue/GetValue

 

When trying to set or get an integer: You can use the Set/Get Int functions, without having to cast, or you can SetValue/GetValue as Float.

Link to comment
Share on other sites

The scripts I'm working with atm are:

 

ScriptName ConllectionChestScript extends ObjectReference

Int Property myGoldValue = 0 Auto
Int Property itemValue Auto
MiscObject Property Gold001 Auto
GlobalVariable Property convertGoldValue Auto
Event OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
If akSourceContainer == Game.GetPlayer()
itemValue = akBaseItem.GetGoldValue()
itemValue = (itemValue * aiItemCount)
myGoldValue += itemValue
convertGoldValue.setValue((myGoldValue as Float))
EndIf
If akBaseItem == Gold001
resetGoldValue()
EndIf
EndEvent
Event OnItemRemoved(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)
If akDestContainer == Game.GetPlayer()
itemValue = akBaseItem.GetGoldValue()
itemValue = (itemValue * aiItemCount)
myGoldValue -= itemValue
convertGoldValue.setValue((myGoldValue as Float))
EndIf
EndEvent
Function resetGoldValue()
myGoldValue = 0
Return
EndFunction

 

and

 

 

ScriptName ConvertButton extends ObjectReference

ObjectReference Property CollectionChest Auto
Int Property value = 0 Auto
MiscObject Property Gold001 Auto
Event OnActivate(ObjectReference akActionRef)
Utility.Wait(1.0)
value = (convertGoldValue.getValue() as Int)
Debug.MessageBox(value + " is the value of items in your chest")
EndEvent
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...