Jump to content

Noob needs Scripting Help


blackbelt

Recommended Posts

I'm making a house mod that contains many quests and other things. This will be my first released mod and I need help with a couple scripts.

In my quest you help a man build a house. I need scripts to know how to set an amount of time (24hours) until the house is built.

So you talk to the man about the house and in 24 hours its built. How do i do this. (I'm using script Enable Ref to actually make the house appear.)

 

Also I need to know how after that time I add new AI Packages to the NPC who helps you buy the house.

 

And finally, how do I make a script that checks if you have enough Gold before removing it. Because if I use " Player.removeitem f 500"

and the player doesn't have 500gold he'll have -gold. For example if he has 400 gold his gold will go down to -100g.

 

I hope I didn't make this sound too confusing. Thanks

Link to comment
Share on other sites

Lol thanks for telling me the wiki. I found out how to do my other mod but I couldn't find out how to do the .enable for NPCs or how to add new packages to an NPC after a quest.

The syntax for enabling an NPC is to use <reference>.Enable. You need to have either a named, persistant reference, the reference ID of a persistant reference, or have that thing selected in game. Form IDs and editor IDs cannot be used in this case.

 

For AI, all AI that you want to remain on the NPC for any reasonable duration needs to be added to the base NPC in the CS, and controlled by having the conditions on that package match the conditions of that part of the quest. Packages added through scripting are temporary, and should be considdered unreliable for triggering any sort of event as these packages are cleared any time the NPC re-evaluates their packaging.

Link to comment
Share on other sites

Thanks a lot, I completely understand the AI thing now thanks to you. I think I understand what you're saying about the enabling NPC's, and I think I know how to make the condition that the player has the amount of gold. I'll try this all out thx. Lol I think this is the 4th or 5th time you've helped me out Vagrant0. Kudos.
Link to comment
Share on other sites

For your house construction (if you still want this aspect) the script would look something along the lines of this:

 

Short DoOnce
Short CurrentDay
Short DayCount

Begin GameMode

If DoOnce1 == 0 && GetStage QuestID == ##
If CurrentDay == 0
Set CurrentDay to GameDay
	Elseif CurrentDay != GameDay
	Set DayCount to DayCount + 1
	Set CurrentDay to GameDay
		If DayCount == 3
		HouseReferenceID.Enable
		Set DoOnce1 to 1
	Set DayCount to 0
	Setstage QuestID ##
	Set CurrentDay to 0
	endif
endif
endif
endif

 

For the line If DayCount == 3 change it to whatever number you want. Now, this will ONLY work if it's attached to a quest script because if it's on an object it won't run if they're not in the cell.

 

The Set CurrentDay to 0, found after SetStage command, can be used to build multiple houses without having to have a seperate CurrentDay variable for each house. Same goes with the Set DayCount to 0

 

This is the exact script I've used in my own mod so it is tested and fully functional. The only downside to this however, is since it runs during GameMode if the player decides to wait/sleep the script it paused, and if they wait/sleep again without waiting a few seconds it won't have the chance to update the DayCount (so if they don't wait a few seconds between each wait/sleep it could easily take an extra two, three, or more days for the house to be built.)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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