Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   JKL's Scripting Questions (https://forums.graalonline.com/forums/showthread.php?t=134258195)

Mark Sir Link 03-15-2010 05:08 AM

Quote:

Originally Posted by jkldogg (Post 1562657)
Thank you all for your concern. I will now begin learning to script, I found a good guide. I hope I can be as good as you guys one day. I look up to: Chris Vimes, Switch, and salesman. I view them as good scripters. (Sorry Jerret, i've never seen you script.)

http://www.gs2.graalstudios.com/index.php?page=basic

To answer your question directly, add enablefeatures(allfeatures - 4); to your Inventory script.

To expand upon what they said, the post I wrote containing the bitflags + enablefeatures function should have been enough for you to figure it out on your own if you were to look up bitflags on Google.

jkldogg 03-16-2010 12:38 AM

scripting is so hard

Imperialistic 03-16-2010 01:20 AM

Jerret is a great scripter, and very helpful to others willing to learn. I have alot of respect for him and Chris Vimes.

jkldogg 04-02-2010 05:05 AM

Spar
 
tried to make a spar, help from cody

Where's the problem?

PHP Code:

function onPlayerChats() {
  if (
player.chat==":in") {
    if (
clientr.inspar==false) {
      if (
serverr.sparp<2) {
        
clientr.inspar true;
        
serverr.sparp += 1;
        
player.chat "";
        
setlevel2 vega_spar.nw,32.25,21.5);
      }else
          
player.chat "Therearepeopletheinsparalready";
    }else
        
player.chat "";
  }elseif (
player.chat=="ut") {
    if (
clientr.inspar==true) {
      
serverr.sparp -= 1;
      
clientr.inspar false;
      
player.chat "";
      
setlevel2 vega_spar.nw,8.5,46);
    }else
        
player.chat "";
  }



Imperialistic 04-02-2010 12:20 PM

First off, you should really format your script better.
Try reading this:
http://forums.graalonline.com/forums...ad.php?t=61805

DrakilorP2P 04-02-2010 03:40 PM

Quote:

Originally Posted by jkldogg (Post 1566594)
tried to make a spar, help from cody

Where's the problem?

It'd help if you told us how it isn't working.

Not sure if this will fix it, but try formatting the setlevel2 lines like this:
PHP Code:

setlevel2("vega_spar.nw",32.25,21.5); 

It would have been valid GS1, but you had a ) without a matching (.

Liberated 04-02-2010 04:53 PM

Quote:

Originally Posted by DrakilorP2P (Post 1566676)
It'd help if you told us how it isn't working.

Not sure if this will fix it, but try formatting the setlevel2 lines like this:
PHP Code:

setlevel2("vega_spar.nw",32.25,21.5); 

It would have been valid GS1, but you had a ) without a matching (.

Yeah, this is what the RC fixer also told me.

For the rest the script doesn't seem quite finished yet.
What happeneds if you die, from what i understand your server will be a modern one, and i'd asume you'd be warped to a hospital or a base of somesort.
But the script doesn't give any solution for this.
I'd suggest running a timeout that checks if the player is still within the spar room.

so something like
PHP Code:

function onTimeOut()
{
  if(
player.level != "vega_spar.nw")
  {
    
clientr.inspar false;
    
serverr.sparp -= 1;
  }
  else if(
player.<= this.edgex)
  {
    
clientr.inspar false;
    
serverr.sparp -= 1;
  }
  else if(
player.<= this.edgey)
  {
    
clientr.inspar false;
    
serverr.sparp -= 1;
  }
  else
  {
    
setTimer(.05);
  }


i know this probably isn't the most efficient script, or if it's even working, i typed it in here. But it should show what i mean.

cbk1994 04-02-2010 08:59 PM

Quote:

Originally Posted by Liberated (Post 1566705)
if(player.level.name != "vega_spar.nw")

And you really wouldn't need or want a timeout for that.

jkldogg 04-03-2010 06:22 AM

The problem is when i say ":in" it doesn't warp you in.

fowlplay4 04-03-2010 08:03 AM

Quote:

Originally Posted by jkldogg (Post 1566817)
The problem is when i say ":in" it doesn't warp you in.

Did you update the script any? If you followed Drakilor's tip to fix it should be fine.

jkldogg 04-03-2010 09:57 AM

Quote:

Originally Posted by DrakilorP2P (Post 1566676)
It'd help if you told us how it isn't working.

Not sure if this will fix it, but try formatting the setlevel2 lines like this:
PHP Code:

setlevel2("vega_spar.nw",32.25,21.5); 

It would have been valid GS1, but you had a ) without a matching (.

Quote:

Originally Posted by fowlplay4 (Post 1566823)
Did you update the script any? If you followed Drakilor's tip to fix it should be fine.

Yes, i fixed the set levels and went in game and said :in and it didn't work.

Graal Editor gave me this error when I clicked Test

PHP Code:

ErrorExpected format setlevel2 string,real,real


Codein 04-03-2010 10:02 AM

Quote:

Originally Posted by jkldogg (Post 1566835)
Yes, i fixed the set levels and went in game and said :in and it didn't work.

Graal Editor gave me this error when I clicked Test

PHP Code:

ErrorExpected format setlevel2 string,real,real


Could you post your updated script?

Switch 04-03-2010 10:13 AM

Quote:

Originally Posted by jkldogg (Post 1566835)
Graal Editor

You have to test this online. GS2 doesn't work offline.

jkldogg 04-03-2010 10:43 AM

Codein

PHP Code:

function onPlayerChats() {
  if (
player.chat==":in") {
    if (
clientr.inspar==false) {
      if (
serverr.sparp<2) {
        
clientr.inspar true;
        
serverr.sparp += 1;
        
player.chat "";
        
setlevel2("vega_spar.nw",32.25,21.5);
      }else
          
player.chat "Therearepeopletheinsparalready";
    }else
        
player.chat "";
  }elseif (
player.chat=="ut") {
    if (
clientr.inspar==true) {
      
serverr.sparp -= 1;
      
clientr.inspar false;
      
player.chat "";
      
setlevel2("vega_spar.nw",32.25,21.5);
    }else
        
player.chat "";
  }



Switch How, a weapon?

FaLLChiLD 04-03-2010 10:55 AM

Sorry...but this thread is blowing my f*#&ing mind, lol!

DrakilorP2P 04-03-2010 12:26 PM

Quote:

Originally Posted by jkldogg (Post 1566840)
Switch How, a weapon?

You can just put it in an NPC in the level.

Switch 04-03-2010 01:04 PM

Quote:

Originally Posted by jkldogg (Post 1566840)
Switch How, a weapon?

A level NPC would be best, like Drakilor said. Also, if this is going right in the same level that the spar area is in, you might as well use player.x and player.y instead of setlevel2(), since that may be easier to read.

fowlplay4 04-03-2010 04:54 PM

I believe it might be related due to the lack of the player prefix, or conflict with local systems.

Try this level script:

PHP Code:

function onPlayerChats() {
  if (
player.chat == "testwarp") {
    
player.setlevel2("onlinestartlocal.nw"3030);
    
player.chat "Warped!";
  }



Switch 04-04-2010 03:35 AM

Quote:

Originally Posted by fowlplay4 (Post 1566864)
I believe it might be related due to the lack of the player prefix, or conflict with local systems.

Since the player triggers the onPlayerChat() event, you don't need to use the player prefix, at least I haven't had to, though it is good practice to do so.

jkldogg 04-04-2010 07:38 AM

Quote:

Originally Posted by fowlplay4 (Post 1566864)
I believe it might be related due to the lack of the player prefix, or conflict with local systems.

Try this level script:

PHP Code:

function onPlayerChats() {
  if (
player.chat == "testwarp") {
    
player.setlevel2("onlinestartlocal.nw"3030);
    
player.chat "Warped!";
  }



This Worked, but i'm scrapping that spar system that i made, it sucks.

Liberated 04-04-2010 12:15 PM

Quote:

Originally Posted by cbk1994 (Post 1566761)
And you really wouldn't need or want a timeout for that.

No? Then in what way can you constantly check if the player is still in the level?

edit:
Ah im assuming you mean onPlayerLeaves()?


All times are GMT +2. The time now is 08:12 AM.

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