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 12-27-2005, 07:41 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
joining classes

for some reason i can't join classes with this script (all names are correct, and the action is being called but none of the classes, even the ones that worked before, can be called like this anymore):
NPC Code:

if(actionserverside){
if(strequals(#p(0),lay)){
putnpc2 mousex,mousey,{join force field};
}
}
//#CLIENTSIDE

if(weaponfired || mousedown){
triggeraction 0,0,serverside,mousetest,lay;
}

Reply With Quote
  #2  
Old 12-27-2005, 09:24 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Take out the space, rename the class to have an _, or use the new engine with quotes, join("force field");

either that, or it may have a problem with the mouse variables, because I don't think those are accessible serverside. Try sending them as parameters and use strtofloat(#p(2)) or whatever.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #3  
Old 12-27-2005, 09:40 PM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
Quote:
Originally Posted by ApothiX
Take out the space, rename the class to have an _, or use the new engine with quotes, join("force field");

either that, or it may have a problem with the mouse variables, because I don't think those are accessible serverside. Try sending them as parameters and use strtofloat(#p(2)) or whatever.
T'is true wisdom. I've actually never seen someone use space in a classname, not sure if it works. And mouse coordinates can't be read serverside.
__________________
Reply With Quote
  #4  
Old 12-27-2005, 10:02 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
actually, none of the classes work, not even the graalats one X_X
Reply With Quote
  #5  
Old 12-27-2005, 10:15 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by excaliber7388
actually, none of the classes work, not even the graalats one X_X
:x I don't think you should really be joining the gralats class anyway.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #6  
Old 12-27-2005, 11:13 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
mousex and mousey are not available on the serverside. You will probably find that you are placing the NPCs, but on coordinates (0, 0) instead of your desired coordinates.
__________________
Skyld
Reply With Quote
  #7  
Old 12-28-2005, 03:32 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
When using quotes within quotes in GS2, you will need to put a back-slash before the quote that will be read as inside the string, a thanks to Malinko for pointing this fact out for me:
PHP Code:
putnpc2(player.0.5 vecx(player.dir),player.vecy(player.dir),"join(\"mud_item\");"); 
And since mousex and mousey are clientside-only you would just need to send them with the trigger.
__________________
Reply With Quote
  #8  
Old 12-28-2005, 07:31 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Inverness
you will need to put a back-slash before the quote that will be read as inside the string
'tis called escaping the character
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #9  
Old 12-29-2005, 03:05 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
nope, none of that works X_X none of the classes work, even the ones that worked before. And how do i send mousex and y with the trigger
Reply With Quote
  #10  
Old 12-29-2005, 12:38 PM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
Quote:
Originally Posted by excaliber7388
nope, none of that works X_X none of the classes work, even the ones that worked before. And how do i send mousex and y with the trigger
Quote:
Originally Posted by ApothiX
Try sending them as parameters and use strtofloat(#p(2)) or whatever.
Try reading...
__________________
Reply With Quote
  #11  
Old 12-29-2005, 01:05 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
add mousex/y to the triggeraction. Read the mousex/y from the triggeraction.
__________________
Reply With Quote
  #12  
Old 12-29-2005, 01:16 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
This is your 23rd thread in the NPC Scripting forums that I have counted asking for help, and still, you do not read what people say. This annoys me, and others, so please learn to read what is said when people try to help.

What ApothiX says is correct. Add your parameters to the triggeraction (#v(mousex) and #v(mousey)). For example.
PHP Code:
triggeraction 0,0,serverside,MyWeapon,place,#v(mousex),#v(mousey); 
... and read them on the serverside using strtofloat(#p()). For example.
PHP Code:
if (actionserverside)
{
  if (
strequals(#p(0),place))
  
{
    
putnpc2 strtofloat(#p(1)),strtofloat(#p(2)),join classname;
  
}

__________________
Skyld
Reply With Quote
  #13  
Old 12-29-2005, 01:31 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
I would have thought anyone would know mouse coordinates can only be read clientside :P

And you SHOULD be using/learning GS2 :P
Reply With Quote
  #14  
Old 12-29-2005, 05:04 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
Quote:
Originally Posted by ApothiX
'tis called escaping the character
Hmm... I like it!
__________________
Reply With Quote
  #15  
Old 12-29-2005, 07:30 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Codein
And you SHOULD be using/learning GS2 :P
Not all servers have the new engine enabled on them.

Quote:
Originally Posted by Inverness
Hmm... I like it!
It's like the quote is escaping from jail!
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #16  
Old 12-30-2005, 12:48 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
here's the script im using, still will not work X_X probably something stupid....as usual
NPC Code:
if(actionserverside)
{
if(strequals(#p(0),mp))
{
playermp=playermp-1;
}
if(strequals(#p(0),mp2))
{
playermp=playermp+1;
}
if(strequals(#p(0),join))
{
putnpc2,strtofloat(#p(1)),strtofloat(#p(2)),{join force_field;};
}
}
//#CLIENTSIDE
if(mousedown && this.inuse==0 && strequals(#w,Force Field))
{
this.inuse=1;
timeout=.05;
}
else if(mousedown && this.inuse==1)
{
this.inuse=0;
timeout=0;
}
if(timeout && playermp>0 && this.used==0)
{
this.i=this.i+1;
showimg this.i,watermateria.png,mousex,mousey;
changeimgcolors this.i,.5,.75,1,.8;
triggeraction 0,0,serverside,Force Field,mp;
triggeraction 0,0,serverside,Force Field,join,#v(mousex),#v(mousey);
timeout=.05;
}
if(timeout && playermp>0 && this.used==1)
{
this.i=0;
this.used=0;
timeout=.05;
}
if(timeout && playermp=0)
{
this.inuse=0;
sleep 5;
for(this.o=0;this.o<this.i+1;this.o++)
{
hideimg this.o;
triggeraction 0,0,serverside,Force Field,mp2;
sleep .5;
}
timeout=0;
this.used=1;
this.i=0;
}
if(weaponfired)
{
say2 Press the mouse button#b
down when you are at the place#b
you would like to start the #b
force field, press it again to #b
stop;
}


....and the class:
NPC Code:

if(actionserverside)
{
if(strequals(#p(0),destroy))
{
destroy;
}
}
//#CLIENTSIDE
if(created)
{
setimg watermateria.png;
setshape 1,16,16;
blockagain;
timeout=5;
}
if(playertouchsme)
{
hurt 1;
}
if(timeout)
{
triggeraction 0,0,serverside,force_field,destroy;
}


Last edited by excaliber7388; 12-30-2005 at 12:58 AM.. Reason: bad habbits die hard, sorry again skyld
Reply With Quote
  #17  
Old 12-30-2005, 12:51 AM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
DO YOU NOT LEARN?

Follow these guidelines, specifically B.2.2, B.2.4 and C.1.

Edit: In fact, all of them.
__________________
Skyld
Reply With Quote
  #18  
Old 12-30-2005, 01:00 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
umm...rules were made to be broken? sorry...but what would a scripting post from me be without poorly formatted scripts? anyway i fixed it... a little.
Reply With Quote
  #19  
Old 12-30-2005, 01:10 AM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by excaliber7388
umm...rules were made to be broken?
Drop the stupid philosophy and help yourself already.
Quote:
Originally Posted by excaliber7388
sorry...but what would a scripting post from me be without poorly formatted scripts?
It would be absolutely wonderful!
Quote:
Originally Posted by excaliber7388
anyway i fixed it... a little.
Posting bad code is unhelpful and annoying, and it makes it harder to find problems. I do not wish to be horrible, but seriously. This is well over your 20th "help me" thread and it still has not sunk in!
__________________
Skyld
Reply With Quote
  #20  
Old 12-30-2005, 01:16 AM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
Skyld needs a hug. ;_;

-Hugs Skyld.-

Last edited by Yen; 12-30-2005 at 01:23 AM.. Reason: Nothing to see here, just move along..
Reply With Quote
  #21  
Old 12-30-2005, 02:41 AM
Riot Riot is offline
Delteria Management
Join Date: Nov 2003
Location: Seminole County, Florida
Posts: 280
Riot is on a distinguished road
Quote:
Originally Posted by excaliber7388
here's the script im using, still will not work X_X probably something stupid....as usual
Try this for starters:

In the weapon
  • Make your code easier to read, and more organized, such as doing:
    HTML Code:
    if (mousedown)
    {
      if (this.inuse == 0)
      {
        if (strequals(#w,Force Field))
        {
          this.inuse = 1;
          timeout = 0.05;
        }
      }
      else
      {
        this.inuse = 0;
        timeout = 0;
      }
    }
  • Don't use sleeps in a timeout (or even at all)
  • Your timeouts should be put together (like I did above with the mousedown)
  • I do not recommend doing a triggeraction to the server in any fast-moving timeout, it can (and probaby will) cause a decent amount of lag!

In the class
  • triggeractions do not work that way in classes
  • It would be better to just set the 5 second timeout on the serverside end, and just do if (timeout) destroy; instead of relying on the client to send a triggeraction
Reply With Quote
  #22  
Old 12-30-2005, 02:44 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
ah skyld, you're never horrible anyway, i'll try some of that, thanks. i guess the lag would explain why it returns more MP than it uses

Last edited by excaliber7388; 12-30-2005 at 02:57 AM..
Reply With Quote
  #23  
Old 12-30-2005, 10:52 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Skyld
This is well over your 20th "help me" thread and it still has not sunk in!
I think a 'temporary' block from accessing the Scripting Forums would help him greatly
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #24  
Old 12-30-2005, 07:23 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
ha ha asking questions is the best way to learn and i'm working on that formating XD however, even after taking some of the advice here, the script still will not join the class
Reply With Quote
  #25  
Old 12-30-2005, 08:46 PM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
Quote:
Originally Posted by excaliber7388
ha ha asking questions is the best way to learn and i'm working on that formating XD however, even after taking some of the advice here, the script still will not join the class
That would be because you have a comma after 'putnpc2' instead of a space.
Reply With Quote
  #26  
Old 12-30-2005, 08:55 PM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
You do know that if you keep posting scripts on the forum intended for Dark Rival use, everyone in the world would gain knowledge of every script on the server...
*lawl*
__________________
Reply With Quote
  #27  
Old 12-30-2005, 09:48 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by ZeLpH_MyStiK
You do know that if you keep posting scripts on the forum intended for Dark Rival use, everyone in the world would gain knowledge of every script on the server...
*lawl*
And no one will want to play it, because they will then realise how poorly scripted it was.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #28  
Old 12-30-2005, 10:03 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
the scripts are improved after i post here, these aren't full scripts
Reply With Quote
  #29  
Old 12-30-2005, 10:17 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by excaliber7388
the scripts are improved after i post here, these aren't full scripts
The fact is that we do not want you to post full scripts here and say "HEY FIX THIS". We want you to learn.

You need to apply some common sense, look at your script, identify and analyse the problem. Think it through. Why is this happening? What's causing this? What's surrounding this that could cause a problem? Read it all through. Ask yourself sensible questions before posting only the relevant code.

You do have a terrible habit of demanding we fix things for you.

If all else fails, go and hire a scripter that knows what they are doing.
__________________
Skyld
Reply With Quote
  #30  
Old 12-31-2005, 03:45 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Skyld
If all else fails, go and hire a scripter that knows what they are doing.
Amen.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #31  
Old 12-31-2005, 04:37 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
i really don't demand fixing, just an explanation of what i did wrong so i can learn it :| srry guys
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 04:23 PM.


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