PDA

View Full Version : Npcs wont attack ???


sotonin
08-03-2004, 04:23 PM
I tried code i saw used in many places, and it doesn't seem to work. everything else in it works. but the mob simply doesn't attack me when i hand the item in.


sub EVENT_ITEM {
if($itemcount{20368} == 1){ # Note to Maligar
quest::say("Hmmm. What's this? A note from that silly bard Baenar? I wasn't aware that those of his kind could write, much less read.");
quest::emote("lets out a deep laugh.");
quest::say("I see you do not share my sense of humor. Let's read it, shall we? Oh, no! She's dead? I knew that already, you fool. It was by my hand she died! Ooops! Did I let that slip out? Silly me. I guess I will have to kill you now!");
quest::spawn(12132,0,0,-10905,1249,210);
quest::attack("$name");
}
}
sub EVENT_DEATH {
quest::depop();
}

#END of FILE Zone:qey2hh1 ID:12076 -- Maligar




Also, i noticed depop(); on death doesn't appear to work. I would of expected it to make him go poof after he dies like a vendor would. Maybe i need to pass an arguement through it? The reason i did a depop() on death was because when i kill him, he has the note that i had given him to spawn the second mob and cause him to attack me. This item is a quest item and should be destroyed after i hand it in, shouldn't be able to loot it when he dies ) Anybody know a way to get around this some how?

thanks!

any ideas?

hypershadow66
08-03-2004, 06:30 PM
i am not sure if there is a way to, but if there is, you could make him depop on 1HP and give an amount of exp apon depoping, that way he would give exp and dissapear

x-scythe
08-03-2004, 07:26 PM
try moving the comment "# note to maligar" out of the {} and put it about sub EVENT_ITEM
ive heard this has messed up a quest before

sotonin
08-04-2004, 01:07 AM
OK, ill try that. but it doesnt make sense... EVERYTHING works except the attack and the depop (

Cisyouc
08-04-2004, 05:05 AM
sub EVENT_HP
{
if ($hpevent == 1){
quest::depop();
quest::exp(500);
}
}
Try that, as suggested.

hypershadow66
08-04-2004, 09:07 AM
yah thats what i meant by my post

cofruben
08-04-2004, 09:46 AM
try quest::attack($userid);

Charmy
08-04-2004, 02:05 PM
$charid seems to respond better for me, $userid returns the same value, but for some reason i have noticed that $charid works smoother, don't as me why but it does.

RangerDown
08-04-2004, 02:26 PM
if your account name != your character name, will $userid return your account name?

Charmy
08-04-2004, 04:00 PM
nope, $userid, and $charid return the value of the id in ther user table, i.e. if i was the 184th person to create a character on your server then $charid will return 184. your account name is only used as a refrence to who the character belongs to. $name returns your charactername and $charid returns the value of id in the character table.

sotonin
08-04-2004, 04:53 PM
Still no luck.. This is what i currently have. and it yields the same result. when i turn in the item, the new mob spawns. but they just stand there the original mob wont attack me

sub EVENT_ITEM {
if($itemcount{20368} == 1){
quest::say("Hmmm. What's this? A note from that silly bard Baenar? I wasn't aware that those of his kind could write, much less read.");
quest::emote("lets out a deep laugh.");
quest::say("I see you do not share my sense of humor. Let's read it, shall we? Oh, no! She's dead? I knew that already, you fool. It was by my hand she died! Ooops! Did I let that slip out? Silly me. I guess I will have to kill you now!");
quest::spawn(12132,0,0,-10905,1249,210);
quest::attack($charid);
}
}
sub EVENT_DEATH {
quest::summonitem("20367");
quest::depop();
}

#END of FILE Zone:qey2hh1 ID:12076 -- Maligar

x-scythe
08-05-2004, 06:21 AM
not positive but the problem could be is that since there is a new mob being spawned, it wont have the quest script since it is a different mob, thus it wont attack..
just an idea, could be wrong

-edit-
try adding the new spawn to your spawn table, then either make it KOS or add a quest script to it.

sotonin
08-05-2004, 07:12 AM
nope.

it doesn't work without the spawn either. have never had him attack and i just recently added the spawn line

Charmy
08-05-2004, 10:38 AM
GAH! i didn't read your script. ok few questions, are you getting attacked by any mob? or do both mobs just stand there lookign stupid.
if you get attacked by one, but its the wrong one here is the problem. The quest::attack line causes the current mob to attack, not the mob that is spawns, what you need to do is add a line into the EVENT_SPAWN of the mob you want to attack. i.e.

Mob that is spawned:

sub EVENT_SPAWN
{
quest::attack($charid);
}


now the problem is this, this mob won't have the character targeted when it spawns, so what you have to do is tell it what to target, sadly, there is no stock command in the quest sytem that tells mobs to target stuff via another mob, so there are two ways you can go about doing this. You can one, use corfuben's guide and make your own command to transfer the charid data to the other mob, if this is to difficult you can take the easier route which is to set a qglobal with the value of the $charid.

e.g.

sub EVENT_ITEM {
if($itemcount{20368} == 1)
{
quest::say("Hmmm. What's this? A note from that silly bard Baenar? I wasn't aware that those of his kind could write, much less read.");
quest::emote("lets out a deep laugh.");
quest::say("I see you do not share my sense of humor. Let's read it, shall we? Oh, no! She's dead? I knew that already, you fool. It was by my hand she died! Ooops! Did I let that slip out? Silly me. I guess I will have to kill you now!");
quest::targlobal("VARCHARID",$charid,"D1",210,$charid,$zoneid); #note that i set mobid to 210, the number of the mob you are spawning, you will see why i did this in a moment.
quest::spawn(12132,0,0,-10905,1249,210);
}
}


This goes in the mob that you hand the note to.
(btw you might want to depop this mob if it is suppose to be him attacking you, in which case you just add the quest::depop command. but if this is the case you will want to make a copy of him in the mob database, as a seperate mob number. this way as you will see in the next script, when this mob normally pops on his timer, he won't try to attack someone on accident.)


then in the mob you are spawning.

in the mob you are spawning (mob 210 in this case):

sub EVENT_SPAWN
{
# i set $mobid to 210, so this mob would have access to the $VARCHARID in the qglobal table.
quest::attack($VARCHARID);
}
sub EVENT_DEATH
{
quest::summonitem("20367");
}


so what we have is, you hand in the item, the mob sets a variable in the databse equal to that of the current characters id. then it spawns this mob, which then reads the variable and attacks whatever the value of that variable is.

i hope this helps ya out, ask with any questions you have

Charmy
08-05-2004, 10:41 AM
and ofcourse after reading your most recent post i see you just added the spawn to try somthing out. hmm well in that case if you just want the mob to attack you, i gave you way to much info. if the mob isn't attacking period, i am not sure exactly what is going on, i am sorry i need to read all of the posts before i make my own, hmm, make sure the mob doesn't have 0 and 0 in the runspeed and walk speed in the database and he is just trying to attack you but he is permarooted. otherwise i sadly don't know whats wrong, you can ignore the above post, it won't help you if your mobs aren't attacked at all.

sotonin
08-05-2004, 11:20 AM
Ya he's not permarooted. And i can stand on top of him and he still won't attack me. I have no idea what's going on.... There doesn't appear that there should be any problem with my script from what i can tell. =(

That other info is nice to know though. i was curious about that very same issue, about the aggro on spawn of the other npc. But i have a question.

quest::spawn(12132,0,0,-10905,1249,210);

You said you set it to 210 the mob id. The mob id is 12132. 210 is the Z coord he's appearing at.

Charmy
08-05-2004, 12:48 PM
whoops i am sorry your right, i was thinking of a different command where the npcid comes at the end of the command, sorry bout that.

i have a question, if you are on your server and you target this mob and type #attack <your name here> e.g #attack charmy. does the mob attack?

sotonin
08-05-2004, 12:50 PM
yes, they do attack when i use that command =)

Charmy
08-05-2004, 01:02 PM
HMMMMMMMMM HMMMMMMMMMM!

hmm...


well only other thing you could try is to put $charid in "" e.g. quest::attack("$charid"); i have never had to do this, but you never know, its worth a try yes? <shrug>

sotonin
08-05-2004, 01:17 PM
already tried that =(