Advanced Scripting Help Needed

Post » Sat Feb 19, 2011 2:25 am

I'm new to modding and scripting alike. I've been working on creating my first quest and I've been trying to come up with a workaround for the fact that I don't have a mic to record new dialogue with. What I've come up with is creating a postal system. I have a few triggers in place already. I created some furniture vouchers for all of the buyable houses in Cyrodiil. I have also placed the "mailboxes" which are no more than chest containers outside of each house and gave them each editor IDs and left them disabled so that just like all the other furniture you wouldn't see them until you bought them. I also created a global variable named MailboxTotal so that the game could track how many of the mailboxes you had and use that to determine when the postal service becomes active. So now what I'm trying to figure out is a script that I can use to not only determine when mail is delivered, but make it so the mail is only delivered to the mailbox you are checking. In other words, when the time has come to check the mail, I don't want all of the mailboxes in Cyrodiil to have the same letter. I'm just trying to avoid some redundancy. Anyone have any ideas to help me along or even improve what i've already got set in place?
User avatar
Kelly Tomlinson
 
Posts: 3503
Joined: Sat Jul 08, 2006 11:57 pm

Post » Sat Feb 19, 2011 1:03 am

So you want to make sure the player gets each letter exactly once, but you don't know which mailbox they will turn up in - they should turn up in whatever mailbox he checks next after the letters become available? And there will be other letters in the future?
One way might be something like:
; quest scriptscn postOfficeScr; when you have a new letter you want delivered, add it to this arrayarray_var letters; initialization first time the mod is installedbegin gamemode  let letters := ar_Construct Array  stopQuest PostOfficeend

; attached to all mailboxesscn mailboxScrref letterbegin onActivate player  ; check the mail  while (ar_size PostOffice.letters) > 0    let letter := PostOffice.letters[0]    addItem letter 1    ; letter delivered    ar_Erase PostOffice.letters 0  loop  ; open the mailbox, letters will be inside  Activateend

User avatar
Skivs
 
Posts: 3550
Joined: Sat Dec 01, 2007 10:06 pm

Post » Fri Feb 18, 2011 8:54 pm

What Scruggsy has above will require OBSE.

What I would do is have a global variable so I know which letter should be delivered.
A script on each mailbox would then, when activated, check the global variable and put the necessary letter in the box before its opened.
Or no letter if the variable says that.

Simple and easy.

if myLetterGBL
== 0 then no letter
== 1 then letter #1
== 2 then letter #2
etc...

begin OnActivate   if myLetterGBL == 0      ;do nothing   elseif myLetterGBL == 1      set myLetterGBL to 0      addItem myLetter001 1   elseif myLetterGBL == 2      set myLetterGBL to 0      addItem myLetter002 1   elseif myLetterGBL == 3      set myLetterGBL to 0      addItem myLetter003 1   endif   Activateend


You would control which letter should be delivered in some other script since any script will change the value of a global variable and it will stay that value for all scripts that access it.
User avatar
butterfly
 
Posts: 3467
Joined: Wed Aug 16, 2006 8:20 pm

Post » Sat Feb 19, 2011 4:03 am

thank you both, those are both great ideas... i'll probably try willie's idea first because i'm not very familiar with OBSE. I have been trying to learn it but i think i'll finish getting my head wrapped around regular scripting before i try too much with the extended version...lol. If either of you two or anyone else is interested in contributing to this project let me know and i can email you my scripts and explainations of what i've done so far. I'm always open to collaboration. Thanks again everyone.
User avatar
Vicki Blondie
 
Posts: 3408
Joined: Fri Jun 16, 2006 5:33 am


Return to IV - Oblivion