Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   triggeraction problem on gmaps (https://forums.graalonline.com/forums/showthread.php?t=84838)

salesman 03-26-2009 08:11 PM

triggeraction problem on gmaps
 
I'm trying to trigger an NPC on a gmap, but unless I am in the same 64x64 level as the NPC, it won't receive the trigger.
For example, If my character is at (20,20) on a 128x128 tile gmap, and the NPC I am sending a triggeraction to is at (70,20) it will not catch the trigger. However, if I move the NPC to (63,20) it will.

I checked the x,y location of the trigger, and it matches the NPC's x,y on the gmap, so that's not the problem. Even if the NPC is 4 tiles away from me, but we happen to be right at the split between levels, it won't catch the trigger.



I'm using a putnpc2(), so I could possibly just use findNPC( name ) and trigger it that way, but it would make my life a lot easier if triggeraction would work instead.

I'm not quite sure why my location even matters, the NPC is triggering itself.

Chompy 03-26-2009 09:55 PM

Are the triggeraction's coordinates sent based on the gmap dimensions or level dimensions?

salesman 03-26-2009 11:30 PM

Quote:

Originally Posted by Chompy (Post 1478176)
Are the triggeraction's coordinates sent based on the gmap dimensions or level dimensions?

Gmap's

cbk1994 03-26-2009 11:42 PM

Quote:

Originally Posted by salesman (Post 1478240)
Gmap's

If the trigger is clientside, it's likely using level coordinates. Not certain about that, though.

Fairly certain this won't work, but you could try finding out what 'name' on clientside equals, and if it's the same as serverside, try

PHP Code:

triggerserver("npc"name"hi"); 

Otherwise, you might try settings an attr on serverside of the NPC name then doing

PHP Code:

triggerserver("npc"this.attr[3], "hi"); 

I'm not certain whether putnpc2's can receive triggers via triggerserver, but they are really just DB NPCs, so I don't see why they couldn't.

salesman 03-27-2009 01:56 AM

Quote:

Originally Posted by cbk1994 (Post 1478252)
If the trigger is clientside, it's likely using level coordinates. Not certain about that, though.

Fairly certain this won't work, but you could try finding out what 'name' on clientside equals, and if it's the same as serverside, try

PHP Code:

triggerserver("npc"name"hi"); 

Otherwise, you might try settings an attr on serverside of the NPC name then doing

PHP Code:

triggerserver("npc"this.attr[3], "hi"); 

I'm not certain whether putnpc2's can receive triggers via triggerserver, but they are really just DB NPCs, so I don't see why they couldn't.

I've already said that the xy that the trigger is being sent to is based on the gmap (i.e. 70,20 not 6,20). But on top of that, it works when my character is in the same level (no matter where the NPC is) so I know that the xy is right. EDIT: Oh, I see what you were saying...I don't see why that would be the case though, seems pretty silly

I'll try getting the NPC's name and triggering it via a weapon though, and see if that works.

Another thing: would sleepwhennoplayers=true/false have anything to do with it? I tested it but had no luck either.

Inverness 03-27-2009 06:16 AM

Clientside coordinates are based on the level not the gmap, because on clientside you don't always have the whole gmap loaded.

salesman 03-27-2009 09:03 PM

Quote:

Originally Posted by Inverness (Post 1478344)
Clientside coordinates are based on the level not the gmap, because on clientside you don't always have the whole gmap loaded.

Ah, thanks

I solved the problem by storing the NPC's name and using findNPC( name ) and triggering it that way.


All times are GMT +2. The time now is 11:23 PM.

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