Scripts: The Chase after Thief

Post » Wed Sep 14, 2011 10:50 am

I'm working at an special event, where a thief shoots out the alley and bumps into the player. Then, we have a short dialogue with that thief about covering his/her tracks (we can agree or not). What's next, the thief hides in an another alley and two guards bumps, again, into the player asking about just spotted person.

As yet, I have this:

begin myscriptactivatorshort doonceif ( doonce == 1 )	returnelse	if ( GetDistance, Player < 512 )		set startrunning to 1 ;startrunning is a global variable		set doonce to 1	endifendifend


and the script pinned to the running thief:

begin myrunningscriptshort stateif ( state == 0 )	if ( startrunning == 1 )		set state to 1	else		return	endifelseif ( state == 1 )	AiTravel, -13140, 21705, 1546, 0	ForceRun	set state to 2elseif ( state == 2 )	if ( GetAIPackageDone == 1 )		set state to 3	endifelseif ( state == 3 )	AiTravel, -12911, 21052, 1568, 0	set state to 4elseif ( state == 4 )	if ( GetDistance, Player > 32 )		set state to 5	endifelseif ( state == 5 )	ForceGreetingelseif ( state == 6 )	AiTravel, -13518, 20432, 1561, 0	set state to 7elseif ( state == 7 )	if ( GetAIPackageDone == 1 )		AddSpell, "hideeffect"				set state to 8	endifelseif ( state == 8 )	returnendifend


State number 6 is set via dialogue box.

Unfortunately, ForceGreeting executes when the thief gets state 3 and his/her greeting is relooping all the time.
User avatar
jason worrell
 
Posts: 3345
Joined: Sat May 19, 2007 12:26 am

Post » Wed Sep 14, 2011 10:09 am

I just had a quick look and don′t that much about scripting in Morrowind yet but it seems that:

elseif ( state == 5 )	ForceGreetingelseif ( state == 6 )	AiTravel, -13518, 20432, 1561, 0	set state to 7


you forgot to change state from 5 to 6 when it is 5 like:


elseif ( state == 5 )	set state to 6	ForceGreetingelseif ( state == 6 )	AiTravel, -13518, 20432, 1561, 0	set state to 7


edit: just fixed an indentation problem in the code
User avatar
Kieren Thomson
 
Posts: 3454
Joined: Sat Jul 21, 2007 3:28 am

Post » Wed Sep 14, 2011 5:37 am

State number 6 is set via dialogue box, as I wrote this before (at 5 we have forcegreeting, so we have a short conversation with that thief; state 6 is set in Result box in dialogues"

However, I've found something odd:

if ( GetDistance, Player > 32 )


That's why the thief will talk with us no matter where we are. Fixed script should be:

if ( GetDistance, Player < 32 )


I'll test it and post a result, later.
User avatar
Joe Alvarado
 
Posts: 3467
Joined: Sat Nov 24, 2007 11:13 pm

Post » Wed Sep 14, 2011 3:53 pm

State number 6 is set via dialogue box, as I wrote this before (at 5 we have forcegreeting, so we have a short conversation with that thief; state 6 is set in Result box in dialogues"

However, I've found something odd:

if ( GetDistance, Player > 32 )


That's why the thief will talk with us no matter where we are. Fixed script should be:

if ( GetDistance, Player < 32 )


I'll test it and post a result, later.


Sorry, I completely missed your remark at the bottom about the dialog box but I do think you've found the problem right there in the operator.
User avatar
Jenna Fields
 
Posts: 3396
Joined: Mon Dec 11, 2006 11:36 am


Return to III - Morrowind