Using Dialog For Creatures And making Them Attack

Post » Fri May 27, 2011 5:20 am

The player comes across a Lich with 2 bonewalkers by it's side. I want the Lich to 'greet' the players, then the 3 of them will attack. I know how to do this with NPCs, but this seems different. Can anyone explain how I would do this?
User avatar
Kate Murrell
 
Posts: 3537
Joined: Mon Oct 16, 2006 4:02 am

Post » Fri May 27, 2011 5:34 pm

There are probably several ways to skin this cat, so I think you'll have some choices in how to go about it. You could simply set the AI fight on all three to 30 so the player can walk up and initiate dialogue and then have the lich start combat from the dialogue re[censored]s.. You'll probably have to script the bonewalkers to get them going though...

Alernatively, you could set a script on the lich for forcegreeting, and then change the value of a local or global variable while in dialogue. then the script could simply react to the changed variable with changed fight as a result. There are a few options there that you can work to your best ideal.
User avatar
KRistina Karlsson
 
Posts: 3383
Joined: Tue Jun 20, 2006 9:22 pm

Post » Fri May 27, 2011 3:21 pm

Ok. I've set all 3 AI's to Fight: 30. I also have a script attached to the lich:

begin piratelich

if ( doonce == 1 )
return
endif

if ( GetDistance Player <=256 )
Force Greeting
Messagebox "You will die!!"
set doonce to 1
StartCombat Player

endif

end


The lich's dialog pops up, and they all attack, which is what i'm looking for. The only problem is the dialog seems to keep popping up, and stays for a period of time. It also takes up too much of the screen, blocking combat. I know the doonce command isn't correct, but i'm not sure how I would place it correctly. I'd also like to have a better way to present the dialog, such as in a normal dialog box, like what you'd find when initiating dialog with an NPC. That way the player can read it, and click 'Close" to close the box and start combat.
User avatar
Euan
 
Posts: 3376
Joined: Mon May 14, 2007 3:34 pm

Post » Fri May 27, 2011 5:05 pm

Ok. I've set all 3 AI's to Fight: 30. I also have a script attached to the lich:

begin piratelich

if ( doonce == 1 )
return
endif

if ( GetDistance Player <=256 )
Force Greeting
Messagebox "You will die!!"
set doonce to 1
StartCombat Player

endif

end


The lich's dialog pops up, and they all attack, which is what i'm looking for. The only problem is the dialog seems to keep popping up, and stays for a period of time. It also takes up too much of the screen, blocking combat. I know the doonce command isn't correct, but i'm not sure how I would place it correctly. I'd also like to have a better way to present the dialog, such as in a normal dialog box, like what you'd find when initiating dialog with an NPC. That way the player can read it, and click 'Close" to close the box and start combat.

Your script isn't running correctly, probably because you didn't declare doonce as a short variable (unless you just didn't copy that part).

Also, when you use forcegreeting you shouldn't need a messagebox, and there shouldn't be a space between force and greeting.

Assuming that you have something you want the lich to say to the player, you will want to create a dialogue and you can put the startcombat in the dialogue results box for that conversation.


Here's an example of what your script might look like:

Begin  Piratelichshort doonce If ( Menumode == 1 ) 	Return endIf  If ( doonce == 1 ) 	Return endIf if ( GetDistance Player <=256 )        ForceGreeting        set doonce to 1endifend Piratelich

User avatar
Teghan Harris
 
Posts: 3370
Joined: Mon Mar 05, 2007 1:31 pm

Post » Fri May 27, 2011 12:52 pm

Ahh, ok. That seems very simple. Thanks.

Edit: I assumed that above script also works for a lone NPC, but I was wrong. The NPC does initiate the greeting once the player gets close, but after I close the dialog box, nothing happens.

I have this in the Results box:

SetFight 100
StartCombat 100

I also have the above script attached to the NPC. I managed to work around this in one instance by adding a Topic within the greeting and placing the SetFight and StartCombat commands in Results box of the Topic. But after needing to use the ForceGreeting option again and running into the same problem, i'm convinced there's a better way. Also, an NPC allows the player to leave willingly. If they come back, the NPC will force a greeting, then attack. I know about the Talked To PC function, but since a script is already attached, i'm not sure what's going to happen with the ForceGreeting option within it. So i'd like to know how to do this as well. Any help?
User avatar
Neliel Kudoh
 
Posts: 3348
Joined: Thu Oct 26, 2006 2:39 am


Return to III - Morrowind