Randomly Choose a quest::say()
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(x = y) means assign y to x and proceed if x is not 0.
if(x == y) means proceed if x is equal to y. |
Also, remember to always quote strings. You have it like this:
Code:
quest::say(Hello); Code:
quest::say("Hello"); |
So it should look something like this?
Code:
sub EVENT_SAY |
Works as intended now! Thanks again for the help. Much appreciated =)
I may have questions about your formation_tools.pl sometime as well Trev. Had a pretty nifty idea, and will try to execute before asking to much |
You should also think about using if and elsif statements so the server doesn't have to check each if statement even after it hit the right one and fired.
|
Or, you can always use plugin::RandomSay() to make it really easy. Here is the plugin if you don't already have it. I keep it in a file named messages.pl, but not sure what it is on the plugin SVN offhand.
Code:
###Usage: plugin::RandomSay(chance(1-100), "message1","message2", etc..); |
Thanks for the additional support. I didn't know how to really properly use the elseif commands, thought I felt like it was the right way to go. So I tried to use the same type of script I used for the random animations I was using.
I like the random say plugin, I definitely will use that! |
Quote:
Code:
sub EVENT_SAY |
Quote:
Ah ok, yeah I figured it would look kinda like that, however the formatting wasn't clear to me. Thanks for clarifying =) I can use this kinda knowledge for future ventures as well. Appreciate it. |
All times are GMT -4. The time now is 09:13 PM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.