• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

Mercenary System

Grandelf

Esteemed Member
GMS (Grandelf's Mercenary System)

General information

So I have been working on a mercenary system for quite some time now, I actually even made 2 versions.
However version one was crap so I sort of rewritten it and went straight to version 2 which I will present to you here.
This thread is going to be quite long, because there is much to say and I will also do a little guide
on how to add your own mercenaries with this system. I took special care to add something, so it is easy to add mercenaries,
with little script knowledge required. That said, let’s get on to it.

Table of contents

  • Video about the system.
  • What does this script offer?
  • List of things that are added.
  • Instructions on how to add this system.
  • Guide on how to add your own mercenaries.

Video


What does this script offer?

The scripts that I am releasing will give you the ability to have mercenaries on your server.
As of now these mercenaries are purely for leveling purposes, which means that you can only have one mercenary
and they can’t enter instances, raids, arena’s or battleground. Furthermore will they not attack players so they are useless in pvp,
which was the point. I might consider changing this later, so you can have more mercenaries etc, but for now it is like this.
As stated in the general information, you can add your own mercenaries as well, for that I want to refer you to the guide section.

List of things that are added

This mercenary will follow you everywhere. Different speed (mounts),
even flying however this does look a bit crappy (no matter what I did, the bitch didn’t want to fly properly >.>).
If you teleport the mercenary will teleport with you, if you log out, the mercenary with ‘log out’ as well. Good luck trying to get rid of it =P.
A spell interface (gossip). These spells are casted in the order which they are put in,
meaning the spell in spell slot 1 will be cast before the spell in spell slot 2. This is done so you can prioritize spells.
A combat system with a custom target function. This function will first try to target the target of the player.
If there is no target, the npc can’t attack that target or the target is a player
then it will try to find a target which it can attack and also has the player on its threat list.
A spell casting system, which supports cooldowns, global cooldowns and mana costs. Furthermore will she regenerate her health and mana slowly out of combat.
The amount of spells a mercenary has depend on the level of the player / mercenary.
And … I probably forgot some things.

Instructions on how to add this system.

It’s quite simple actually, simply pull the source and put the scripts in your scripts folder.
Then run the SQL file from the SQL folder in your world database (this will add the 3 npc’s that come with this system) and you’re done.

Source: Under development..

Guide on how to add your mercenary.

Guide is moved to the repository and can now be found here: How to add your own mercenaries

Last words.

At last, the end of this thread which is way too long.. Yet there are still a few words left to say.
I’ve spend quite some time making and testing this, however there may still be bugs / errors in this script.
If you find any of those or if you have a suggestion on something that could be done better, please leave a reply =D.

Grandelf.
 
Last edited:

Rochet2

Moderator / Eluna Dev
Very nice.
Many have tried making mercenaries, but rarely complete and as big systems.
I hope you could include the creature SQLs with the column names
and the guide etc information to the repository or a backlink at minimum
:)
 

Grandelf

Esteemed Member
Thanks =D

And I suppose I could put the guide on the repository instead of here,
I never really worked with these repositories or github for that matter, but I'll take a look.

And why do you want the column names for the SQL script,
they are just standard creature_template queries.
 

Kaev

Super Moderator
Awesome.
Now we need completely randomized items (randomize on drop!) and we can create a Diablo 2 server. :D
 

Grandelf

Esteemed Member
Funny that you mention that, I actually thought of Diablo while I was making this =P.
However I sort of ripped the spells thingy from Guild Wars (limited spell slots available).
 

Kaev

Super Moderator
Funny that you mention that, I actually thought of Diablo while I was making this =P.
However I sort of ripped the spells thingy from Guild Wars (limited spell slots available).

I knew it! Everyone loved Diablo 2.
 

Xaver

Respected Member
hi

emm this script have 1-3 problem

i have last eluna end last TC Triniy Cata

1. i have sql inport
2. all scripty in to lua_script
3. im youn game and spawn 42002
4. and talk = klick god by = spawn npc (Whaypoint npc)

talnking npc now klick = (i want to hire a mercenary) and come a mercenary this ok
and taln mercenary no work and no error in log
im talking npc 42002 now and klick remove mercenary = crash server

im load up video vor this and one error on lua logs posting when upload video.

this is one error

2015-01-22_16:07:43 ERROR lua_scripts/GMS-master/mercSetup.lua:80: attempt to index field '?' (a nil value)

when upload vodeo finish is i´m posting here.

http://youtu.be/57XBl3BHuFc
 
Last edited:

Grandelf

Esteemed Member
Hahah you're absolutely right, I messed up the 'goodbye' button and it spawned the npc with entry 0,
whenever you click it xd. This npc does not have a script so that's the reason why you get this error:
Code:
lua_scripts/GMS-master/mercSetup.lua:80: attempt to index field '?' (a nil value)
Because of the error you can't talk to the npc anymore.

I fixed the error, so the goodbye button works. Hopefully you can talk to the npc aswell now,
however it might be something else as well.

Also your paladin has the name 'Mercenary mage', that's odd .. I might have figured out why you
can't talk to your merc, I unfortunatly can't reproduce the error however I will try to fix it now.

Edit: Ok I updated the scripts, if you can try if it works now that'd be great.
 
Last edited:

Rochet2

Moderator / Eluna Dev
The icons bugg slightly. Not sure why, but going around and doing stuff caused this:
http://prntscr.com/5vpo27
The pyroblast icon doesnt show.
.. or .. something .. http://prntscr.com/5vpp0c

Also the back button is a cata icon or something, so it doesnt show on 3.3.5a for example.

Hiring a merc and reloggig causes this:
http://prntscr.com/5vppm3
Seems the merc doesnt get spawned on login before you move slightly and thus the gossip checks see that you have a merc, and that you dont have one (spawned)

When the merc gets new spells from leveling, it seems set spells are suddenly ignored.
You can assign already assigned spells. The old ones can be reassigned or removed.
Try by setting some spells, leveling some and then go see the menu again and set some new spell that you already set.

The NPCs dont attack any neutral NPCs at all (like starting area NPCs, the yellows)
Probably just intended, but something I first thought was a bug that the NPC wouldnt do anything.
 

Grandelf

Esteemed Member
The icons bugg slightly. Not sure why, but going around and doing stuff caused this:
http://prntscr.com/5vpo27
The pyroblast icon doesnt show.
.. or .. something .. http://prntscr.com/5vpp0c

Hmm that is weird, the pyroblast icon works fine on my local server. I also noticed your gossip
window is a bit smaller than mine. Hmm I guess I'll just have to do some more testing on that
part then and see what happends.
Also the back button is a cata icon or something, so it doesnt show on 3.3.5a for example.
Is it? I am running 3.3.5a and the button shows up just fine. I could possibly find a replacement though.
Hiring a merc and reloggig causes this:
http://prntscr.com/5vppm3
Seems the merc doesnt get spawned on login before you move slightly and thus the gossip checks see that you have a merc, and that you dont have one (spawned)
You're right about that, I actually forgot something there, worked before but I changed quite some stuff.
I'll fix that right away. FIXED

When the merc gets new spells from leveling, it seems set spells are suddenly ignored.
You can assign already assigned spells. The old ones can be reassigned or removed.
Try by setting some spells, leveling some and then go see the menu again and set some new spell that you already set.
That's something I didn't test at all, (my bad), and so the script does what it is supposed to do.
Filter the spells by level, however it's not what I want it to do in a situation like thatxd. Thanks for pointing that one out.
FIXED

The NPCs dont attack any neutral NPCs at all (like starting area NPCs, the yellows)
Probably just intended, but something I first thought was a bug that the NPC wouldnt do anything.
Yea I am aware of that, I still have to figure out some way to fix that.
I am guessing :CanAttack prevents it from attacking neutral creatures, however I am not entirely sure.
 
Last edited:

Xaver

Respected Member
i have tested end resoult is :

ok when klick closed is fixed

but 2 bugs when spawn pala or mage, have no menu of revive, pala or mage have no menu talking on tc cata, this mus fixed and ready ^^

and can you inport funktion on this script to work on instance ??

becaus i have level area in a instance and well this script for my level area inport you steand ?? when spawn 42002 in to instance come this error :

merc.lua:78: attempt to index local ´map´ (a nil value) and no atack in instance

can this inport ??

thanks.
 
Last edited:

Grandelf

Esteemed Member
If you still can't talk to the npc then I really have no clue what causes it.
We do run scripts on different sources which always causes some things to have different results unfortunatly.
What you can try to do is make a new npc, because the SQL script with npc's were made for 3.3.5.
Maybe there are some issues with that, however I am not sure about this.

I have made this script for leveling purposes only, meaning mercenaries are not able to join instances as of this moment.
I can change it so they can join instances, however if you group up and do a dungeon 5 people will be able to bring a mercenary.
Which basically allows you to do 5 man dungeons with 5 people + 5 mercenaries, which makes them quite easy.
Not to mention raids.. So for now mercenaries will not be able to join instances and I don't think I will implement that.
I personally find it stupid to do raids/dungeons with mercenaries, they don't know any tactics and it sort of destroys the point of an online game.
 
Last edited:

Xaver

Respected Member
I intend for instances when the server is new and for level area help.

what not good is this menu for bot ^^, well npc not cast spells ^^ this not good, and you npc have all funktion in creature template, have type 3 etc no found the problem :(
 
Top