Adding custom spell on npc mob?

Posted by Oblisgr on Sun 01 May 2016 10:01 PM — 8 posts, 31,382 views.

#0
Is it possible to make the mob learn the same skills I have created for players?

For example i have created a spell named "slam" for warriors. It can be learned from level 1 and does some ammount of damage (with some boosting from player's attributes, mana % and move%).

I would like to add this spell to a warrior npc mob. I m using the "area editor" program but it doesnt support custom spells. (i think)

So i have to make it with code.
Any instructions please?

My first thought is to declare it in mud.h but then what?
Thanks in advance
USA #1
First thought is mobprog.
Second thought is spec_prog (ie, spec_fido or spec_janitor which I believe are both stock code)
#2
mobprog works.
The mob uses the skill but does not damage at all.
He utters the words but nothing happens.

Maybe because he cannot understand the spell?
Maybe he must know a % of the spell?
Maybe i have to set manually the desired damage in mobprog?
USA #3
Can't really troubleshoot that problem without code.
#4
mpdamage $n 5 5 fatal

this did the job in fight_prog.

I wander if there is a prog to emote something when the mob hits the player. If mob miss or the player dodges it will appear nothing.
USA #5
You can use mpecho(at/around if you want different messages for the victim and other chars in the room) to send messages with the attacks

While your solution does cause damage to the target, it doesn't actually solve the problem of the skill you were trying to use not damaging players when used by a mob.
#6
Eh ok i know. But still does the job.
I get skill text, i get a specific damage and ok.
Actually this is more cosmetic.

I used mpecho, with colors too ehehe
But still i want the message to appear when the mob succeeds to hit the player.

I i use fight_prog with 100 possibility it will appear the message i want every line even if the mod fails to hit the player. I read the docs and info from the internet, but i couldnt find anything. Not a prog nor an if statement.
USA #7
The drawback to using mpdamage rather than actually fixing the skill so it works properly for mobs is that:
1) mpdamage never misses
2) mpecho is meant to be cosmetic
3) you didn't actually fix the problem
4) a 100% fight_prog is going off every round and is expected to execute any valid command it contains


As an added bonus, without being able to see either your custom skill code or your mprog we can't help you actually fix either of them to do what you're actually trying to do. That said, the simplest fix for your "slam" skill is probably to add an if check for pcs and an 'else' damage calculation that doesn't rely on pc attributes.