fairly simple script help

Post » Fri May 27, 2011 11:46 pm

Hey all....

I made a little mod that adds an island in seyda neen, and theres a house on it. When you check out the house, there is a note that tells the story about how the owner of the house was killed and one of the bandits in a nearby cave has the key. Its mostly journal driven, no npc to give the quest to get the key, just journal updates.

I have some questions about the scripting I need to make this work properly. I have 3 journal entries all set. One to put an entry about the note when you pick up the note

begin ds_lighthousenote

short done

if ( done == 1 )
return
endif

if ( onactivate == 1 )

journal ds_lighthousekey, 10
set done to 1
activate
endif

end

the second is on the key to the house

begin ds_lighthousekey

short onPCAdd

if ( onPCAdd == 1 )

journal ds_lighthousekey, 11


endif
end

and the third is on the rug inside the house, so when you step on the rug, that just puts an entry in that the house is now yours..

begin ds_lighthouserug

short doonce
if ( GetStandingPC == 1 )
journal ds_lighthousekey, 12
endif

end



The first script, which is attached to the note works perfectly,
the second one, attached to the key, works, but when you loot the key from the dead bandit, the pop up that says "your journal has been updated", shows up three times on screen. Why does it do that?
I haven't tested the third one yet, so I'm not sure if it works...
User avatar
Tania Bunic
 
Posts: 3392
Joined: Sun Jun 18, 2006 9:26 am

Post » Sat May 28, 2011 1:28 am

begin ds_lighthousekeyshort onPCAddif ( onPCAdd == 1 )	set onPCAdd to 0	if ( GetJournalIndex ds_lighthousekey < 11 )		journal ds_lighthousekey, 11	endifendifend


begin ds_lighthouserugshort doonceif ( GetStandingPC == 1 )	if ( GetJournalIndex ds_lighthousekey < 12 )		journal ds_lighthousekey, 12	endifendifend

User avatar
joannARRGH
 
Posts: 3431
Joined: Mon Mar 05, 2007 6:09 am

Post » Sat May 28, 2011 10:11 am

you're good, thanks man!
User avatar
Shianne Donato
 
Posts: 3422
Joined: Sat Aug 11, 2007 5:55 am

Post » Fri May 27, 2011 8:12 pm

One script left to do:
begin ds_lighthousenote_Scriptshort PCSkipEquipDontSaveObjectif ( PCSkipEquip == 1 )	if ( GetJournalIndex ds_lighthousekey < 10 )		Journal ds_lighthousekey 10		set PCSkipEquip to 0	else		set PCSkipEquip to 0	endifendifif ( MenuMode == 1 )	returnendifif ( OnActivate == 1 )	if ( GetJournalIndex ds_lighthousekey < 10 )		Journal ds_lighthousekey 10		Activate	else		Activate	endifendifend


I'd also like to point out a possible issue regarding Kir's ds_lighthouserug script: The GetStandingPC function will work if the player is actually standing on the rug. However, there are players (mostly Telvanni mages) who are constantly levitating. For them, the script can't work. If you want to cater for those players as well, you'll have to determine the rug's fringe coordinates and check if the player is hovering within that area:

begin ds_lighthouserug_Scriptif ( MenuMode == 1 )	returnendifif ( GetJournalIndex ds_lighthousekey < 12 )	if ( Player->GetPos x  >= -128 )		if ( Player->GetPos x  <= 200 )			if ( Player->GetPos y  >= 1000 )				if ( Player->GetPos y <= 1256 )					Journal ds_lighthousekey 12				endif			endif		endif	endifendifend

You'll need to alter the numbers according to your rug's coordinates.
User avatar
Aliish Sheldonn
 
Posts: 3487
Joined: Fri Feb 16, 2007 3:19 am

Post » Sat May 28, 2011 4:50 am

Tsk, tsk. First, the wrong variable, second, only one Activate per script is allowed.
begin ds_lighthousenote_Scriptshort OnPCEquip DontSaveObjectif ( OnPCEquip == 1 )	if ( GetJournalIndex ds_lighthousekey < 10 )		Journal ds_lighthousekey 10	endif	set OnPCEquip to 0endifif ( MenuMode == 1 )	returnendifif ( OnActivate == 1 )	if ( GetJournalIndex ds_lighthousekey < 10 )		Journal ds_lighthousekey 10	endif	Activateendifend


For the second script, the Z check is missed... and with it the script becomes extra cluttered. If those always-levitating players (never heard of such; to me, Levitation is useful once in a while and a friggin nuisance all the remaining time) are *really* that important, then a simple distance check could be used:
begin ds_lighthouserug_Scriptif ( MenuMode == 1 )	returnendifif ( GetJournalIndex ds_lighthousekey < 12 )	if ( GetDistance Player <= 80 )		Journal ds_lighthousekey 12	endifendifend

User avatar
Maria Garcia
 
Posts: 3358
Joined: Sat Jul 01, 2006 6:59 am

Post » Sat May 28, 2011 6:25 am

I'm sorry if I sounded disrespectful! That was not my intention. Yet I have to disagree on the variable: I used Erstam's script from MWSFD (v9, p. 175) as a basis, and it hasn't failed me yet. OnPCEquip is also declared in that script, yet it isn't used. Books seem to use PCSkipEquip. :shrug: And what's the problem with two Activate commands in a script? There's no way that both could be executed at the same time. I heard about using only one OnActivate in a script, but Activate?

For the second script, the Z check is missed... and with it the script becomes extra cluttered. If those always-levitating players (never heard of such; to me, Levitation is useful once in a while and a friggin nuisance all the remaining time) are *really* that important, then a simple distance check could be used:

I hadn't heard of constantly levitating players as well until I received error reports from them... (they were one of the reasons for RoHT 1.4). Anyway, you're right about the z-coordinate: I assumed a level Cell design, and your script design is much more elegant anyway.
User avatar
Catherine Harte
 
Posts: 3379
Joined: Sat Aug 26, 2006 12:58 pm


Return to III - Morrowind