Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   mouse coords (https://forums.graalonline.com/forums/showthread.php?t=57540)

Projectshifter 02-09-2005 05:18 AM

Quote:

Originally Posted by falco10291029
I did, the problem is that the callnpc isnt getting picked up by the monster.

This would probably then mean that you're not getting the proper NPC. I think it's more intelligent to do the selection in a weapon. Also I think it's helpful to do a this.npctype string on class NPCs so you know exactly what it is via the script. That way you could check if (strequals(#s(this.npctype)),monster)) and know it's a monster.
For debugging, that's a crucial part man x.x I'd suggest trying with (npc[client.id]) sendtonc accessing the monster!: And if you do the this.npctype I said also send that, perhaps your'e not on the right NPC (as I said prior). What server is this on and I might swing by?

Alexander 02-09-2005 06:17 AM

Clientside ID of a NPC does not always equal the serverside ID of a NPC.

Also why not just trigger the npc directly from clientside?

falco10291029 02-09-2005 10:05 PM

Dont you need callnpc servewrside if dealing with a serverside npc?

falco10291029 02-09-2005 10:51 PM

Found the problem, cant fix it:


NPC Code:

this.npc=strtofloat(#p(1));
callnpc this.npc,move,#p(2),#p(3);


That part, where it sends the command to the npc, which should recieve it with:

NPC Code:

if (move) {
this.x=strtofloat(#p(0));
this.y=strtofloat(#p(1));
this.hunt=1;
this.move=1;
unset move;
}


But it doesnt make any acknowledgement that it was told to move.

Admins 02-09-2005 11:31 PM

> Clientside ID of a NPC does not always equal the serverside ID of a NPC.
> Also why not just trigger the npc directly from clientside?

falco10291029 02-10-2005 12:23 AM

Is there any way to convert a clientside id to a serverside one?

Admins 02-10-2005 02:02 AM

Quote:

Originally Posted by falco10291029
Is there any way to convert a clientside id to a serverside one?

Well there are different solutions:

1. You trigger on the position of the npc you want to move, then the npc directly gets the trigger and you don't need to code anything complicated (triggeraction monsterx,monstery,test,...; -> if (actiontest) ...)

2. You send the ID of the npc (not the index), and on the serverside you are searching for the npc with the right id - this works because the ID is actually the same, except when the npc is not existing on the serverside, e.g. if it only has clientside script
for (i=0; i<npcscount; i++) if (npcs[i].id==monsterid) callnpc i,test,...;

falco10291029 02-10-2005 03:23 AM

I'll try the second one.


EDIT: It works, thank you so much! And also thanks PS for giving me tha targeting system when you came on last night.


All times are GMT +2. The time now is 08:53 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.