The layout I'm using at the moment is to give each NPC one interact script and then depending on what rank the player has use the - zap command attached to the proximity enter trigger in step 1 to send them to a specific step for that rank. When the player walks away from the NPC, the proximity exit trigger in the step returns the position to step 1 in case next time a player meets they're in a different rank.
In the specific step I attach a 'quest' flag to the player to keep a note of where they are in the story line.
When you've got a dozen ranks and a dozen story lines for each there's so many flags and if/else statements. It's copy/paste of the same code for - if <player.in_group> for the proximity triggers, chat triggers, damage triggers, etc. Any suggestions for a better, more concise layout?
Code: Select all
"Sith_Recruiter Assignment":
type: assignment
actions:
on assignment:
- trigger name:proximity toggle:true
- trigger name:chat toggle:true
- trigger name:click toggle:true
- trigger name:damage toggle:true
- lookclose toggle:true
on unavailable:
- chat "Hold on, I'm busy right now."
interact scripts:
- 10 Sith_Recruiter Introduction
'Sith_Recruiter Introduction':
type: interact
steps:
'1*':
proximity trigger:
entry:
script:
- if <player.in_group[Staff]> {
- zap 'step:2'
}
else if <player.in_group[Stormtrooper]> {
- zap 'step:6'
}
else if <player.in_group[Citizen]> {
- zap 'step:7'
}
else {
- zap 'step:10'
}
# Staff
'2':
proximity trigger:
exit:
script:
- zap 'step:1'
click trigger:
script:
- chat "How may I serve you?"
damage trigger:
script:
- chat "Forgive me!"
chat trigger:
'catch-all':
trigger: '/REGEX:\w+/'
script:
- chat "I'm sorry. I don't know what you're talking about."
# Stormtrooper
'6':
proximity trigger:
exit:
script:
- zap 'step:1'
click trigger:
script:
- if <player.flag[Quest]> == "" || player.flag[Quest]> == null {
- chat "This is a hard hat area."
- wait 1
- chat "Use /kit stormtrooper and put on your helmet."
- flag <player> "Quest:EmpireStepOne"
}
else if <player.flag[Quest]> == "EmpireStepOne" {
- if <player.equipment.helmet> == "[email protected]_helmet" {
- chat "Excellent work."
- flag <player> "Quest:EmpireStepTwo"
}
else {
- chat "Put on a Stormtrooper helmet that isn't damaged and right click the NPC."
}
}
else if <player.flag[Quest]> == "EmpireStepTwo" {
- chat "Blah blah blah."
- wait 1
- chat "Finished."
- flag <player> "Quest:!"
}
else {
- chat "This bit only runs when I've updated the quest and the flag is out of date so it's a nice catch-all."
- flag <player> "Quest:!"
}
damage trigger:
script:
- chat "Don't be silly."
chat trigger:
'catch-all':
trigger: '/REGEX:\w+/'
script:
- chat "I'm sorry. I don't know what you're talking about."
# Citizen
'7':
proximity trigger:
exit:
script:
- zap 'step:1'
click trigger:
script:
- chat "Have you come to serve the <&b>Empire<&f>?"
damage trigger:
script:
- chat "Don't be silly."
chat trigger:
'Empire':
trigger: '/Empire/'
script:
- chat "There are many skills you will learn along the way."
- wait 1
- chat "There are also many dangers you will face."
- wait 2
- chat "Are you sure you are ready to <&b>join<&f>?"
'Join':
trigger: '/Join/'
script:
- chat "The Rebel Alliance will be crushed beneath the Empire."
- execute as_server "manuadd <player.name> Stormtrooper"
- zap 'step:6'
'catch-all':
trigger: '/REGEX:\w+/'
script:
- chat "I'm sorry. I don't know what you're talking about."
# Default
'10':
proximity trigger:
exit:
script:
- zap 'step:1'
click trigger:
script:
- chat "Report to the Registration Clerk at the Ubrikkian Trade Tower."
damage trigger:
script:
- chat "Don't be silly."
chat trigger:
'catch-all':
trigger: '/REGEX:\w+/'
script:
- chat "I'm sorry. I don't know what you're talking about."