Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-07-2010, 01:41 AM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
Triggering a function from a weapon on another player.

Alrighty, so I'm doing, in an onActionServerSide() of course:


PHP Code:
with(findplayer(acctnameblah)){
  
BuffSystem.addbuff("nameblah","stuffblah","etc");

now the problem is that it seems to apply for only a split second. but nothing will actually go through to their flags. same thing if i just try to send player.chat = "!"; in this way.

Doesn't make any sense. The script looks like it would make perfect sense, yet it's not working. What's the problem here?
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
  #2  
Old 09-07-2010, 02:16 AM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
If it does trigger the weapon on the other client, perhaps you need to check your BuffSystem's addbuff function script?
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #3  
Old 09-07-2010, 02:28 AM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
edit: when I try my script, it gives me a syntax error
Function BuffSystem.addbuff not found at line 4 in script of <weapon name etc etc>

I ran into this before but I didnt think this was happening in this variation because I had been messing around with things like tagging the findplayer thing in front of Buffsystem, as well as using findweapon, so i didnt bother to post it.

And the player chat thing seems to work now, so i guess that's not the problem anymore.

So yeah, I dont get why this syntax error should be occuring. the small block of code seems to make perfect sense. instead of triggering the buff to yourself, find another player and trigger it on them. right?
__________________
MY POSTS ARE PRONE TO EDITS!

Last edited by Jiroxys7; 09-07-2010 at 03:12 AM..
Reply With Quote
  #4  
Old 09-07-2010, 03:30 AM
Cubical Cubical is offline
Banned
Join Date: Feb 2007
Posts: 1,348
Cubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant future
Quote:
Originally Posted by Jiroxys7 View Post
edit: when I try my script, it gives me a syntax error
Function BuffSystem.addbuff not found at line 4 in script of <weapon name etc etc>

I ran into this before but I didnt think this was happening in this variation because I had been messing around with things like tagging the findplayer thing in front of Buffsystem, as well as using findweapon, so i didnt bother to post it.

And the player chat thing seems to work now, so i guess that's not the problem anymore.

So yeah, I dont get why this syntax error should be occuring. the small block of code seems to make perfect sense. instead of triggering the buff to yourself, find another player and trigger it on them. right?
post it
Reply With Quote
  #5  
Old 09-07-2010, 03:32 AM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
Here's the block of code causing the problem.

PHP Code:
function onActionServerSide(cmdtarget){
  if(
cmd == "spite"){
    
with(findplayer(target)){
      
BuffSystem.addbuff("Spite"30"cannotstack", -10);
    }
  }

Then when that part of the script goes through, I'll immediately get the following in rc:

Script: Function BuffSystem.addbuff not found at line 4 in script of -Skills/Spite (in level onlinestartlocal.nw at pos (0, 0))
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
  #6  
Old 09-07-2010, 04:32 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
BuffSystem doesn't exist then, also you should add AddBuff as a server-side player function so u can do fun things like...

player.addBuff() or for (temp.p: allplayers) temp.p.addBuff().
__________________
Quote:
Reply With Quote
  #7  
Old 09-07-2010, 05:24 AM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
You may want to try Findweapon() for triggering a public function in the other weapon
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
Reply With Quote
  #8  
Old 09-07-2010, 05:34 AM
Cubical Cubical is offline
Banned
Join Date: Feb 2007
Posts: 1,348
Cubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant future
putting it in a class and then joining it to the player is a much better idea in my opinion. Also I prefer using something along the lines of this instead of findWeapon();.
PHP Code:
(@"Systems/mainSystem").addBuff(); 
It's a personal preference however I'm not sure if it's any more or less efficient than findWeapon().
Reply With Quote
  #9  
Old 09-07-2010, 05:45 AM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
I agree with the class method, but I perfered to use findweapon() so I know what I'm referencing.
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
Reply With Quote
  #10  
Old 09-07-2010, 06:03 AM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
well actually, BuffSystem is a class joined to a mod system weapon. (the buff system class is headed with BuffSystem = this; in it's onCreated())

and the function addbuff is, of course, a public function. and @ cubical, i thought if you joined a class to a player, you can only call player functions? (which apparently arent custom-named functions and therefore wouldnt work, right?)
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
  #11  
Old 09-07-2010, 06:38 AM
Cubical Cubical is offline
Banned
Join Date: Feb 2007
Posts: 1,348
Cubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant future
Quote:
Originally Posted by Jiroxys7 View Post
well actually, BuffSystem is a class joined to a mod system weapon. (the buff system class is headed with BuffSystem = this; in it's onCreated())

and the function addbuff is, of course, a public function. and @ cubical, i thought if you joined a class to a player, you can only call player functions? (which apparently arent custom-named functions and therefore wouldnt work, right?)
PHP Code:
player.join("blah");
player.addBuff("demonize"); 
Reply With Quote
  #12  
Old 09-07-2010, 06:42 AM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
Quote:
Originally Posted by Cubical View Post
PHP Code:
player.join("blah");
player.addBuff("demonize"); 
of course. "player functions". it all makes sense now. /facepalm. thanks I'll try it out tomorrow.
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
  #13  
Old 09-09-2010, 12:49 AM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
Wall of text:

Alright, I was starting on joining it to the player on the server-side, but i quickly realized that I would probably have to essentially redo my entire system. So instead, I had the weapon send the serverside command/function over to the mod system weapon. which handles the buff system class. from there, it takes the data from the serverside and does a triggerclient to send it over to the clientside. I would have sent it directly to the class and done that, but of course, for whatever reason, you're not able to send serverside<->clientside triggers in classes. so instead, from there, i then send it over to the class. using this method, i can clientside the entire process unless a serverside trigger is required (i.e. findplayer). Which should help reduce server strain in the long run. even if it's by a small amount. compared to serversiding most of it.

Quote:
Originally Posted by MrOmega View Post
I agree with the class method, but I perfered to use findweapon() so I know what I'm referencing.
I prefer my method. not only is there less typing, but, if done properly, will give you all the information you need at a glance. for example, to solve your problem, the system i have to handle my weapon data is called -Serverfunctions/-WeaponSystem. I then put WeaponSystem = this; in the onCreated function, so that way, when i see WeaponSystem.blah(blah,blah), I know that's it's sending data to my weapon system because it's easily identifiable that way. and in this case, BuffSystem (the class is called buffsystem), if I see BuffSystem.addbuff(blah) i know exactly what the script is doing. using the buff system to add a buff, of course



ANYWAY
Now that I have this, for the most part, working, I have one more related issue that I've been having trouble with lately. It seems that my ModSystem (the weapon joined to buffsystem) won't apply any buff effects to anyone who has just logged in. this problem is resolved once i open up the weapon, and click "Apply" after they've logged in. And I need to repeat this every time a player logs in... So does anyone have any idea what might be the culprit? is there any built in function to update the weapon so i can put it in an onCreated or something, instead of doing this process every time?

edit: nvm i managed to fix this by doing player.ModSystem.onCreated() in the control npc when the player logs in. still dont know why i had to do this though.
__________________
MY POSTS ARE PRONE TO EDITS!

Last edited by Jiroxys7; 09-09-2010 at 01:56 AM..
Reply With Quote
  #14  
Old 09-09-2010, 12:52 AM
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
Use player classes & functions. It may require some refactoring but it's worth it.
__________________
Reply With Quote
  #15  
Old 09-09-2010, 01:43 AM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
Quote:
Originally Posted by cbk1994 View Post
Use player classes & functions. It may require some refactoring but it's worth it.
Any benefits in specific? I've been working on the buff & mod system for quite some time now. and now that things are at least working, I want to move on in development until i run into a situation that really calls for the system to be redone.
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 10:44 PM.


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