View Single Post
  #4  
Old 08-27-2020, 06:21 AM
Nerdgasm
Discordant
 
Join Date: Apr 2013
Posts: 426
Default

Sure is, here is the script, so people can see examples if they need help, like I did!

Code:
if($class eq "Warrior")
		{
			if($text=~/hail/i)
			{
				$client->Message(315,"$npcname whispers to you, 'My name is $npcname, I can help you [$train] in some spells if you have the required [$currency].'");
			}	
			elsif($text=~/train/i)
			{
				$client->Message(315,"$npcname whispers to you, 'As a Brawler you can learn abilities from three different [$trees].'");
			}
			elsif($text=~/currency/i)
			{
				$client->Message(315,"$npcname whispers to you, 'When you level up you get a new currency. Bring that to me and you will be able to buy a ability. Do you want to see how many spell token you [$have]?'");
			}
			elsif($text=~/trees/i)
			{
				$client->Message(315,"$npcname whispers to you, 'Yes, you can learn abilities from [$melee], [$warcries] or you can learn abilities from the [$combat] tree.'");
			}
			elsif($text=~/have/i)
			{
				if(quest::get_data($client->CharacterID() ."-Spell-Currency"))
				{
					$key = $client->CharacterID() . "-Spell-Currency";
					$client->Message(315,"$npcname whispers to you, 'You have " . quest::get_data($key) . " spell currencies.'");
				}
				elsif(!quest::get_data($client->CharacterID() ."-Spell-Currency"))
				{
					$client->Message(315,"$npcname whispers to you, 'You do not have a currency, level up and give one to me.'");
				}
			}
			if(quest::get_data($client->CharacterID() ."-Spell-Currency"))
			{
				if($text=~/melee/i)
				{
					$client->Message(315,"'Select Level'");
					$client->Message(315,"'[$L2] - [$L6] - [$L11]");
				}
				if($text=~/Level Two/i)
				{
					$client->Message(315,"$npcname whispers to you, 'I can give you [$WW] at Level Two.'");
				}
				if($text=~/Whirlwind/i)
				{
					$client->Message(315,"$npcname whispers to you, 'To make sure, you are Level Two, and you want Whirlwind R. I, if so, please say [$so]. These currencies are non-refundable and if you get a spell higher level then you, you will not be able to refund it for a spell your level. Please make sure you are the correct level.'");
				}
				if($text=~/so/i)
				{
					$client->Message(315,"$npcname whispers to you, 'Alright, here you go, $name.'");
					quest::set_data ($key, quest::get_data ($key) - 1);
					quest::summonitem(447);
				}
			}
		}
				else
				{
					$client->Message(315,"$npcname whispers to you, '$name, you are not of the classes that I can help, please obtain server files from the MOTD link of Discord and come back. You won't regret it!'");
				}
}

sub EVENT_ITEM
{
$npcname = "Raj";

	if($class eq "Warrior")
	{
		if(plugin::check_handin(\%itemcount, 2087 => 1))
		{
			if(!quest::get_data($client->CharacterID() ."-Spell-Currency"))
			{
				$key = $client->CharacterID() . "-Spell_Currency";
				$client->Message(315,"$npcname whispers to you, 'Thank you for this, $name. You now have 1 spell currency that you can use to buy an ability!'");
				quest::set_data($key, 1);
				$client->Message(315,"$npcname whispers to you, 'NOTE! You can only have ONE Spell Currency at a time! Do not turn more then 1 into me or you will NOT get credit.'");
			}
			elsif(quest::get_data($client->CharacterID() . "-Spell-Currency"))
			{
				$key = $client->CharacterID() . "-Spell-Currency";
				$client->Message(315,"$npcname whispers to you, 'This means you have another currency.'");
				quest::set_data ($key, quest::get_data ($key) + 1);
			}
		}
	}
}
Probably an easier way to write it, but hey it works!
__________________
I am the All Mighty Mittens!
Reply With Quote