Hello again. After getting a problem solved yesterday involving randomly choosing pauses between actions in a loop I decided to try using that same idea with phrases said upon hail.
This semi works, in the sense that when a player hails the NPC, they emote and say things, however it says all the options given.
I'm not sure how it should be scripted, but basically I'm looking to have a player be able to Hail this NPC, or group of NPCs sharing the same name, and have the NPC randomly choose a response based on what is put in the $randomphrase values rolled by the RandomRange plugin.
Code:
sub EVENT_SAY
{
if($text=~/Hail/)
{
quest::emote("appears to be one of Zimora's chosen elite. Light glistens off the shined plate armor.");
# Random choice of phrases to be said
my $randomphrase=plugin::RandomRange(1,3);
if($randomphrase=1)
{
quest::say(Hello);
}
if($randomphrase=2)
{
quest::say(Hi);
}
if($randomphrase=3)
{
quest::say(Heya);
}
}
}
I used easy basic responses til I can get it to work out correctly. Appreciate the help in advance.