Part Six: hide npc; add/drop npc face; yes/no prompt; gold range x to y
This compact little quest is going to introduce four new mechanics which add more versatility to Daggerfall quests.
Code: Select all
Quest: TESTING5
DisplayName: No More Puns
-- Message panels
QRC:
QuestorOffer: [1000]
<ce> Go find _kid_.
RefuseQuest: [1001]
<ce> This quest is over.
AcceptQuest: [1002]
<ce> _kid_'s in _somewhere_.
QuestFail: [1003]
<ce> ???
QuestComplete: [1004]
<ce> All right.
Message: 1020
<ce> "My vision is augmented."
<ce>
<ce> Will you take _kid_ with you?
Message: 1021
<ce> What a shame. You were a good
<ce> %ra. What a rotten way to die.
Message: 1022
<ce> You may have copper wiring to re-route your
<ce> fear of pain, but I've got nerves of steel.
This is our ordinary dialogue section. The 102X section is all dialogue we're putting in which will be interactive, used in the prompting section.
Code: Select all
QBN:
Item _reward_ gold range 10 to 15
Person _questgiver_ group Questor male
Person _kid_ faction Children
Clock _timer_ 01:00
Place _somewhere_ local random
Among the usual commands, we've defined:
A gold sum, which will be randomly chosen between 10 and 15. By changing those two numbers, you can alter the amount of gold a quest uses. You can also make it a precise amount by choosing the same number twice (for example, range 350 to 350).
A person named _kid_. We've defined _kid_'s identity with the use of the "faction" trait which follows it, and the faction this time is "Children." Other kinds of traits are "group" and "factiontype." The methods of customizing a person can eventually become very complex.
A place within our city, _somewhere_, which is a local random. "Local" means within the same city, "random" means it could be nearly any quest location within the city.
Code: Select all
-- Quest start-up:
start timer _timer_
place npc _kid_ at _somewhere_
Now we've placed _kid_ at the randomly chosen location. Thankfully, the questgiver tells us where that'll be.
Code: Select all
_take_ task:
clicked npc _kid_
prompt 1020 yes _accompany_ no _stay_
clear task _take_
First we have a quest condition:
"When the player clicks the mouse on the NPC called _kid_,"
The actions that follow are:
1. "Set up a yes/no prompt which will use message 1020 as its text. If the player chooses 'yes,' we'll start the _accompany_ task. If the player chooses 'no,' we'll start the task _stay_."
2. "Reset the task _take_ so it can be repeated."
The resetting matter allows us to repeat quest actions. The intention is that this yes/no prompt would repeat in case we choose "no." If we don't do this, we'll get locked out of this interaction after choosing "no," which would make the quest unbeatable.
Changes made to the Say and Prompt commands prevent them from repeating during quests, but this is still important to know for other quest actions.
Code: Select all
_accompany_ task:
say 1021
hide npc _kid_
add _kid_ face
The "yes" choice, _accompany_, will make _kid_ disappear from our view. It will also add _kid_'s head onto our screen to represent, in narrative terms, that he/she is now "traveling with us." In reality it doesn't strictly mean that; the task itself just adds that face onto our screen, and doesn't mean anything more.
You'll notice the face added to your screen is very, very different from the _kid_ you talked to. Daggerfall only has so many faces to choose from, and they're all adults. These are just limitations that we work with. If someone decides to mod in more NPC faces, we can use them.
Code: Select all
_stay_ task:
say 1022
clear task _stay_
This is what happens if you choose "no." You'll get a text message, and nothing else will happen.
The "clear" task is once more used to ensure a task is repeatable.
Code: Select all
_qgclicked_ task:
clicked npc _questgiver_
_pcgetsgold_ task:
when _qgclicked_ and _accompany_
drop _kid_ face
give pc _reward_
end quest
_clearclick_ task:
when _qgclicked_ and not _accompany_
clear _qgclicked_ _clearclick_
_timer_ task:
end quest
The main new action here is "drop _kid_ face," which is the way to remove the face from your screen. It actually won't make a difference at this precise point since the end of the quest also wipes the face away, but it's still important to learn.
If this quest turns out differently from what's in the screenshots above, write about it and we'll see what went wrong.