Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-28-2010, 07:48 AM
oo_jazz_oo oo_jazz_oo is offline
Jazz teh Awesome
oo_jazz_oo's Avatar
Join Date: Jul 2006
Location: California
Posts: 596
oo_jazz_oo is a jewel in the roughoo_jazz_oo is a jewel in the rough
Send a message via MSN to oo_jazz_oo
Triggering a function

I am trying to trigger a function using level. vars like so:
*Npc1
PHP Code:
function onCreated() {
  
level.test this;
  
this.testing "Test";
}
public function 
Tri() {
  
this.chat "Testing";

*Npc2
PHP Code:
function onPlayerTouchsme() {
  
level.test.Tri();
  
this.chat level.test.testing;

Now, when I touch the second npc, its chat turns to 'Test'.
But the function Tri() in the first npc, is not triggered.

I tried doing level.test.trigger("Tri", nil); but still nothing.

The reason i'm doing it this way is so I don't have to rely on doing triggeraction() in a specific x, y.

This method works perfectly clientside...but I noticed npcs don't like being triggered this way serverside. :/
__________________

Reply With Quote
  #2  
Old 12-28-2010, 08:03 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Did you change the function to onTri when you used trigger?

Try using this.level while you're at it, sometime GS2 is silly.
__________________
Quote:
Reply With Quote
  #3  
Old 12-28-2010, 09:01 AM
oo_jazz_oo oo_jazz_oo is offline
Jazz teh Awesome
oo_jazz_oo's Avatar
Join Date: Jul 2006
Location: California
Posts: 596
oo_jazz_oo is a jewel in the roughoo_jazz_oo is a jewel in the rough
Send a message via MSN to oo_jazz_oo
Hah, I did forgot to change it to onTri when I used trigger. Thanks. :P

Still, i don't get why just triggering the function using level.test.Tri() wouldn't work...but, oh well.
__________________

Reply With Quote
  #4  
Old 12-28-2010, 04:20 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
FYI trigger doesn't require a second parameter anymore on serverside (and clientside on v6).
__________________
Reply With Quote
  #5  
Old 12-28-2010, 04:33 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
It might have worked but whenever you call a public function on a level npc you have to trigger it to force update itself to players.
__________________
Quote:
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:18 AM.


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