Calendar Related Script for Merchants

Post » Sat May 28, 2011 7:31 am

I have many merchants and shops in my mod, and am trying to come up with some ways to add interest to the bartering/mercantile process. If I recall correctly, I think in Arena (TES I), some special items were only available on certain days (like one of the Tamrielic holidays) from specific vendors. Therefore, you had to make sure you were in the right town and at the right shop on that particular day in order to buy these limited availability items. I always thought that was a great feature that added another layer of realism and interest to the game, and one that I wish was continued in Morrowind. So my question is, can any or all of the following be accomplished in Morrowind via script:

1. Have certain items only available for purchase on a particular day of the year (e.g. a holiday), month (e.g. first day of the month), or week (e.g. only on weekends). One of the latter 2 options may be more reasonable, as waiting a whole MW calendar year for one particular day may take way too long. Unless it's for something REALLY special, perhaps.
2. Have certain items "on sale" on a particular day. For example, half price on all long blades on the last day of each month...?
3. Make it so certain vendors will only sell to you if you are a member of a particular house, faction, etc. Or conversely, make them NOT sell to you if you are a member of a particular house or faction. I think this may already be a part of the game, but it's been so long since I've actually played, I can't remember...

Can any of the above be implemented via script fairly easily? It seems like they should be, but then again I'm not a scripting expert, so maybe not...? I am still in the idea stage with this, so I'd just like to find out first of all if any of it is even possible, then go from there. Any comments/advice welcome. Thanks in advance.
User avatar
Markie Mark
 
Posts: 3420
Joined: Tue Dec 04, 2007 7:24 am

Post » Sat May 28, 2011 10:19 am

1. Yes, easily. You just need to decide a range. On the first day, add them, on the last day if the merchant still has them, remove them. Something like:
short addedif ( day < 5 )   if ( added == 0 )      set added to 1      additem "stuff" 1   endifelseif ( day > 7 )   if ( added == 1 )      if ( getitemcount "stuff" > 0 )         removeitem "stuff" 1      endif   endifendif


2. I'm not sure. Maybe with MWSE, but it would be difficult, at best.

3. Yes, I think that's in the game already.
User avatar
CHARLODDE
 
Posts: 3408
Joined: Mon Apr 23, 2007 5:33 pm

Post » Sat May 28, 2011 6:27 am

Thanks peachykeen. That's good to know I can do at least some of this. Number 1 is definitely the most important; the ability to modify the price would've just been a bonus.

Just one question: In your example, when you refer to "day 5" and "day 7," are those counted from the beginning of each month, or from the beginning of the year? If the former, would I still be able to pinpoint a specific date in the year? For example, day X of month Y?

I am very happy that I can implement this feature. Actually writing the script will be the real challenge (for me), so I'm sure I'll be back with more questions as I develop this. Thanks again for your response!
User avatar
Curveballs On Phoenix
 
Posts: 3365
Joined: Sun Jul 01, 2007 4:43 am

Post » Fri May 27, 2011 9:28 pm

Thanks peachykeen. That's good to know I can do at least some of this. Number 1 is definitely the most important; the ability to modify the price would've just been a bonus.

Just one question: In your example, when you refer to "day 5" and "day 7," are those counted from the beginning of each month, or from the beginning of the year? If the former, would I still be able to pinpoint a specific date in the year? For example, day X of month Y?

I am very happy that I can implement this feature. Actually writing the script will be the real challenge (for me), so I'm sure I'll be back with more questions as I develop this. Thanks again for your response!

sure, just like most thing in scripting, you have to design it. much like i had to define a week in one of my scripts.

there's another problem you're going to have to work around as well. morrowind's default calender is missing the january anolog. you can set the date to this month, but next "december" 31, the next day will be "faburary" 1st. you're going to need to tell the game, in your script, to stop skipping "januarary".

to get the day of the month, depending on if the game tracks "day" by day of the month or day since you got off the boat, you may have to multiply by 30 (or divide by 2 then multiply by 30, and take the divided by two number and multiply that by 31, then add those totals together, depending on if the game has months with 31 and 30 days.... i forget)

check the UESPwiki's calender entry, it'll have information useful to you.
User avatar
Anthony Diaz
 
Posts: 3474
Joined: Thu Aug 09, 2007 11:24 pm

Post » Sat May 28, 2011 9:57 am

sure, just like most thing in scripting, you have to design it. much like i had to define a week in one of my scripts.

there's another problem you're going to have to work around as well. morrowind's default calender is missing the january anolog. you can set the date to this month, but next "december" 31, the next day will be "faburary" 1st. you're going to need to tell the game, in your script, to stop skipping "januarary".

to get the day of the month, depending on if the game tracks "day" by day of the month or day since you got off the boat, you may have to multiply by 30 (or divide by 2 then multiply by 30, and take the divided by two number and multiply that by 31, then add those totals together, depending on if the game has months with 31 and 30 days.... i forget)

check the UESPwiki's calender entry, it'll have information useful to you.


Yes I recall that one of the months was missing. Wasn't there mod or patch that fixed that? You lost me on the last part of your arithmetic explanation... Are you saying that if I place "day 5" (for example) in my script, that's not the 5th day of the month, but the 5th day after getting off the boat to start the game? I guess that would make it a bit trickier, but doesn't every game start on the same day (3rd Day of Last Seed or something like that?) So that day (whatever it is - I'll have to check) is day 1, and all subsequent days would be counted from that day? But I can see how the missing month would throw things off in that scenario, if that is indeed how the system tracks the days... Thanks for the info. I will check the UESPwiki.
User avatar
Danny Warner
 
Posts: 3400
Joined: Fri Jun 01, 2007 3:26 am

Post » Fri May 27, 2011 7:26 pm

Yes I recall that one of the months was missing. Wasn't there mod or patch that fixed that? You lost me on the last part of your arithmetic explanation... Are you saying that if I place "day 5" (for example) in my script, that's not the 5th day of the month, but the 5th day after getting off the boat to start the game? I guess that would make it a bit trickier, but doesn't every game start on the same day (3rd Day of Last Seed or something like that?) So that day (whatever it is - I'll have to check) is day 1, and all subsequent days would be counted from that day? But I can see how the missing month would throw things off in that scenario, if that is indeed how the system tracks the days... Thanks for the info. I will check the UESPwiki.

yes, i'm saying i am not sure if the global variable "day" is the day of the month, or if it is "the day since you got off the boat" because despite starting on the third, it is "day 1"

there's prolly a mod that fixes the calender bug. might check to see if it falls under scope of MCP. i know you can console (and thus script) januaray into the game with no real ill effect, so it'd just be a simple global tribunal startscript. not really as complex as it sounds =D

now synching to the calender in an existing game might provide more of a challenge. just experiment to see exactly how the day and month globals work, and construct something from that.
User avatar
Code Affinity
 
Posts: 3325
Joined: Wed Jun 13, 2007 11:11 am

Post » Fri May 27, 2011 9:10 pm

yes, i'm saying i am not sure if the global variable "day" is the day of the month, or if it is "the day since you got off the boat" because despite starting on the third, it is "day 1"

there's prolly a mod that fixes the calender bug. might check to see if it falls under scope of MCP. i know you can console (and thus script) januaray into the game with no real ill effect, so it'd just be a simple global tribunal startscript. not really as complex as it sounds =D

now synching to the calender in an existing game might provide more of a challenge. just experiment to see exactly how the day and month globals work, and construct something from that.


Thanks RAK. I guess I'll just have to test out a few things and see how it all shakes out. Hopefully I can get some form of this to work. Should be fun if I can. Thanks again for your input.
User avatar
adam holden
 
Posts: 3339
Joined: Tue Jun 19, 2007 9:34 pm

Post » Sat May 28, 2011 12:02 am

MCP does patch the calendar

ST
User avatar
Veronica Martinez
 
Posts: 3498
Joined: Tue Jun 20, 2006 9:43 am

Post » Fri May 27, 2011 9:16 pm

yes, i'm saying i am not sure if the global variable "day" is the day of the month, or if it is "the day since you got off the boat" because despite starting on the third, it is "day 1"


Day does return the day of the month

Dayspassed returns how many days it has been since you got off the boat.

So right off the boat, Im at day 1, which is the 16th of Last Seed. And Rak you mentioned the 3rd, why am I starting on the 16th?
User avatar
Marine x
 
Posts: 3327
Joined: Thu Mar 29, 2007 4:54 am

Post » Sat May 28, 2011 7:07 am

Day does return the day of the month

Dayspassed returns how many days it has been since you got off the boat.

So right off the boat, Im at day 1, which is the 16th of Last Seed. And Rak you mentioned the 3rd, why am I starting on the 16th?

i didnt, maneki did. i didnt check it or correct him =D

good nugget of info about day and dayspassed. i remember there was a script where i had to get around day resetting for the month, but i was too lazy to open the CS and look at the global i was using, lol.
User avatar
Nicole Mark
 
Posts: 3384
Joined: Wed Apr 25, 2007 7:33 pm

Post » Sat May 28, 2011 6:07 am



ST: Thanks for confirming the calendar patch in MCP.

metalfiend00: Regarding the start date of the 16th vs. 3rd, yes that was my fault for pulling the date out of my head w/o checking... (hey I was only 13 days off; not bad for someone who hasn't even played this game in 3-4 years). :) And thanks for clarifying day vs. dayspassed. For my purposes, that is obviously an important distinction.

Thanks again to all for your valuable input. I am anxious to start writing this script and testing it out (at which point I will be back here asking why it doesn't work). :D
User avatar
Lily Something
 
Posts: 3327
Joined: Thu Jun 15, 2006 12:21 pm

Post » Fri May 27, 2011 7:50 pm

metalfiend00: Regarding the start date of the 16th vs. 3rd, yes that was my fault for pulling the date out of my head w/o checking... (hey I was only 13 days off; not bad for someone who hasn't even played this game in 3-4 years). :)

hehe, I was just checking to make sure i wasn't experiencing a bug. Didn't mean to come off as the all knower :rofl:
User avatar
Jessica Thomson
 
Posts: 3337
Joined: Fri Jul 21, 2006 5:10 am


Return to III - Morrowind