Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Boat ride... (https://forums.graalonline.com/forums/showthread.php?t=73528)

theHAWKER 04-17-2007 06:48 AM

Boat ride...
 
Im making a boat system, but my script wont work can someone help me out:
PHP Code:

// NPC made by Join my guild Elite Mafia!
//#CLIENTSIDE
if (created) {
time 10;
}
if (
playerenters) {
time 10;
timeout .1;
}
if (
timeout) {
time -= 1;
timeout 2;
}
if (
time <=0) {
message T.T;
setlevel2 graallegacy_h04.nw,11,31;
scheduleevent(1,"Sailing","idle");
}
function 
onSailing() {
setlevel2 graallegacy_h04.nw,11,31;


i got the "scheduleevent(1,"Sailing","idle");" out of the "GBaddy" script (just to let you know...)

killerogue 04-17-2007 07:25 AM

*sigh*

You shouldn't take bits and pieces out of other scripts. Because nine times out of ten if you're ripping lines you have no clue what it does and you think it will work because you've looked it up on the wiki.

I say, WTF are you doing? I don't even script GS1 but I still know enough to know none of that makes any sense.

To have a boat travel a certain pathway requires, I would say, math of a medium intelligence level.

Twinny 04-17-2007 08:24 AM

If this is done on a server, setlevel2() won't work clientside, only serverside. If this is done offline, scheduleevent() won't work since it isn't available for GS1.

Kristi 04-17-2007 04:00 PM

Quote:

Originally Posted by theHAWKER (Post 1300597)
Im making a boat system, but my script wont work can someone help me out:
PHP Code:

// NPC made by Join my guild Elite Mafia!
//#CLIENTSIDE
if (created) {
time 10;
}
if (
playerenters) {
time 10;
timeout .1;
}
if (
timeout) {
time -= 1;
timeout 2;
}
if (
time <=0) {
message T.T;
setlevel2 graallegacy_h04.nw,11,31;
scheduleevent(1,"Sailing","idle");
}
function 
onSailing() {
setlevel2 graallegacy_h04.nw,11,31;


i got the "scheduleevent(1,"Sailing","idle");" out of the "GBaddy" script (just to let you know...)

The schedule event in this situation seems very unneccessary, since you are warping at the end of sailing already..

You have a conditional outside of an event, which may be the reason its not triggering. if (time <= 0) is not an event, it is a conditional. nothing triggers that logic when it happens, so its a toss up to the engine if it gets called or not.

PHP Code:

//#CLIENTSIDE
if (created) { // This EVENT happens when the npc is created
  
time 10;
}

if (
playerenters) { // This EVENT happens when the player enters.
  
time 10;
  
timeout .1;
}

if (
timeout) { // This EVENT happens when timeout reaches 0
  
time -= 1;
  if (
time <=0) { // This CONDITIONAL doesn't have anything trigger it
                 // so you have to test it inside an event, for example, timeout
    
message T.T;
    
setlevel2 graallegacy_h04.nw,11,31;
  }
  
timeout 2;



theHAWKER 04-17-2007 04:31 PM

That script you sent kristi wont work :(
your script dosen't do anything...
So i changed it up, but it only says "T.T"
PHP Code:

// NPC made by Join my guild Elite Mafia!
//#CLIENTSIDE
if (created) {
  
time 10;
}

if (
playerenters) {
  
time 10;
  
timeout .1;
}

if (
timeout) {
  
time -= 1;
  
timeout .1;
  if (
time <= 0) {
set sailing;
  }
}
if (
sailing) {
    
message T.T;
    
setlevel2 graallegacy_h04.nw,11,31;



DustyPorViva 04-17-2007 04:50 PM

Maybe try explaining what you want this to do? Because I think you're really making this more complicated than it needs to be, if I'm assuming right about what you're doing.

xXziroXx 04-17-2007 06:26 PM

Hawker, are you trying the script ONLINE or OFFLINE?

Kristi 04-17-2007 07:08 PM

Quote:

Originally Posted by theHAWKER (Post 1300636)
That script you sent kristi wont work :(
your script dosen't do anything...
So i changed it up, but it only says "T.T"
PHP Code:

// NPC made by Join my guild Elite Mafia!
//#CLIENTSIDE
if (created) {
  
time 10;
}

if (
playerenters) {
  
time 10;
  
timeout .1;
}

if (
timeout) {
  
time -= 1;
  
timeout .1;
  if (
time <= 0) {
set sailing;
  }
}
if (
sailing) {
    
message T.T;
    
setlevel2 graallegacy_h04.nw,11,31;



sailing isnt an event, its a conditional, the way i did it was correct.

it doesnt work because youre probably doing it online, setlevel2 doesnt work clientside online.

killerogue 04-17-2007 08:08 PM

Quote:

Originally Posted by theHAWKER (Post 1300636)
That script you sent kristi wont work :(
your script dosen't do anything...
So i changed it up, but it only says "T.T"

Dude, some general words of wisdom from a friend, Learn how to script first before you start trying to script everything complicated. Not a word for word quote as I forgot the exact words. But, meh, get's the point across.

All of GS1 is basically deprecated, how do you find:

setstring this.stuff,#c(blah)

easier than,

this.stuff = "blah";

I just don't get it....

zokemon 04-17-2007 09:05 PM

Quote:

Originally Posted by killerogue (Post 1300682)
Dude, some general words of wisdom from a friend, Learn how to script first before you start trying to script everything complicated. Not a word for word quote as I forgot the exact words. But, meh, get's the point across.

All of GS1 is basically deprecated, how do you find:

setstring this.stuff,#c(blah)

easier than,

this.stuff = "blah";

I just don't get it....

setstring this.stuff,#c(blah)?

That's basically doing this in GS2:
this.stuff = players[blah].chat;

Perhaps you just mean to write:
setstring this.stuff,blah;

theHAWKER 04-18-2007 04:15 AM

Quote:

Originally Posted by xXziroXx (Post 1300653)
Hawker, are you trying the script ONLINE or OFFLINE?

Im Doing this on a server.

Quote:

Originally Posted by DustyPorViva (Post 1300641)
Maybe try explaining what you want this to do? Because I think you're really making this more complicated than it needs to be, if I'm assuming right about what you're doing.

So basicly: i have a level on the gmap where you have to win a ticket to enter, then you go in this boat(which is in a normal "nw" file) when you wait for 20 sconds or so untill you arive at your destionation, which is another level on the gmap.

DustyPorViva 04-18-2007 04:57 AM

So why not do it simple and do something like...
NPC Code:
if (playerenters) timeout=20;
if (timeout) setlevel2 blahblah.nw,x,y;


EDIT: don't forget, you might want to warp them to the gmap instead(if that's where you're warping them) and thus, you need to find the gmap coordinates. Also, setlevel2 is serverside, not clientside.

theHAWKER 04-18-2007 05:31 AM

None of thies scripts work >:(
ive figured out that you cant have timeouts/sleeps in the same script that has "setlevel"
would there be another way to pause a script for a couple seconds?

killerogue 04-18-2007 05:33 AM

If you're doing this online it's going to get confusing (as only GS1 is).

But I'm pretty sure some triggeractions and clientsides are involved here.

DustyPorViva 04-18-2007 05:48 AM

If it's online, then you should probably have a setlevel script added into your database NPC, and triggeraction it.

killerogue 04-18-2007 05:58 AM

Or maybe just triggerserver in the script and call a serverside public function from DB?

But that's just being fancy schmancy :P

zokemon 04-18-2007 07:11 AM

Have you even read the rules for the scripting forum? You shouldn't expect people to just post entire scripts for you that work...
They are giving you advice as to HOW you should make YOUR OWN scripts.

DustyPorViva 04-18-2007 07:16 AM

Never asked for a whole script, asked for help, and people proceeded with scripts. He also continued to try to script it himself, even after someone posted a script for him. I don't see the problem.

zokemon 04-18-2007 07:40 AM

Quote:

Originally Posted by DustyPorViva (Post 1300880)
Never asked for a whole script, asked for help, and people proceeded with scripts. He also continued to try to script it himself, even after someone posted a script for him. I don't see the problem.

I was responding to his post as to "how none of these scripts work" by pointing out how they weren't full scripts (I didn't see any atleast).

DustyPorViva 04-18-2007 02:40 PM

Well he's getting various different tips on how to try to get this to work, I don't think he literally meant the scripts, but the advice we were giving him. You really are digging too deep into this, he's hardly breaking the rules and he's been trying to get this to work himself.

Andy0687 04-18-2007 07:22 PM

Quote:

Originally Posted by DustyPorViva (Post 1300856)
NPC Code:
if (playerenters) timeout=20;
if (timeout) setlevel2 blahblah.nw,x,y;


This is your shortest working solution in gs1 but you dont want to put it clientside (like i suspect you are doing) unless you want to trigger to warp the player (since setlevel2 isnt clientside).

theHAWKER 04-19-2007 12:28 AM

Quote:

Originally Posted by Andy0687 (Post 1300995)
This is your shortest working solution in gs1 but you dont want to put it clientside (like i suspect you are doing) unless you want to trigger to warp the player (since setlevel2 isnt clientside).

As i said before none of sleeping type scripts work:cry:

Dose anyone know how to make a script just puase without using sleep or timeout?

Chandler 04-19-2007 09:16 AM

Quote:

Originally Posted by theHAWKER (Post 1301075)
As i said before none of sleeping type scripts work:cry:

Dose anyone know how to make a script just puase without using sleep or timeout?

waitfor
scheduleevent

DustyPorViva 04-19-2007 02:52 PM

But there should be no reason for using something other than sleep or timeout. Instead of trying to find an alternative, you should try figuring out what's going on.

Deadly_Killer 04-30-2007 04:45 AM

PHP Code:

if (created) {
  
setshape 1,32,32;
}

if (
actionwarp) {
  
setlevel2 graallegacy_h04.nw,11,31;
}

//#CLIENTSIDE
if (playerenters) {
  
timeout 10;
}

if (
timeout) {
  
triggeraction x 0.5,0.5,warp,;


incase you didnt get it yet, that should work.


All times are GMT +2. The time now is 06:41 PM.

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