Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Need Help with a "Homestone" Script (https://forums.graalonline.com/forums/showthread.php?t=81391)

Deathborn123 08-23-2008 02:28 AM

Need Help with a "Homestone" Script
 
Hey NAT Community,

I'd need help with my script which is basicly porting you to the onlinestartlocal after 10secs and playing a gani in this time. After you used it, you'd have a Cooldown for 6minutes. Quite simply you may think but i tried and tried and asked some people but they coulnd't help me, maybe you can?! :)

Oh yea and please keep those "My Ass whats that for a dumb script" for yourself please ;)

Here is what i did so far:


//This will be the Homestone porting you to the Onlinestartlocal
function onActionServerside(action){
if (action == "warp"){
setlevel2("onlinestartlocal.graal",30,30);
player.chat="passed!";
}
}


//#CLIENTSIDE
function onCreated() {
client.cooldown = false;

}
function onWeaponfired() {
if (client.pause<=0&&client.cooldown=false) {
setani Homestone,NULL;
player.freezetime = 10.0;
client.cooldown = true;

setTimer(0.10);


}
else {
player.chat="Your Homestone is not Ready yet! You need to wait atleast " @client.pause@ " seconds!";

}
}

function onTimeout() {
triggeraction(0,0,serverside,warp,warpout,null);
player.chat="Warped!";
for (client.pause=>0; client.pause <=600; client.pause-1;){
sleep 1.0;


}
if (client.pause=0) {
client.cooldown = false;
}
}


Regards,
Zab

Codein 08-23-2008 02:46 AM

You're using a mix of GS1 and GS2 which is very bad.
Also, try using triggerserver("gui", name, "warpout");

Also, you should be doing

for (client.pause = 0; client.pause <= 600; client.pause -= 1)

Tigairius 08-23-2008 04:28 AM

PHP Code:

function onActionserverside(action) {
  switch (
action) {
    case 
"warp":
      if (
timevar2 player.local.waittime 60) {
        
setlevel2("onlinestartlocal.nw"3030);
        
player.local.waittime timevar2;
      }else
        
player.chat "Not ready yet. Wait" SPC int(player.local.waittime timevar2SPC "seconds.";
     break;
  }
}
//#CLIENTSIDE
function onWeaponFired() {
  
triggerserver("gui"this.name"warp");


Why don't you try something like this?

Codein 08-23-2008 04:31 AM

Quote:

Originally Posted by Tigairius (Post 1416741)
PHP Code:

function onActionserverside(action) {
  switch (
action) {
    case 
"warp":
      if (
timevar2 player.local.waittime 60) {
        
setlevel2("onlinestartlocal.nw"3030);
        
player.local.waittime timevar2;
      }else
        
player.chat "Not ready yet.";
     break;
  }
}
//#CLIENTSIDE
function onWeaponFired() {
  
triggerserver("gui"this.name"warp");


Why don't you try something like this?

A very basic version but he also wants a cool down period, which would be easily implemented using you code :)

Tigairius 08-23-2008 04:35 AM

Quote:

Originally Posted by Codein (Post 1416742)
A very basic version but he also wants a cool down period, which would be easily implemented using you code :)

It has a cooldown of 60 seconds like his script :p

Codein 08-23-2008 04:39 AM

Quote:

Originally Posted by Tigairius (Post 1416743)
It has a cooldown of 60 seconds like his script :p

Oh yeah. I didn't notice :)

WhiteDragon 08-23-2008 04:47 AM

Well, they could mash the D button and trigger the server a ton. Might be better to do the checking clientside. Pretty easy to change anyways.

Tigairius 08-23-2008 04:50 AM

Quote:

Originally Posted by WhiteDragon (Post 1416746)
Well, they could mash the D button and trigger the server a ton. Might be better to do the checking clientside. Pretty easy to change anyways.

It would be very hard to send enough triggers by mashing down the D key to even lag the server, especially with the checks that are being done serverside. On the other hand, if it were to loop through a bunch of players, that's another story.

Codein 08-23-2008 05:08 AM

I think clientside checking would be the best bet here, to be quite honest. I would always try and avoid making triggers to serverside as much as possible unless needed.

cbk1994 08-23-2008 05:25 AM

Check first on clientside, then later on serverside (to be sure they aren't, for some reason, changing the data).

xXziroXx 08-23-2008 03:26 PM

Quote:

Originally Posted by cbk1994 (Post 1416752)
Check first on clientside, then later on serverside (to be sure they aren't, for some reason, changing the data).

What he said.

TheStan 08-23-2008 05:15 PM

I noticed Tig used...

PHP Code:

player.local.waittime timevar2

I hope the local object is something you just threw on there and not another thing I don't know about. :(

Tigairius 08-23-2008 05:33 PM

Quote:

Originally Posted by TheStan (Post 1416791)
I noticed Tig used...

PHP Code:

player.local.waittime timevar2

I hope the local object is something you just threw on there and not another thing I don't know about. :(

Well local flags exist, but after you pointed that out I noticed I should have just used a flag without a prefix. (player.waittime)

cbk1994 08-23-2008 05:57 PM

Quote:

Originally Posted by Tigairius (Post 1416793)
Well local flags exist, but after you pointed that out I noticed I should have just used a flag without a prefix. (player.waittime)

What's the advantage to something like player.waittime as opposed to clientr.waittime?

Tigairius 08-23-2008 06:06 PM

Quote:

Originally Posted by cbk1994 (Post 1416796)
What's the advantage to something like player.waittime as opposed to clientr.waittime?

Well, you can use almost any flag type you want for this procedure. A flag with no lead is saved on the player's account and can only be accessed server-side. Clientr. sends the strings to client as well, which is sort of unnecessary since we'll probably never use waittime client-side as there is no timevar or timevar2 clientside. If you do player.waittime client-side it won't be able to be read by the NPC-Server.

Inverness 08-23-2008 07:05 PM

player variables aren't converted to and from strings like client variables, so you can use objects on them and have large string sizes without them being cut off.


All times are GMT +2. The time now is 02:03 PM.

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