Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Plugins & Mods

Quests::Plugins & Mods Completed plugins for public use as well as modifications.

Reply
 
Thread Tools Display Modes
  #1  
Old 05-07-2010, 04:59 PM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 2,071
Default plugin::RandomSay && plugin::RandomEmote

Hi! This is a sudden daily occurrence. But I made another plugin to simplify the making of scripts.

The plugin itself is fairly simple, you declare the amount of messages you want the plugin to execute, and then quote the messages after the declare.

There are two parts to this plugin function. RandomSay and RandomEmote. It works well for random npc says and random npc emotes (helpful when making aggro messages).

The number that you see below before the messages represents the amount of messages you want the NPC to take into account. It works 1-6 and that's it.

Hope you find this helpful. I'll probably be making more.

Code:
sub EVENT_SAY
{
plugin::RandomSay(6,"Yo","Yo2","Yo3","Yo4","Yo5","Yo6");
}

sub EVENT_SAY
{
plugin::RandomEmote(6,"Yo","Yo2","Yo3","Yo4","Yo5","Yo6");
}
Name this plugin, RandomMessages.pl in the plugins folder of your server.

Code:
	###Usage: plugin::RandomSay(numberofrandommessages,"message1","message2","message3","message4","message5","$message6");
	###Usage: plugin::RandomEmote(numberofrandommessages,"message1","message2","message3","message4","message5","$message6");
	###Akkadius of Blood of the Akkadian
	sub RandomSay {
		my $client = plugin::val('$client');
		my $Rsaycount = $_[0];
		my $message1 = $_[1];
		my $message2 = $_[2];
		my $message3 = $_[3];
		my $message4 = $_[4];
		my $message5 = $_[5];
		my $message6 = $_[6];
			if ($Rsaycount == 1)
			{
			quest::say(quest::ChooseRandom("$message1",));
			}
				if ($Rsaycount == 2)
				{
				quest::say(quest::ChooseRandom("$message1","$message2"));
				}
					if ($Rsaycount == 3)
					{
					quest::say(quest::ChooseRandom("$message1","$message2","$message3"));
					}
						if ($Rsaycount == 4)
						{
						quest::say(quest::ChooseRandom("$message1","$message2","$message3","$message4"));
						}
							if ($Rsaycount == 5)
							{
							quest::say(quest::ChooseRandom("$message1","$message2","$message3","$message4","$message5"));
							}
								if ($Rsaycount == 6)
								{
								quest::say(quest::ChooseRandom("$message1","$message2","$message3","$message4","$message5","$message6"));
								}
	}
		sub RandomEmote {
		my $client = plugin::val('$client');
		my $Emotecount = $_[0];
		my $emote1 = $_[1];
		my $emote2 = $_[2];
		my $emote3 = $_[3];
		my $emote4 = $_[4];
		my $emote5 = $_[5];
		my $emote6 = $_[6];
			if ($Emotecount == 1)
			{
			quest::emote(quest::ChooseRandom("$emote1",));
			}
				if ($Emotecount == 2)
				{
				quest::emote(quest::ChooseRandom("$emote1","$emote2"));
				}
					if ($Emotecount == 3)
					{
					quest::emote(quest::ChooseRandom("$emote1","$emote2","$emote3"));
					}
						if ($Emotecount == 4)
						{
						quest::emote(quest::ChooseRandom("$emote1","$emote2","$emote3","$emote4"));
						}
							if ($Emotecount == 5)
							{
							quest::emote(quest::ChooseRandom("$emote1","$emote2","$emote3","$emote4","$emote5"));
							}
								if ($Emotecount == 6)
								{
								quest::emote(quest::ChooseRandom("$emote1","$emote2","$emote3","$emote4","$emote5","$emote6"));
								}
			}
	
	return 1;
Reply With Quote
  #2  
Old 05-07-2010, 06:13 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

I haven't tested this yet, but I am pretty sure you can simplify that down to just the following and it won't have a limit to how many messages you can send and also doesn't require you to put the count of how many messages you are using:

Code:
###Usage: plugin::RandomSay("message1","message2", etc..);
###Usage: plugin::RandomEmote("message1","message2", etc..);

sub RandomSay {
	my $count = 0;
	while ($_[$count])
	{
		$count++;
	}
	my $RandMessage = plugin::RandomRange(0, $count);
	quest::say($_[$RandMessage]);
}

sub RandomEmote {
	my $count = 0;
	while ($_[$count])
	{
		$count++;
	}
	my $RandMessage = plugin::RandomRange(0, $count);
	quest::emote($_[$RandMessage]);
}

return 1;
Note that it does require the RandomRange plugin I made here:
http://www.eqemulator.org/forums/showthread.php?t=30421
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by trevius; 06-07-2010 at 03:03 AM..
Reply With Quote
  #3  
Old 06-07-2010, 03:05 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

I added a new chance field to the script I posted above as well as simplified them a bit.

Code:
###Usage: plugin::RandomSay(chance(1-100), "message1","message2", etc..);
# Example: plugin::RandomSay(50, "I'll get you!", "Get over here!", "That's it!");
sub RandomSay {
	my $chance = $_[0];

	# First roll to see if a message will be sent or not depending on chance
	my $RandomNum = plugin::RandomRange(1, 100);
	
	# Choose the random message to send and send it
	if ($RandomNum <= $chance)
	{
		$MessageCount = @_;
		my $RandMessage = plugin::RandomRange(1, $MessageCount - 1);
		quest::say($_[$RandMessage]);
	}
}

###Usage: plugin::RandomEmote(chance(1-100), "message1","message2", etc..);
# Example: plugin::RandomEmote(50, "dies", "falls to the ground", "keels over dead");
sub RandomEmote {
	my $chance = $_[0];
	
	# First roll to see if a message will be sent or not depending on chance
	my $RandomNum = plugin::RandomRange(1, 100);
	
	# Choose the random message to send and send it
	if ($RandomNum <= $chance)
	{
		$MessageCount = @_;
		my $RandMessage = plugin::RandomRange(1, $MessageCount - 1);
		quest::emote($_[$RandMessage]);
	}
}
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by trevius; 12-13-2010 at 11:16 AM..
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 04:44 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3