Difference between revisions of "A beginner's guide, lesson 7 - Using Scripts in Quests"

Jump to navigation Jump to search
→‎The Final Chamber: Blair's conversation
imported>Pyrocow2
m (→‎The Final Chamber: undoing changes to script)
imported>Pyrocow2
(→‎The Final Chamber: Blair's conversation)
Line 647: Line 647:
I also want to make sure that the player, no matter how good they are at sneaking, will be forced to confront Blair. How do we do this? Easy, we script it. We will also design the quest so that you will have to kill Blair to move on to the next stage. We can also do this through scripts.
I also want to make sure that the player, no matter how good they are at sneaking, will be forced to confront Blair. How do we do this? Easy, we script it. We will also design the quest so that you will have to kill Blair to move on to the next stage. We can also do this through scripts.


Attach this script to the Blair NPC:<br>
Add a new variable to the main quest script called ''BlairGreeted''. Then attach this script to the Blair NPC:<br>
<pre>Scriptname BGBlairScript
<pre>
 
SCN BGBlairSCRIPT
Short DoOnce


Begin OnDeath
Begin OnDeath
 
SetStage BGM001 95
  SetStage BGM001 95
 
End
End


Begin GameMode
Begin GameMode
If BGM001.BlairGreeted == 0
If GetDistance Player <= 500
StartConversation Player GREETING
EndIf
EndIf
End
</pre>


  If ( GetStage BGM001<95 ) && ( DoOnce == 0 )
Then set up the new ''GREETING''.
 
    If ( Player.GetDistance BGBlairRef <= 500)
      StartConversation Player BGMBlairGreet
      Set DoOnce to 1
    EndIf
 
  EndIf
 
End</pre>
 
We now have to set up the conversation. We use the conversation tab rather than the topic tab. Also set this conversation up as a goodbye, to terminate any further discussion.


{| border="1" cellpadding="5"
{| border="1" cellpadding="5"
!colspan=2| '''GREETING'''
|-
|-
CONVERSATION
TOPIC TEXT
BGMBlairGreet
"GREETING"
|-
|-
!  RESPONSE
!  RESPONSE
|  "You are a fool for coming here. Now prepare to die."
|  "I heard you've been snooping around. Prepare to die!"
|-
|-
!  CONDITIONS
!  CONDITIONS
|   
|   
* GetIsId  BGBlair == 1
* GetIsID 'BGBlair' == 1
* GetStage BGM001 >= 80
* GetStage 'BGM001' >= 80
|-
|-
!  ADD TOPICS
!  ADD TOPICS
Line 690: Line 684:
|-
|-
!  RESULT SCRIPT
!  RESULT SCRIPT
| ''No result script''
|
|}
<pre>
Set BGM001.BlairGreeted to 1
StartCombat Player
</pre>
|}
 
In order for this to actually work, we need to change Blair's [[aggression]] stat so that he doesn't attack the player on sight (the topic result script will initiate combat for us). Open up the Blair NPC form, and click the AI button. In ''AI Attributes'', set ''Aggression'' to 0.


When the PC kills Blair, we can also update the journal by adding an entry for stage 95.
When the PC kills Blair, we can also update the journal by adding an entry for stage 95.
Anonymous user

Navigation menu