Difference between revisions of "A beginner's guide, lesson 7 - Using Scripts in Quests"
Jump to navigation
Jump to search
A beginner's guide, lesson 7 - Using Scripts in Quests (edit)
Revision as of 23:37, 14 August 2010
, 23:37, 14 August 2010→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. | ||
Add a new variable to the main quest script called ''BlairGreeted''. Then attach this script to the Blair NPC:<br> | |||
<pre> | <pre> | ||
SCN BGBlairSCRIPT | |||
Begin OnDeath | Begin OnDeath | ||
SetStage BGM001 95 | |||
End | End | ||
Begin GameMode | Begin GameMode | ||
If BGM001.BlairGreeted == 0 | |||
If GetDistance Player <= 500 | |||
StartConversation Player GREETING | |||
EndIf | |||
EndIf | |||
End | |||
</pre> | |||
Then set up the new ''GREETING''. | |||
{| border="1" cellpadding="5" | {| border="1" cellpadding="5" | ||
!colspan=2| '''GREETING''' | |||
|- | |- | ||
! | ! TOPIC TEXT | ||
| | | "GREETING" | ||
|- | |- | ||
! RESPONSE | ! RESPONSE | ||
| " | | "I heard you've been snooping around. Prepare to die!" | ||
|- | |- | ||
! CONDITIONS | ! CONDITIONS | ||
| | | | ||
* | * GetIsID 'BGBlair' == 1 | ||
* GetStage BGM001 >= 80 | * GetStage 'BGM001' >= 80 | ||
|- | |- | ||
! ADD TOPICS | ! ADD TOPICS | ||
Line 690: | Line 684: | ||
|- | |- | ||
! RESULT SCRIPT | ! 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. |