close a dialog before it starts

Post » Sun Jan 03, 2010 1:56 am

Hi, I'm a complete newb to scripting, and modding in general (I've made a house once, but nothing more than that)

So, I'm trying to create a mod that won't allow dialog when the pc is silenced, but I'm not sure if I should put a return in my scripting.

Here's what I have so far:
begin my_scriptnameshort OnNPCActivateif ( GetEffect sEffectSilence == 1 )	if ( OnNPCActivate == 1 )	messagebox "You are silenced and cannot speak"	endifendif


Should I put in a return? if so, where? Also, is there anything wrong with this script?

Edit: fixed code
User avatar
Melly Angelic
 
Posts: 3461
Joined: Wed Aug 15, 2007 7:58 am

Post » Sat Jan 02, 2010 9:50 pm

i'm not sure if that would work, as it would have to be attached to every NPC, or you'd need a MWSE script looking for valid targets the whole time.

i think it would be much more effective to use a high priority greeting (right under the oath of silence) that checks for the silence effect. i forget if dialog can actually check for spell effects, but if not, just add a global script that checks the PC for this effect, and if true, sets a global variable to 1 so that the dialog can be properly filtered.

the greeting would then need "goodbye" in the results box. the actual body of the greeting can be the "You are silenced and cannot speak" text.
User avatar
Logan Greenwood
 
Posts: 3416
Joined: Mon Jul 30, 2007 5:41 pm

Post » Sun Jan 03, 2010 3:05 am

Your script is fine as far as I can tell but will only work for the NPC or NPC's that it is attached to. It would be easier to use a dialog response for this. First create a global short variable IAmSilent then start a script on the player:

begin my_scriptnameif ( GetEffect sEffectSilence == 1 )	set IAmSilent to 1else	set IAmSilent to 2endif


Next create a new greeting in section 1 directly below the first greeting:
"What? Well if you're not saying anything I'm not wasting my time with you."
In this greeting put "goodbye" in the results box with no quotes.
User avatar
Russell Davies
 
Posts: 3429
Joined: Wed Nov 07, 2007 5:01 am

Post » Sun Jan 03, 2010 8:50 am

Like I said, I'm a total newb, but wouldn't the dialog have to be dependent on the IAmSilent global? How would I set that up? Also, how do I attach the script to the pc?
User avatar
The Time Car
 
Posts: 3435
Joined: Sat Oct 27, 2007 7:13 pm

Post » Sat Jan 02, 2010 9:52 pm

yes, the dialog would be dependent on that variable. to make it so, open the dialog editor in the CS, go to the greetings tab, select category 0 (the game scans the dialog, top to bottom, looking for the first entry that it meets the criteria of. by placing it high in greeting 0, you can be assured that it will override most other greetings. just dont put it before the oath of silence greeting, that breaks things)

for the conditional, select "global" after you have created the variable. the second dropdown box will give you a selection of all the globals, you'll need to pick yours out.

to get the script that checks the player for the silence effect to work properly, you should make it a tribunal startscript. you CAN do this without tribunal, but this involves modifying the "main script" or some other thing that does not insure foolproof compatibility. the tribunal startscript way is overall easier and more compatible.

oh, and i'm pretty sure you'll want to turn
if ( GetEffect sEffectSilence == 1 )
into
if ( player->GetEffect sEffectSilence == 1 )


if you use this code, you'll want the dialog conditional to be "1". dont make other greetings for 2 or 0, the variable is only 1 when you are silenced. if the variable is some other value, it will be ignored.
User avatar
Brιonα Renae
 
Posts: 3430
Joined: Mon Oct 22, 2007 3:10 am

Post » Sat Jan 02, 2010 6:41 pm

sweet thanks. is there an easy way to change my script to a startscript?
User avatar
Steve Fallon
 
Posts: 3503
Joined: Thu Aug 23, 2007 12:29 am

Post » Sat Jan 02, 2010 10:46 pm

sweet thanks. is there an easy way to change my script to a startscript?


Very simple actually;

Gameplay-> Edit Start Scripts-> Add Script
User avatar
Bedford White
 
Posts: 3307
Joined: Tue Jun 12, 2007 2:09 am


Return to III - Morrowind