Jump to content

Mod and scripting help.


thegreatgamecreator

Recommended Posts

Okay I am working on a mod for oblivion and I need a set amount of money to be given to the player based on a set number of days. So for example you get payed 500 gold every 4 days or something like that. I know its possible but I don't see any scripting functions for a game timer. Also I am having trouble with an activator script in the script you activate the for sale sign and it asks you if you would like to buy the house I have gotten the yes and no buttons to work so if you say yes it will take away the price of the house and for no to exit the menu but I need to set it so that the script will check the players gold amount before letting them buy the home. I am having trouble with the formatting or something because I get a scripting error. I would really appreciate the help.
Link to comment
Share on other sites

For a timer, use this:

 

Float Timer

If Timer > 0
   Set Timer to ( Timer - GetSecondsPassed )
ElseIf Timer <= 0
   ;Do stuff
endif

 

 

That timer only keeps track of seconds in real time. To keep track of in-game days use this:

 

Short CurrentDay
Short GoldDay

Set CurrentDay to GameDaysPassed

If GoldDay >= CurrentDay - <however many days>
   Player.addItem F <amount>        ;"F" is a short term for Gold
   Set GoldDay to CurrentDay
endif

 

 

To get a count of how much money a player has:

 

Player.GetItemCount F

 

So in the code it would look like:

 

MessageBox "<whatever it says">

If <players choice> == <Yes>
   If Player.GetItemCount f >= 20000
        Player.removeItem f 20000
        ;Do other stuff
   else
      MessageBox "Not enough money :P"
    endif
Elseif <Players choice> == <no>
   ;Do stuff
endif

Link to comment
Share on other sites

Hey there I'm kind of new to scripting but you could try some of the following script to see if it helps you any.

 

(set script type - quest)

 


scn Goldpayment

float Day
short DayCount
short doonce

begin gamemode

if (doonce == 0) && (DayCount < 4)

set Day to GameDay
set DayCount to DayCount+1
set doonce to 1

endif

if (doonce == 1) && (Day != GameDay)

set Day to GameDay
set DayCount to DayCount+1
set doonce to 0

endif

if (DayCount == 4)

set DayCount to 0
Player.AddItem Gold001 500

endif

end

 

TES construction set - Character Tab - Quests - Right Click (New) - call it zgoldpayment

Make sure Start Game Enabled is ticked - Select the script 'Goldpayment'

 

This seems to work for me - can test ingame by going to bed or using the wait command (4x24 hours),

might need to play around with some of the above variables to get it the way you want - should see

the message that 500 gold has been added to your inventory when it works

 

Best of luck with your Mod :D

 

Another method as mentioned above is using the GameDaysPassed Variable which WarRatsG mentioned (though I didn't have any

luck getting his code example to work so I reworked it alittle and it seems to work now)

 


scn Goldpayment

begin gamemode

Short CurrentDay
Short GoldDay
short doonce

Set CurrentDay to GameDaysPassed

if doonce == 0

set GoldDay to CurrentDay+4
set doonce to 1

endif

If CurrentDay == GoldDay 

Player.addItem F 500
Set doonce to 0

endif

end

Edited by KMSvalley
Link to comment
Share on other sites

  • Recently Browsing   0 members

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