PDA

View Full Version : Fake players...npc_player scripts


WarAngel
04-14-2020, 11:25 PM
I finally feel ok with posting this first draft of an idea I had. Two files, one is for any npc you wish to simulate as a random player. The other (plugin) supports the first.

I hope the info in the scripts explains what is needed to do. If not please feel free the PM me. Any questions will enable me to better narrate how to use my silly scripts.

I am a solo player, running my own private server. The world felt a bit empty. So I started to see about filling it in a bit. For example, I no longer feel alone seeing "newbie" players (npc_player) in Kelethin...running around killing mob next to me.

You might want to change the random names...add more etc. This is an organic work. I do plan on expanding the capabilities. Better name choice, etc. But for now the npc_player running around and being a newbie works well.

Scripts posted below...

WarAngel
04-14-2020, 11:27 PM
####################################
#:: Usage: Have this script name match the NPC name in the database. Make sure to set a unique faction for you "player_npc" or not and see what happens!! :-)
#:: Also include the wa_Plugins.pl plugin I made into .../directory/plugins...
#:: Created: 7April2020
#:: Version: wa_1.00
#:: Author: Others have made the scripts and I just mushed them togather, and created a bastard child...WarAngel.
#:: Description: To have a NPC create the illusion of other real world players running around.
#:: With help from: TurmoilToad,Salvanna,Akkadius,Trust,Kinglykrab
#:: Plugins: Plugins...plugin::wa_KillMode(); plugin::RandomRange(1, 100); plugin::DoAnim("sit"); plugin::RandomWeapons(1, 11169, 50, 200, 230);
#:: plugin::RandomFeatures($npc);
#::Future Plans: I am going to look into making plugins for an array of names and chat spams.
####################################

sub EVENT_SPAWN
{
#$npc->TempName("Test_Name"); #Works but want a randomizer for names, maybe make a plugin array that makes names..."Leg" + "olas" type of idea
my $wa_Diff = int(rand(10)); #Picks a number 0-9, 10 means 10 total int starting at 0

quest::settimer("wa_FeatureChange", 1); #1 seconds
quest::settimer("wa_RandomName", 1); #1 seconds
quest::settimer("wa_Decisions", 10 + ($wa_Diff)); #10 seconds + random (0-9) 10 means 10 total int starting at 0
}
#####################
#End of EVENT_SPAWN
#####################

sub EVENT_TIMER
{
if($timer eq "wa_Decisions" && !$npc->IsEngaged()) #"eq" is used for strings not int
{ ###What do I want to do?###
wa_Decisions();
}
if($timer eq "wa_FeatureChange")
{ ###Change my look here###
#quest::debug("ChangeLook begin");
quest::stoptimer("wa_FeatureChange"); #Lets not repeat
plugin::RandomWeapons(1, 11169, 50, 200, 230); #Any random weapon available through S0F, need to fix this later for newbie sets?, make a random armor?
plugin::RandomFeatures($npc); #Change facial features
#quest::debug("ChangeLook end");
}
if($timer eq "wa_RandomName")
{ ###Change my name here###
quest::stoptimer("wa_RandomName"); #Lets not repeat...EXCELSIOR!
plugin::wa_RandomName();
}
}

###################
#End of EVENTS_TIMER
###################

sub wa_Decisions
{
my $wa_intChoice = plugin::RandomRange(1, 100); #Random int used localy

$wa_maxhp = $npc->GetMaxHP();
$wa_HP = $npc->GetHP();
$wa_perchp = (($wa_HP / $wa_maxhp) * 100);

if($wa_perchp <= 20)
{
#quest::debug("" . $npc->GetName() . " I am below 20 percent, healing.");
#quest::debug("Health check PERCENTAGE " . $wa_perchp . "");
plugin::MobHealPercentage(5);
#quest::debug("" . $npc->GetName() . "Done healing.");
last;
}
if ($wa_intChoice <= 10) #Below or at 10
{
plugin::wa_KillMode(400, 1200); #Change the ranges for customizing the npc_player min and max agro radius
#quest::debug("wa_intROLL BELOW 10 worked for ". $npc->GetName() .". Time to kill");
}
if ($wa_intChoice > 10) #Above 10
{
plugin::wa_ChatMode();
#quest::debug("wa_intROLL ABOVE 10 worked for ". $npc->GetName() .". Time for peace");
}
}

WarAngel
04-14-2020, 11:28 PM
####################################
#:: Usage: plugin::wa_KillMode([minRange], [maxRange]); Example... plugin::wa_KillRange(500, 1000);
#:: Created: 12April2020
#:: Version: wa_1.00
#:: Author: Others have made the scripts and I just mushed them togather, and created a bastard child...WarAngel
#:: Description: To have a NPC create the illusion of other real world players running around.
#:: With help from: TurmoilToad,Salvanna,Akkadius,Trust,Kinglykrab
#:: Plugins: plugin::val('$npc');
#:: Future Plans Figure out interaction with waypoints.
####################################

sub wa_KillMode
{
#quest::debug("Killmode begin for " . $npc->GetName() . ""); #Wrong place to put this as it prevents the script
my $npc = plugin::val('$npc'); #this was what I was missing. without this the plugin was not knowing who was calling
my $entity_list = plugin::val('$entity_list');
my $wa_minRange = $_[0]; #pulled from first position in the plugin call
my $wa_maxRange = $_[1]; #pulled from second position in the plugin call

$wa_disUpper = plugin::RandomRange($wa_minRange, $wa_maxRange);
#$wa_rangelower = plugin::RandomRange(1, $wa_varRange);

#my @npc_list = $entity_list->GetNPCList(); # "@" is for array... "my" is for a single... I am an idiot
@npc_list = $entity_list->GetNPCList(); #not sure in a plugin why this works and not the one with a "my"
#quest::debug("Killmode begin for " . $npc->GetName() . "");

foreach $npc_ent (@npc_list)
{ ###This whole next if has me bonkers...seems counter intuitive...oposites...">" is less than. "==" is NOT equal
#quest::debug("Killmode subscript begin for " . $npc->GetName() . ""); #This debug will repeat for each NPC in the GetNPCList()
next if $npc_ent->CalculateDistance($x, $y, $z) > $wa_disUpper; #skip mobs OVER $wa_disUpper distance, check those BELOW
next if $npc_ent->CalculateDistance($x, $y, $z) < $wa_minRange; #skip mobs BELOW $wa_minRange distance, check those OVER
next if $npc_ent->GetLevel() > $npc->GetLevel(); # Enemy level parameters...works...but some mobs are never attacked, do not know why
next if $npc_ent->IsEngaged(); # Is target in combat?...works
next if $npc_ent->GetID() == $npc->GetID(); #Lets not kill ourself..have not tested this
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...have not tested this
next if $npc_ent->GetBodyType() == 11; #skip untargetable NPCs...have not tested this
next if $npc_ent->GetOwnerID(); #skip pets...have not tested this
next if $npc_ent->CheckNPCFactionAlly(faction_id) == $npc->CheckNPCFactionAlly(faction_id); #We are brothers and sisters in arms, lets not kill each other
#quest::shout("I am coming for you, " . $npc_ent->GetCleanName() . "!");
quest::SetRunning(1);
$npc->AddToHateList($npc_ent, 1); #We now HATE HIM!...Will go through the list thats left and pick the npc at the bottom of the list to attack
#quest::debug("Killmode subscript end for " . $npc->GetName() . "");
last; #we found a valid target jump out of the loop
}
}

####################################
#:: Usage: plugin::wa_RandomName();
#:: Created: 13Apr2020
#:: Version: wa_1.00
#:: Author: Akkadius, and others have made the scripts and I just mushed them togather, and created a bastard child...WarAngel
#:: Description: To have a NPC create the illusion of other real world players running around.
#:: With help from: TurmoilToad,Salvanna,Akkadius,Trust,Kinglykrab
#:: Plugins: plugin::val('$npc');
#:: Future Plans Turn this into an array plugin.
####################################

sub wa_RandomName
{
my $npc = plugin::val('$npc');
my $wa_RanRoll = int(rand(3)); #Need to make a gender and maybe race checks. Hence why I will make a array plugin sometime soon, 3 means total of three int not 1-3

if ($wa_RanRoll == 0)
{
$npc->TempName("Kid_one");
}
if ($wa_RanRoll == 1)
{
$npc->TempName("Kid_two");
}
if ($wa_RanRoll == 2)
{
$npc->TempName("Kid_three");
}
}

####################################
#:: Usage: plugin::wa_ChatMode();
#:: Created: 12Apr202
#:: Version: wa_1.00
#:: Author: Akkadius, and others have made the scripts and I just mushed them togather, and created a bastard child...WarAngel
#:: Description: To have a NPC create the illusion of other real world players running around.
#:: With help from: TurmoilToad,Salvanna,Akkadius,Trust,Kinglykrab
#:: Plugins: plugin::val('$npc'); plugin::SetAnim("sit"); plugin::DoAnim("dance"); plugin::RandomRange(1, 100);
#:: Future Plans Turn this into an array.
####################################

sub wa_ChatMode
{
my $npc = plugin::val('$npc');
my $wa_intCHAT = plugin::RandomRange(1, 100); #Random int used localy

#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...I believe I know why now. Working on this for next version.

if ($wa_intCHAT <= 33) #Below or at 33
{
plugin::SetAnim("sit"); #Options (stand/sit/duck/dead/kneel)
#quest::shout2("worldwide only shout"); #Does not use...relies on the datbase name
#quest::we(14, "World emote");
#quest::debug("wa_intCHAT Sarcastic chat");
}
if ($wa_intCHAT > 33 && $wa_intCHAT <= 66) #Above between 33 66
{
plugin::SetAnim("stand"); #Options (stand/sit/duck/dead/kneel)
#quest::debug("wa_intCHAT Positive chat");
}
if ($wa_intCHAT > 66) #above 66
{
plugin::DoAnim("dance");
#quest::shout("Zone shout"); #Does not use...relies on the dataase name
#quest::ze(14, "Zone emote");
#quest::debug("wa_intCHAT idiot chat");
}
}

return 1; #This line is required at the end of every plugin file in order to use it


#@a = (1..5);
#@a = (1..3, 5, 7..11);

WarAngel
04-20-2020, 04:18 PM
Here are my new scripts for the idea of a npc_player. PM me if you have questions.

https://github.com/WarAngel-Eric/EQEmu-Plugins_Final

https://github.com/WarAngel-Eric/EQEmu-Quests_Final

Toony
04-21-2020, 04:01 PM
/subscribed

WarAngel
04-22-2020, 10:51 PM
https://github.com/WarAngel-Eric

Added an ability to 50/50 change the gender of the npc on spawn. Effectively reducing your npc_types database my half, if you want.

If your looking to have a set of npc_players keep to a certain gender then copy the quest script and comment out or remove the gender plugin call.

WarAngel
04-22-2020, 10:52 PM
Pm or DM me if anyone needs better clarification on how to use these scripts.

Rakkoraz05
11-25-2020, 07:57 PM
Just for clarification sake on my end. I would need to do the following things.

1. Add your wa_Plugin.pl in to my eqemu/plugins folder and not the eqemu/quest/plugins folder.
2. Then you edit and add the (database_name of npc_player).pl script into the eqemu/quest/(zonename) folder while making the file match the name of the newly created NPC.

Do these NPCs have a range? Do I need to make sure the spawn location is close to things I'd want them to "hunt" or make seem not empty?

WarAngel
11-26-2020, 01:37 PM
https://github.com/xXxWarAngelxXx/EQEmu-WarAngels_Plugins_Master

https://github.com/xXxWarAngelxXx/EQEmu-WarAngels_Quests_Master/blob/master/(database_name%20of%20npc_player).pl

@Rakkoraz05 Cool to see that you might find this usefull. As far as to your questions...

I am going to assume for now that you have knowledge on making quest scripts or modifying the quest scripts for NPCs. In other words, in those NPC quest scripts...adding or changing the call on the plugin(s).

1. Correct. As far as I know, all plugins should go here for reference by the game and quest scripts (.lua/.pl files)
2. Correct. Now the individual NPC quest script must call on the plugins that you want to use. So I included a link to what I use in my game for an example.

Yes they can have a range. Look at "plugin::wa_KillMode(400, 1200); #Change the ranges for customizing the npc_player min and max agro radius" at the top of the plugin.pl script. You can set your min/max ranges there. Just now do I realize I need to re-address the range part. As I see that it would be wise to set ranges in the NPC quest scripts so the individual NPC ranges can be specific to themselves. I will look into making it have the script do a check for a individual range before using a general range that is in this plugin...need time on this though.

WarAngel
11-26-2020, 01:41 PM
@Rakkoraz05

Also, do you have a Discord account set up? DMing or some say PMing there is ssooo much easier to help in a timely matter.

Here in the Forums is nice, but there I can really help. And solicit others to help a bit easier.

WarAngel
11-26-2020, 01:44 PM
Should be noted that I have been away for a few months. Had some...difficulties in RL. And my computer I use for developing or doing mods is under an upgrade. So my files I use to answer questions are in a hard drive in a anti-static bag. Waiting to be set free in a new comp.

Soon though...soon.