|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Quests::Q&A This is the quest support section |
|
|
|
04-09-2020, 11:16 PM
|
|
Sarnak
|
|
Join Date: Oct 2017
Location: Washington State
Posts: 54
|
|
Implementing plugins...some not working.
Hello folks!!
I posted this in the Discord as well. Figure might as well do same here.
Below I will post two scripts/code.
First one is a quest script "a_wood_elf_adventurer01" tied to a NPC that is spawned. Second is a plugin "wa_KillMode" that is used by the quest script.
Now, as it is. The "a_wood_elf_adventurer01" script almost work wonderfully by itself. What I wish to do is to cut that script up and make plugins.
The idea is to reduce script duplication, a common practice as seen many times over.
So here I am, I made the "wa_KillMode" plugin. BUT, now the "a_wood_elf_adventurer01" does not even call upon the new plugin.
I am having the same issue when I attempted to use Trevius's "plugin::RandomSay(chance(1-100), "message1","message2", etc..);" plugin.
They are just not firing it seems. HOWEVER, "plugin::RandomWeapons(1, 11169, 50, 200, 230);" works flawlessly as many other s do as well.
Perplexing to say the least. If anyone has ideas or knows what I am doing wrong, please let me know?
-War
|
|
|
|
|
|
|
04-09-2020, 11:17 PM
|
|
Sarnak
|
|
Join Date: Oct 2017
Location: Washington State
Posts: 54
|
|
The first script...
Code:
#::: Usage: Have this script name match the NPC name in the database.
#::: Created: 7April2020
#::: Author: Unknown, multiple folks have made the scripts and I just mushed them togather...WarAngel
#::: Description: To have a NPC create the illusion of other real world players running around.
#:::
sub EVENT_SPAWN
{
#$npc->TempName("Test_Name"); # Works but want a randomizer for names
my $wa_Diff = int(rand(10)); #picks a number 0-9
quest::settimer("wa_FeatureChange", 5); #5 seconds
quest::settimer("wa_RandomName", 7); #7 seconds
quest::settimer("wa_Decisions", 10 + ($wa_Diff)); #10 seconds + random (0-9)
}
#####################
#End of EVENT_SPAWN
#####################
sub EVENT_TIMER
{
##What do I want to do?##
if($timer eq "wa_Decisions" && !$npc->IsEngaged())
{
my $wa_intChoice = plugin::RandomRange(1, 100); #random int used localy
if ($wa_intChoice <= 20) #below or at 20
{
quest::debug("wa_intROLL BELOW 20 worked for ". $npc->GetName() .". Time to kill");
#wa_KillMode();
plugin::wa_KillMode();
}
if ($wa_intChoice > 20) #above 20
{
quest::debug("wa_intROLL ABOVE 20 worked for ". $npc->GetName() .". Time for peace");
wa_PeaceMode();
}
}
##Change my look here##
if($timer eq "wa_FeatureChange")
{
quest::stoptimer("wa_FeatureChange");
wa_ChangeLook();
}
##Change my name here##
if($timer eq "wa_RandomName")
{
quest::stoptimer("wa_RandomName");
my $wa_RanName = int(rand(3));
if ($wa_RanName == 0)
{
$npc->TempName("Test_Name_one");
}
if ($wa_RanName == 1)
{
$npc->TempName("Test_Name_two");
}
if ($wa_RanName == 2)
{
$npc->TempName("Test_Name_three");
}
}
}
###################
#End of EVENT_TIMER
###################
sub wa_KillMode
{
plugin::wa_KillMode();
#my @npc_list = $entity_list->GetNPCList();
#foreach $npc_ent (@npc_list)
#{
#quest::debug("Killmode begin for " . $npc->GetName() . ""); #This debug will repeat for each NPC in the GetNPCList()
#next if $npc_ent->GetLevel() > 2; # Enemy level parameters
#next if $npc_ent->GetID() == $npc->GetID(); #Lets not kill ourself
#next if $npc_ent->GetOwnerID(); #skip pets
#next if ($npc_ent->GetSpecialAbility(19) || $npc_ent->GetSpecialAbility(20) || $npc_ent->GetSpecialAbility(24) || $npc_ent->GetSpecialAbility(35)); #Immune to melee / magic / aggro / noharm SKIP
#next if $npc_ent->GetBodyType() == 11; #skip untargetable NPCs
#next if $npc_ent->IsEngaged(); # Is target in combat?
#next if $npc_ent->CalculateDistance($x, $y, $z) > 250; #skip mobs over 250 Distance
#quest::shout("I am coming for you, " . $npc_ent->GetCleanName() . "!");
#quest::SetRunning(1);
#$npc->AddToHateList($npc_ent, 1); #We now HATE HIM!
#quest::debug("Killmode end for " . $npc->GetName() . "");
#last; #we found a valid target jump out of the loop
#}
}
sub wa_PeaceMode
{
#quest::debug("PeaceMode begin for ". $npc->GetName() ."");
#quest::shout("Hiyas folks I am ". $npc->GetName() ."!"); #This worked
#quest::emote("Does the whole zone hear me!!"); #works but emote has a limited range
#plugin::RandomSay(chance(1-100), "Heyhey!!","How are you all doing?","How about it?"); #not working...even when I am on top of NPC
my $wa_intCHAT = plugin::RandomRange(1, 100); #random int used localy
if ($wa_intCHAT <= 50) #below or at 50
{
plugin::SetAnim("sit"); #options (stand/sit/duck/dead/kneel)
#quest::debug("wa_intCHAT Sarcastic chat");
}
if ($wa_intCHAT > 50) #above 50
{
plugin::SetAnim("stand"); #options (stand/sit/duck/dead/kneel)
#quest::debug("wa_intCHAT Positive chat");
}
#quest::debug("PeaceMode end for " . $npc->GetName() . "");
}
sub wa_ChangeLook
{
#quest::debug("ChangeLook begin");
plugin::RandomWeapons(1, 11169, 50, 200, 230); #Any random weapon available through S0F
plugin::RandomFeatures($npc); #Change facial features
#quest::debug("ChangeLook end");
}
|
|
|
|
|
|
|
04-09-2020, 11:18 PM
|
|
Sarnak
|
|
Join Date: Oct 2017
Location: Washington State
Posts: 54
|
|
The second script/plugin...
Code:
#Usage: plugin::wa_KillMode();
sub wa_KillMode
{
quest::debug("Killmode begin for " . $npc->GetName() . "");
my @npc_list = $entity_list->GetNPCList();
foreach $npc_ent (@npc_list)
{
#quest::debug("Killmode begin for " . $npc->GetName() . ""); #This debug will repeat for each NPC in the GetNPCList()
next if $npc_ent->GetLevel() > 2; # Enemy level parameters
next if $npc_ent->GetID() == $npc->GetID(); #Lets not kill ourself
next if $npc_ent->GetOwnerID(); #skip pets
next if ($npc_ent->GetSpecialAbility(19) || $npc_ent->GetSpecialAbility(20) || $npc_ent->GetSpecialAbility(24) || $npc_ent->GetSpecialAbility(35)); #Immune to melee / magic / aggro / noharm SKIP
next if $npc_ent->GetBodyType() == 11; #skip untargetable NPCs
next if $npc_ent->IsEngaged(); # Is target in combat?
next if $npc_ent->CalculateDistance($x, $y, $z) > 250; #skip mobs over 250 Distance
#quest::shout("I am coming for you, " . $npc_ent->GetCleanName() . "!");
quest::SetRunning(1);
$npc->AddToHateList($npc_ent, 1); #We now HATE HIM!
last; #we found a valid target jump out of the loop
}
}
return 1; #This line is required at the end of every plugin file in order to use it
|
|
|
|
04-09-2020, 11:21 PM
|
|
Sarnak
|
|
Join Date: Oct 2017
Location: Washington State
Posts: 54
|
|
Bear in mind I gave up on the
HTML Code:
#plugin::RandomSay(chance(1-100)
and started down the road on my own random chat...still in progress. But the debug shows it to work.
I just gave up on the plugin, although I wish I could use it.
|
04-10-2020, 07:17 PM
|
|
Sarnak
|
|
Join Date: Oct 2017
Location: Washington State
Posts: 54
|
|
Have my bugs worked out. Will post what I made so far soon in the custom post.
|
04-20-2020, 04:25 PM
|
|
Sarnak
|
|
Join Date: Oct 2017
Location: Washington State
Posts: 54
|
|
So it was just that this was missing in my sub script. All working and more now. Cheers!!
my $npc = plugin::val('$npc');
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 08:29 PM.
|
|
|
|
|
|
|
|
|
|
|
|
|