Jump to content

Timer Trouble


David Brasher

Recommended Posts

In my mod, there is an organization with a rather large budget. It keeps its money in a chest. It spends 1000 gold per day on the work it does. I want the amount of gold in the chest to be decreased by 1000 each and every day. I know how to write a script that would remove 1000 once, or how to make a faulty timer that would remove 1000 every few seconds until the chest was empty, but I don't know how to make it happen once a day, every day. (Money is also being added to the chest on an irregular basis, so I can't just have a preplanned amount of gold in the chest for all the future days until it is empty.)

 

Here is part of one faulty script I tried which does not work:

 

(Object Script placed on the chest that holds the gold.)

 

Short GameHour

Short DoOnceX

 

Begin Gamemode

If ( GameHour == 12 && DoOnceX == 0 )

RemoveItem Gold001 1000

Set DoOnceX to 1

Endif

 

If GameHour == 13

Set DoOnceX to 0

EndIf

End

Link to comment
Share on other sites

And I guess you would need something to happen when its empty right :)?

I left that part out right now....

 

 

 

You would need something like Gamedayspassed to track how many days are passed.

Its not to track days after your script.. just in general..

You could take a look at the rent a bed scripts, its a good example...

You would need to have a variable that checks how many days are passed at the beginning and from there on you

could compare it with a variable..

 

Oh well, I will give an example :) :

 

--now it works...--

 

scn Script
short amount
short days
short daydifference
short done


Begin Gamemode
if done == 0
set daydifference to 0
set amount to 0
set days to Gamedayspassed
set done to 1
endif
if done == 1
if Gamedayspassed > days
 set daydifference to Gamedayspassed  - days
 set amount to 1000 * daydifference 
 removeitem Gold001, amount
 set done to 0
endif
endif
end

Link to comment
Share on other sites

Thanks for the suggestions, but there are some issues with them. My computer is rejecting most attempted uses of GameDaysPassed. They will not get past the auto script debug program. It will not allow the script to compile. The computer also gives an error message about the amount of gold. It says there is no quantity specified. I will have to fiddle with it some more.
Link to comment
Share on other sites

Indeed. I didn't test it ...

Strange fact (gamedayspassed)...I'll fiddle along and see what happens

----

my GameDaysPassed had a (.) dot after it :), remove it ....

Using (removeitem Gold001, amount) removed the error..

 

I'll test it inside the game now...

--------

Its works now.. Added 5k. And each day after 12am, 1 k was removed!

I'll edit the script above.. it was missing an endif as well...

Should have tested it...

 

Had anything planned for what happens when the chest hasn't got enough gold in it :P?

 

Good luck with your mod!

Link to comment
Share on other sites

Parallel evolution. My script is starting to work. Thanks for devoting so much time to this problem! My script is probably not as elegant and concise as yours. It is now looking sort of like this with seven blocks for the seven days of the week:

 

Set randvar to GetRandomPercent * 5

If ( GetDayofWeek == 6 && noonvar == 0 )

RemoveItem Gold001 750

RemoveItem Gold001 randvar

Set noonvar to 1

EndIf

 

I need to tinker with the random part. It is not random enough. The organization is supposed to spend about 1000 Septims per day, but it varies according to what is going in.

 

The organization does lots of important charity work, but alas, the leader is too free to spend, and a poor fund-raiser. Much of the fund-raising falls to the hapless adventurer. When the money runs out, people start suffering and perhaps even dying. The dedicated workers struggle along doing the best they can with no resources. And as a more concrete matter, the leader starts spamming you with all these messages about how short on funds the organization is. A message will pop up and annoy you every time you open one of your four main menus. The spam will stop when there is a sufficient amount of money in the box again. This mod is a bit like the Imperial Cult faction in Morrowind.

Link to comment
Share on other sites

Still in trouble with the gamedays then eh?

You could reduce the amount of blocks by using a var, to track if the gameday is changed.

 

like:

 

Script

short Day
short Done
float randvar

If Done == 0
Set Day to GetDayofWeek 
If day != GetDayofWeek 
 Set randvar to GetRandomPercent * 5
 set done to 1
EndIf
EndIf

If Done == 1
RemoveItem Gold001 750 
RemoveItem Gold001, randvar
Set noonvar to 1; .....
Set done to 1
EndIf

 

Are you going to use an empty or normal/repetetive quest for the messages then?

That would require a questscript that should track the amount of gold that is placed last time - the days gold has been removed .

(guessing).

You would need to have a var inside the quest, which will be adjusted from the containerscript. That should have a part that checks the amount of gold there was, the last time you've visited the cell.

Link to comment
Share on other sites

Thanks for the advice. I will have to see if I can reduce script size using some of these suggestions.

 

With the quest messages and quest stages, I am doing something strange. The game engine will not let you go back and redo an earlier quest stage once it has been completed. This is a major handicap. My mod is designed to be endless. You never get to the top of the guild and then have all the action abruptly stop. There is always supposed to be something to do.

 

So here I am at the end of the mod. This particular quest is now locked on stage 200 and will always remain there. There can be no more diary entries, and I am relying on things like messageboxes and note items. The worst part is that getstage can no longer be used on conditions. I find myself using items in inventory or not in inventory as tokens for conditions to determine what is going on with the quests. Each of three quest-givers will indefinitely continue giving out a series of about seven tasks respectively. The player will eventually get bored and move on, but I prefer it to the sudden ending when you get to the top of a faction.

Link to comment
Share on other sites

Then you should do it via the script. Like the achievements-mod..that will not have any stages at all...

You could always replace the stages by variables...with the GetQuestVariable- condition.

 

But haven't you tried repetitive stages then? The downside of that one is that it cannot be completed until you definitely say it will...

You'll always have a journal entry in the meantime and when you do set it to a completequest stage, it cannot be started again..

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