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 05-24-2005, 08:43 PM
Fry Fry is offline
Registered User
Fry's Avatar
Join Date: Sep 2001
Location: Germany
Posts: 384
Fry has a spectacular aura about
GS2: triggeraction(), bug or am I doing something wrong?

I don't know why it won't work, but I am not exactly sure whether it should work and whether it's a bug:
HTML Code:
function onActionfoo() {
  player.chat = "works.., " @ params[0];
}
function onActionserverside() {
  player.chat = "onActionServerside";
  triggeraction(player.x+1.5, player.y+2, "foo", "test");
}

//#CLIENTSIDE
if (weaponfired)
  triggeraction 0,0,serverside,#w;
in a weapon.

the serverside trigger arrives, the "foo" trigger doesn't. Neither on the serverside, nor on the clientside.
It also doesn't work when I replace "player" with some other player that also has the weapon.
__________________
Graal Statistics

Top 3 servers at the moment (players):


Reply With Quote
  #2  
Old 05-24-2005, 09:50 PM
Velox Cruentus Velox Cruentus is offline
Registered User
Velox Cruentus's Avatar
Join Date: Dec 2004
Location: Quebec, Canada
Posts: 465
Velox Cruentus is on a distinguished road
Send a message via ICQ to Velox Cruentus Send a message via AIM to Velox Cruentus
It's case sensitive. Try:

function onactionservreside()
{
}

And... The weapon shouldn't be able to trigger himself like that...

Your best bet is calling a function:
foo({param[0],param[1]});

and
function foo(params)
{
player.chat := params[0];
}
__________________
In a world of change... Who'll you believe?
Reply With Quote
  #3  
Old 05-24-2005, 10:03 PM
Fry Fry is offline
Registered User
Fry's Avatar
Join Date: Sep 2001
Location: Germany
Posts: 384
Fry has a spectacular aura about
Quote:
Originally Posted by Velox Cruentus
It's case sensitive. Try:

function onactionservreside()
{
}
Already tried it.

Quote:
Originally Posted by Velox Cruentus
And... The weapon shouldn't be able to trigger himself like that...
If it isn't possible to do it yet, then it should be added. I also (or initially) tried triggering other players with the same weapon.

Quote:
Originally Posted by Velox Cruentus
Your best bet is calling a function:
foo({param[0],param[1]});

and
function foo(params)
{
player.chat := params[0];
}
It is not, sadly, because there are cases where the function doesn't exist which would result in errors in the RC.
I would've used .trigger(..), but it isn't working correctly at the moment.
What I wanted to do is do a triggeraction for weapon attacks, I initially did it by cycling through the players/npcs and using callweapon/callnpc on those who were infront of the player, because I was concerned about the security of triggeraction.
I'd be fine when obj.trigger() would be working correctly.
__________________
Graal Statistics

Top 3 servers at the moment (players):


Reply With Quote
  #4  
Old 05-24-2005, 10:14 PM
Ajira Ajira is offline
Poont.
Join Date: Oct 2004
Location: NY, USA
Posts: 477
Ajira is on a distinguished road
Quote:
Originally Posted by Fry
I would've used .trigger(..), but it isn't working correctly at the moment. What I wanted to do is do a triggeraction for weapon attacks, I initially did it by cycling through the players/npcs and using callweapon/callnpc on those who were infront of the player, because I was concerned about the security of triggeraction.
I'd be fine when obj.trigger() would be working correctly.
I thought I showed you how to use trigger() so it works with attacking etc o_O
__________________
Liek omigosh.

Reply With Quote
  #5  
Old 05-24-2005, 10:25 PM
Fry Fry is offline
Registered User
Fry's Avatar
Join Date: Sep 2001
Location: Germany
Posts: 384
Fry has a spectacular aura about
Quote:
Originally Posted by Ajira
I thought I showed you how to use trigger() so it works with attacking etc o_O
As I told you, it didn't work and it was a terrible workaround.
I shouldn't have to be forced to use workarounds for everything, so I am reporting these bugs so they can be fixed and I can use things as they are supposed to be used.
__________________
Graal Statistics

Top 3 servers at the moment (players):


Reply With Quote
  #6  
Old 05-25-2005, 03:39 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
I don't see bugs there. The control-npc and the weapon npcs are not supposed to stay in the level where the action happens, so triggeraction is not even checking for them. They are only "warped" temporary to the location of the player to be able to easy check for near players and npcs.
The obj.trigger(action,params) or obj.scheduleevent(delay,action,params) functions should work fine in case you want to invoke an event.
Reply With Quote
  #7  
Old 05-25-2005, 05:12 PM
Velox Cruentus Velox Cruentus is offline
Registered User
Velox Cruentus's Avatar
Join Date: Dec 2004
Location: Quebec, Canada
Posts: 465
Velox Cruentus is on a distinguished road
Send a message via ICQ to Velox Cruentus Send a message via AIM to Velox Cruentus
Make the object the weapon.

WEAPON.trigger(x,y);

To think about it... I had some problems a while ago with some scripts. I'm at school, so I can't get them. I'll post later.

The Weapon.trigger() should work rather then player.trigger. You are triggering the weapon, and not the player (that is where I believe you could've made a mistake).

EDIT: For executing on another player, you would probably have to do:

with (findplayer(x)) WEAPON.trigger();

Or, have it that the trigger is in a player class, so that findplayer(x).trigger() executes a function the player can have.

Something I do for that is a public function and simply do player.reset(); For example.
__________________
In a world of change... Who'll you believe?
Reply With Quote
  #8  
Old 05-25-2005, 05:44 PM
Fry Fry is offline
Registered User
Fry's Avatar
Join Date: Sep 2001
Location: Germany
Posts: 384
Fry has a spectacular aura about
Quote:
Originally Posted by Velox Cruentus
Make the object the weapon.

WEAPON.trigger(x,y);
Hm, yes, but I already tried it, and getting someone elses weapon object is a bit problematic, like you've shown below:
1. Only weapon names that don't contain characters like - / or whatever work, otherwise you have to use makevar()/etc
2. As you said, in order to access the weapon of someone else you have to use with() which I remember shouldn't be used anymore
EDIT: Okay, with() should still be used, yet someplayer.weaponname/findweapon() not working doesn't make sense.

I'd suggest a findweapon for other players, not just the current one, also a .trigger() on a player should go to all weapons.

Quote:
Originally Posted by Velox Cruentus
Or, have it that the trigger is in a player class, so that findplayer(x).trigger() executes a function the player can have.

Something I do for that is a public function and simply do player.reset(); For example.
Thank you very very much for helping, but the thing isn't that I can't find a way to work around these things, it's just that I want to use things like they should work or were supposed to work (atleast I think that that they were to work this way).
__________________
Graal Statistics

Top 3 servers at the moment (players):



Last edited by Fry; 05-25-2005 at 06:01 PM..
Reply With Quote
  #9  
Old 05-26-2005, 01:57 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
I have some problems to follow.

If you do trigger(action,params) it will send an event to the current npc/weapon.
If you want do a trigger for another player, you can pass the player object as parameter or you do stuff like with (findplayer(account)) thiso.trigger(action,params); which then will automatically set the "current player" once the event is triggered.

Triggering yourself doesn't make a lot of sense though, you can call the function directly.
Reply With Quote
  #10  
Old 05-26-2005, 02:08 PM
Velox Cruentus Velox Cruentus is offline
Registered User
Velox Cruentus's Avatar
Join Date: Dec 2004
Location: Quebec, Canada
Posts: 465
Velox Cruentus is on a distinguished road
Send a message via ICQ to Velox Cruentus Send a message via AIM to Velox Cruentus
What I retrieved was:
PHP Code:
findplayer(x).WEAPON.function(); 
You can easily do it with:
PHP Code:
  with(findplayer("Fry"))
    
FrenchFries.trigger("cook"); 

=---=
Use of thiso.trigger():
PHP Code:
 with (findplayer(x))
 {
   
hp -= dam;
   if (
hp 0)
    
thiso.trigger("kill",player.account);
 } 
__________________
In a world of change... Who'll you believe?
Reply With Quote
  #11  
Old 05-26-2005, 02:42 PM
Fry Fry is offline
Registered User
Fry's Avatar
Join Date: Sep 2001
Location: Germany
Posts: 384
Fry has a spectacular aura about
Oh well.. you did read the part where I said I do know how to work around the nonexcistance of a direct .trigger()?
Don't tell me findplayer("Velox Cruentus").findweapon("Cookie System").trigger("eat", 10); makes less sense to you than with (findplayer("Velox Cruentus")) ("Cookie System").trigger("eat", 10); or you'd prefer the latter one..?
.trigger()ing other Level NPCs works fine, so why shouldn't a .trigger() for other player[weapon]s be added?

Stefan: What I want is to do findplayer("someplayer").findweapon("someweapon"). trigger("stuff", "parameters");
__________________
Graal Statistics

Top 3 servers at the moment (players):


Reply With Quote
  #12  
Old 05-26-2005, 05:07 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Nonexistense? You have a lot of functions to get the weapon object, get the player, doing triggers. You can use findweapon(), findweaponnpc(), makevar, use trigger, scheduleevent, directly call functions of the weapon npc, or call functions from a class.
If you really want to put the code for eating into a weapon npc script and you want some random player eat something then you probably need to retrieve the player object and weapon object and call the script function or trigger an event. I don't understand why you make it that complicated though, and I don't know what kind of trigger you are missing (nor why you need to use triggers in this case).
Reply With Quote
  #13  
Old 05-26-2005, 07:20 PM
Fry Fry is offline
Registered User
Fry's Avatar
Join Date: Sep 2001
Location: Germany
Posts: 384
Fry has a spectacular aura about
It was a very bad example I guess, sorry.
I was in the believe that findweapon() did not work because I always though I got the weapon of the current player, not the one I was using the findweapon() on, but then I figured that the code which gets called by directly calling a function in a weapon npc uses the player that called this function as "player" object, so it seems I was misusing them. Sorry.
__________________
Graal Statistics

Top 3 servers at the moment (players):


Reply With Quote
  #14  
Old 05-26-2005, 08:49 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
it would be nice if it was possible to trigger functions serverside -> clientside and clientside -> serverside. Since I don't really like using triggeraction >_>
__________________
Reply With Quote
  #15  
Old 05-26-2005, 09:37 PM
Fry Fry is offline
Registered User
Fry's Avatar
Join Date: Sep 2001
Location: Germany
Posts: 384
Fry has a spectacular aura about
There's player.triggerclient("weaponname", parameters); and if I remember correctly it is planned to add triggerserver too. They just replace triggeraction(0, 0, "serverside"/"clientside", stuff); though.
__________________
Graal Statistics

Top 3 servers at the moment (players):


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 08:18 PM.


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