The first version of questing is finally in the game. This initial version allows for item rewards, quest requirements to kill certain units or a certain amount, and having you go to certain areas. Additionally, it allows for multiple stages of dialogue with an NPC that include responses you can say to the NPC to control how he responds.
From the above video, the entire quest is shown, starting with him stating the requirements (and giving a few optional responses to choose from) and killing the 5 monsters to get your reward. The questing system is similar to how the Elder Scrolls series does questing, in that you have "stages" that represent progression of a quest. Certain actions result in progression to different stages, sometimes skipping around stages, and some stages have requirements while others don't.
For those curious, below is the script used for this quest. I unfortunately don't have the time to make the script that versatile, so you have to follow a pretty strict format for writing them, including no random spaces, or multi-line statements. The script is commented enough to give you an idea of how it all works. It should be noted that these scripts are tied to a specific unit (although more than one unit can be configured with the same dialogue script), and a unit is configured simply by setting unit->dialogue = Dialogue["ScriptName"]
# Kill 5 Skywatch for a reward (a very powerful sword).
#-------------------------------------------------------------------------------
# This part outlines what is required for each stage (starts at 1)
define stage_requirements 1
# This requirement is to kill 5 units with the display_name "Skywatch"
type=KILL_UNIT_TYPE
# For vector based values, pushes back each entry
unsigned_int_data=5
string_data=Skywatch
end_requirement
# Below is an example of a unit->dialogue_information[string_data] requirement, which in this case requires either
# a value of 1 or 2 to qualify for the requirement.
#type=VARIABLE
#string_data=Skywatch_Quest_Complete
#unsigned_int_data=1
#unsigned_int_data=2
#end_requirement
end_define
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# This part tells the script to create an equipment with the script identifier "Sword_Reward"
define item Sword_Reward
type=WEAPON
creator_id=0
owner_id=0
name=Sword Reward
inventory_sprite=Sword
size=1,3
sprite=longsword
base_attack_damage=200,400
attack_range=0.8
attack_rate=3.0
speed_modifier=1.0
end_define
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
define item Sword_Bad_Reward
type=WEAPON
creator_id=0
owner_id=0
name=Sword Reward
inventory_sprite=Sword
size=1,3
sprite=longsword
base_attack_damage=1,2
attack_range=0.8
attack_rate=0.5
speed_modifier=1.0
end_define
#-------------------------------------------------------------------------------
# Stage 0 - Quest statement
type@0=STATEMENT
statement@0=Please kill 5 Skywatch. Once you have killed 5, come back and I'll give you a great reward. It's pretty awesome...
action@0=NOTHING
next_stage@0=1
# Define options available for stage 0
# The option order is preserved, the number after @ represents what stage to go to when it is selected, and the string is what to show.
define options 0
option@3="Just give me the item or I'll kill you."
option@1=Lie and say you killed them already.
end_define
# Stage 1 - The reward (good job, ya dingus!)
# A stage that gives items will typically only show the reward message once unless you loop back into itself and
# have an option that changes the stage (such as "okay"). Also a give items stage won't reward items twice
# even if it is active multiple times. For repeatable quests, could add a way to keep giving rewards?
type@1=STATEMENT
statement@1=Thank you! You killed five Skywatch. Here's your reward, a sword. It's pretty good, I promise!
# This sets items_to_give[1] = std::shared_ptr<Equipment> Sword_Reward, defined above
items_to_give@1=Sword_Reward
action@1=GIVE_ITEMS
next_stage@1=2
type@2=STATEMENT
statement@2=Well uh, hope you like it, like I said, it's really strong! Right...?
action@2=NOTHING
set_variable@2=Skywatch_Quest_Complete=1
# For a stage with no requirements, it will automatically progress unless you have the next_stage direction
# back to itself. This is useful if doing something like an options menu, where you manually go to the next stage,
# or if this is the last stage.
next_stage@2=2
type@3=STATEMENT
statement@3=Okay okay! Here, take it. It's not that good...please don't be angry.
items_to_give@3=Sword_Bad_Reward
action@3=GIVE_ITEMS
set_variable@3=Skywatch_Quest_Complete=2
next_stage@3=4
type@4=STATEMENT
statement@4=I hope it was worth stealing...
action@4=NOTHING
next_stage@4=4
No comments:
Post a Comment