Jump to content

Need some script advice


Duk3nat0r

Recommended Posts

Hi guys, I need some help with scripting please, and there are basicly three questions.

 

Background: I'm working on a house mod where you can buy upgrades for the house, and the only tutorials I found was about adding new upgrades to existing houses, so I had to build the quest from the ground up. I dont have any scripting background, so this is a first for me.

 

Question 1: I'm using the following script when buying an upgrade: (note the "xxxxxx" is just a place holder, since each upgrade differ)

 

Scriptname TIF__xxxxxxxx Extends TopicInfo Hidden

 

Function Fragment_0(ObjectReference akSpeakerRef)

Actor akSpeaker = akSpeakerRef as Actor

game.getplayer().removeitem(gold, tdNarmoHall.value as int)

decoratemarker.enable()

EndFunction

 

MiscObject Property Gold Auto

 

int Property GoldAmount Auto

 

ObjectReference Property DecorateMarker Auto

 

GlobalVariable Property tdNarmoHall Auto

What I need help with, is how do I script a three day delay before decoratemarker.enable() is enabled?

 

Question 2: Then, how do I make the option of this specific upgrade not appear in the dialog during the three day delay?

 

Question 3: In the games HousePurches quest, when an upgrade is purchesed the "GetVMQuestVariable" condition is set and "SolitudeHouseVar_var" (just an example) is used. Do I need this for my quest? And how do I set these var up?

 

Any help is welcome, tx!

Edited by Th3 Duk3
Link to comment
Share on other sites

Im just throwing out an idea because im not sure how well this would work, but for the three day delay the only thing i could think of without going crazy deep in advanced scripting would be to use utility.wait(500) 500 just being a random number as an example although im not sure how well this would work but im guessing not so well, adn you would definitely want it to be the last line of your script, other than that I assume their would be some way to get the current day of the week as a numerical value than have it add three and set a quest stage specifically made for activating the marker on that day, but im not that great with scripts, to be honest sounds like a lot more work than its worth.

 

As for the second question, you could do that by setting a condition to the dialogue topic, hope this helps and good luck

Link to comment
Share on other sites

I wouldn't use a utility.wait. It seems like it might be volatile. What I would do instead, is creation a spell that lasts for three days. Then cast it on the user. Now, attach a script to it. Add a Quest Property to the script. Then, using the OnEventStart event you can set the stage to a waiting stage, and use the OnEventFinish to set the stage to the current "completed house" level.
Link to comment
Share on other sites

:laugh:

someone already gave me this advice:

 

Utility.WaitGameTime(72); script pauses for 72 hours

MyObject.Enable()

 

I'll check to see if it works. But I still need some help with the other two questions.

Edited by Th3 Duk3
Link to comment
Share on other sites

You could try something like this in a new script attached to your quest.

 

Scriptname DecorateMyHouse extends Quest 
;assuming your quest name is... PlayerHomeQuest

Int PendingUpgrade

ObjectReference property decoratemarker01 auto ;chair marker
ObjectReference property decoratemarker02 auto ;table marker
ObjectReference property decoratemarker03 auto ;bed marker

;#2 I never play with dialogue but Im sure its really easy.
;#3 You dont think you need to mess with the VMQuestVariable for your custom house.


Event OnUpdate()
debug.trace(self + " Enabling house upgrade " + PendingUpgrade)
if (PendingUpgrade == 1)
	decoratemarker01.enable() ;chair
	return
elseif (PendingUpgrade == 2)
	decoratemarker02.enable() ;table
	return		
elseif (PendingUpgrade == 3)
	decoratemarker03.enable() ;bed
	return		
else 
	debug.trace(self + " Something went wrong..")
endif
EndEvent



;You can even get really crazy and design the function to handle the gold amount too i guess
function SetUpgrade(int _upgrade)
if (_upgrade == 1)
	PendingUpgrade = 1
	RegisterForSingleUpdateGameTime(72.0) ;In three days run the OnUpdate() block
	return
elseif (_upgrade == 2)
	PendingUpgrade = 2
	RegisterForSingleUpdateGameTime(72.0)
	return		
elseif (_upgrade == 3)
	PendingUpgrade = 3
	RegisterForSingleUpdateGameTime(72.0)
	return		
else 
	debug.trace(self + " Upgrade number not valid")
endif
endfunction

 

 

Then is your dialogue script just call the SetUpgrade(x) function where x is the upgrade you want.

 

Scriptname TIF__xxxxxxxx Extends TopicInfo Hidden

Function Fragment_0(ObjectReference akSpeakerRef)
Actor akSpeaker = akSpeakerRef as Actor
game.getplayer().removeitem(gold, tdNarmoHall.value as int)
;decoratemarker.enable() doing this different
PlayerHomeQuest.SetUpgrade(2) ;adds a table in three days
EndFunction


;<scriptName> Property <QuestName> Auto
DecorateMyHouse Property PlayerHomeQuest auto ;declare path to custom function

MiscObject Property Gold Auto 
int Property GoldAmount Auto 
;ObjectReference Property DecorateMarker Auto ; doesnt need to be here anymore 
GlobalVariable Property tdNarmoHall Auto

 

 

Its not perfect and doesnt handle every situation but I think its a good start.

Link to comment
Share on other sites

  • 2 weeks later...
  • Recently Browsing   0 members

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