PDA

View Full Version : [GM Scripting] Making an NPC Talk At a Percent of Hp


spearman360
11-09-2007, 11:48 PM
Hello guys, Here is a guide showing you how to make your or an NPC speak at the percent of it's health. Ex: At 50% of it's health it will say something like "Argh..Your making me upset!"

Alright, here is a template.

Look and use the template below

Code:

global Npc_Name_Health = function(mob)
{
if(.GetHealthPct() <= %_of_HP && Npc_Name == 0)
{
.SendChatMessage("What you want your Npc to say");
global Npc_Name = 1;
}
if(.GetHealthPct() <= %_of_HP && Npc_Name == 1)
{
.CastSpell(5200);
.SendChatMessage("What you want your Npc to say");
global Npc_Name = 2;
}
if(.GetHealthPct() <= %_of_HP && Npc_Name == 2)
{
.SendChatMessage("What you want your Npc to say");
global Npc_Name = 3;
}
};
global VanCleef_Combat = function(plr)
{
global VC_PHASE = 0;
.RegisterTimer(Time in Miller Seconds, Npc_Name_Health, 0);
.SendChatMessage("What you want your Npc to say");
};
.RegisterUnitEvent(Npc ID, 1, Npc_Name_Combat);

Step 1 : All the things in red is the things you need to put in your self. (Can't seem to make it red hehe)

Step 2 : Open up NotePad or WordPad and copy and paste that template into it and then start modifying it with steps below.

Step 3 : global Npc_Name_Health = function(mob) = This is the name of your or the NPC that will speak.

Step 4 : if(.GetHealthPct() <= %_of_HP && Npc_Name == 0) = The % of where the NPC will say the message you chose at the % of Hp (Ex, 70 = 70%, 50 = 50%, Etc..)

Step 5 : if(.GetHealthPct() <= %_of_HP && Npc_Name == 0) = The same as in "Step 3" The name of your NPC (Must be the same as Step 3 and the rest of the Naming ones.)

Step 6 : .SendChatMessage("What you want your NPC to say"); = The message you want your NPC to say when it gets to the % of the Hp.

Step 7 : global Npc_Name = 1; = The Name of your NPC (Remember, must be the same as every one where it says NPC_Name)

Step 8 : .RegisterUnitEvent(Npc ID, 1, Npc_Name_Combat); = The NPC Entry Spawn ID of your Npc (Ex, .npc spawn 123456, Etc)

Step 9 : .RegisterUnitEvent(Npc ID, 1, Npc_Name_Combat); = The Name of your NPC in all the other place you put it (Make sure it is the same as all the other places)

Code:

}
if(.GetHealthPct() <= %_of_HP && Npc_Name == 2)
{
.SendChatMessage("What you want your Npc to say");
global Npc_Name = 3;
}

Also, you can keep adding more to make the NPC talk more.

-->And now naming it<--

Naming - It's hard, but then again, it's easy. Now when your done modifying it, go to File > Save as > and select "All Files" and call it like, (If you are doing it for a NPC called Cyberous, I would call it Cyberous.gm). So like in "Step 3" The Name of your NPC, just name it that and put a .gm at the end of it so it ends up being Cyberous.gm

Saving It : Save it to your Desktop or some were you will remember where it is.

Step 10 : The place you will put this folder is in the scripts folder. So the location should be this:

C:\AC Web Ultimate Repack\Ascent\scripts

After that you can just restart your server.

And that's about it, Enjoy!.

doublehex
11-10-2007, 02:10 AM
good tut +rep

Thorz
11-10-2007, 03:38 AM
Good Tutorial. +Rep

Golepa
11-10-2007, 08:28 AM
Yeah, good tutorial indeed. But the problem is, that in newest revisions, GM is replaced with LUA scripting.

Edit: How come Thorz has full rep? :P

doublehex
11-10-2007, 12:45 PM
lol hes a moderator now and yes Game Monkey has been removed at rev 2036. I hope they add it back, i love game monkey, its so easy and fast! hmm maybe i should start trying to learn lua

KeizerHalil
11-10-2007, 08:06 PM
Propz dude! Keep up the good work!

DjTeleTubby
11-10-2007, 09:56 PM
Just what I was looking for! Thanks a lot!
+rep!

LumZor
11-11-2007, 03:22 PM
Nice!! But as golepa sayed.. Lua...shit.. awwwa... cannot use it.. :( it would be cool Thx anyway.. and how can i rep?/?lol

doublehex
11-11-2007, 03:33 PM
well for me most servers are below that so i still use game monkey. i think they removed it in 2036 and most of the servers i help out are lower than that.

spearman360
11-11-2007, 03:50 PM
lumiere, go all the way to the top, and look for a check mark

LumZor
11-11-2007, 03:54 PM
Ohh ok.. well tell golepa he have the scripts.. we have one server!

KeizerHalil
11-11-2007, 07:02 PM
Can't someone, just freakin up their GM Script... I will edit them from there....

But shees, if someone already has al the codes! Then why not share! lilnate22?

devin
11-11-2007, 11:07 PM
thanks i am going to use it right now