Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Old Scripting Engine (GS1)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-24-2008, 09:44 PM
johny023 johny023 is offline
Registered User
Join Date: Dec 2006
Posts: 36
johny023 is on a distinguished road
Question problem with lag? does "destroy" really get rid of the npc?

i've made a minigame to add into my offline game... and in the minigame you must defend the castle from waves of monsters, after a few waves it starts to lag and after a few more.. it gets to the point where i can't even move, and it eventually gets so bad graal just closes for no reason. in the earlier levels more monsters spawn, it was working just fine with 5-10 spawning at once but after a few waves i can't even spawn 2 without it lagging really bad. so i thought maybe it's just that wave that makes it lag so i pressed F4 skipped to that wave and set everything to be the same way it was before, it worked fine? no lag at all? then i thought.. maybe the "destroy" trigger doesn't get rid of the npc.. maybe it only hides it and stops it from doing anything...

for each wave of monsters i have a npc that uses the putnpc trigger and when the npc dies i used the destroy trigger to get rid of it.
can someone tell me why it lags? and how to fix it?

sorry if i put this in the wrong place not sure where to put it.
Reply With Quote
  #2  
Old 09-24-2008, 10:17 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Are you using destroy(); clientside? If so, try use it serverside.

Some code(s)/snippet(s) would help alot though..
__________________
Reply With Quote
  #3  
Old 09-24-2008, 11:22 PM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by Chompy View Post
Are you using destroy(); clientside? If so, try use it serverside.

Some code(s)/snippet(s) would help alot though..
He said he's making an offline game, so there is no serverside :P.

Ideally, destroy should completely remove the NPC. However, from what you have stated it is a possibility that the offline mode is leaving destroyed NPCs in memory. Still, it is also possible there is another piece of code that is causing the slowdown. As Chompy said, providing snippets of the code would help us find an answer.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #4  
Old 09-25-2008, 12:13 AM
johny023 johny023 is offline
Registered User
Join Date: Dec 2006
Posts: 36
johny023 is on a distinguished road
i'm not really sure what part of the code is needed though... the npc that places the waves of monsters, the monsters, or your allys?

to me it doesn't seem to be the allys it lags with or without them... so what would you need?

sorry for taking so long to reply was busy and i'll need to go to sleep soon, if i don't reply in 2-3 min just check back tomorrow plz

and is there a way to set it serverside in a offline world? if there is i'll try that.
Reply With Quote
  #5  
Old 09-25-2008, 12:24 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
Quote:
Originally Posted by johny023 View Post
and is there a way to set it serverside in a offline world? if there is i'll try that.
Yes, add //#SERVERSIDE at the top of the npcs.

Not really. Don't. Please.


We probably need to see the code for how you are placing the monster, and how you are trying to destroy it.
__________________
Reply With Quote
  #6  
Old 09-25-2008, 02:00 AM
johny023 johny023 is offline
Registered User
Join Date: Dec 2006
Posts: 36
johny023 is on a distinguished road
Quote:
Originally Posted by cbk1994 View Post
Yes, add //#SERVERSIDE at the top of the npcs.

Not really. Don't. Please.


We probably need to see the code for how you are placing the monster, and how you are trying to destroy it.
well here's the script i used to get rid of them

PHP Code:
if (this.hp<=&& timeout){
hearts 0;
setcharani goblin_death,;
sleep 1;
credits += 40;
destroy;

and here's the script i'm using to place the npcs


PHP Code:
if (timeout) {

this.random(0,100);
this.i2 random(0,100);
this.i3 random(0,100);
this.i4 random(0,100);
this.i5 random(0,100);
this.i6 random(0,100);
this.i7 random(0,100);
this.i8 random(0,100);
this.i9 random(0,100);
this.i10 random(0,100);
this.i11 random(0,100);
this.i12 random(0,100);

if (
this.i<=40 && wolvesleft>=0putnpc block.gif,gg_wolf.txt,random(20,40),61;
if (
this.i2<=40 && wolvesleft>=0putnpc block.gif,gg_wolf.txt,random(20,40),61;
if (
this.i3<=40 && wolvesleft>=0putnpc block.gif,gg_wolf.txt,random(20,40),61;
if (
this.i4<=40 && wolvesleft>=0putnpc block.gif,gg_wolf.txt,random(20,40),61;

if (
this.i5<=40 && snakesleft>=0putnpc block.gif,gg_snake2.txt,random(20,40),61;
if (
this.i6<=40 && snakesleft>=0putnpc block.gif,gg_snake2.txt,random(20,40),61;
if (
this.i7<=40 && snakesleft>=0putnpcblock.gif,gg_snake2.txt,random(20,40),61;

if (
this.i8<=40 && goblinsleft>=0putnpc block.gif,gg_goblin.txt,random(20,40),61;
if (
this.i9<=40 && goblinsleft>=0putnpc block.gif,gg_goblin.txt,random(20,40),61;
if (
this.i10<=40 && goblinsleft>=0putnpc block.gif,gg_goblin.txt,random(20,40),61;
if (
this.i11<=40 && goblinsleft>=0putnpc block.gif,gg_goblin.txt,random(20,40),61;
if (
this.i12<=40 && goblinsleft>=0putnpc block.gif,gg_goblin.txt,random(20,40),61;

it's probably not the best script.. but it's the only way i could find to make a a random amount of npcs to spawn.

and i'll try the serverside thing

edit: i tried changing it to serverside but it didn't help any.

Last edited by johny023; 09-25-2008 at 02:44 AM.. Reason: serverside didn't work
Reply With Quote
  #7  
Old 12-13-2008, 08:43 PM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
Not sure, but I think the "//#SERVERSIDE" was a joke oO

Actually I'm pretty sure that it was a joke xD


Also I am not sure AT ALL, but I think you should use "this.destroy();"
oO
Reply With Quote
  #8  
Old 12-13-2008, 08:53 PM
LoneAngelIbesu LoneAngelIbesu is offline
master of infinite loops
LoneAngelIbesu's Avatar
Join Date: May 2007
Location: Toldeo, Ohio
Posts: 1,049
LoneAngelIbesu has a spectacular aura aboutLoneAngelIbesu has a spectacular aura about
Send a message via AIM to LoneAngelIbesu
Quote:
Originally Posted by Pelikano View Post
Also I am not sure AT ALL, but I think you should use "this.destroy();"
oO
No. destroy(); is GS2. destroy; is GS1.
__________________
"We are all in the gutter, but some of us are looking at the stars."
— Oscar Wilde, Lady Windermere's Fan
Reply With Quote
  #9  
Old 12-14-2008, 01:26 PM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
Oh okay
Reply With Quote
  #10  
Old 12-14-2008, 04:54 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by LoneAngelIbesu View Post
No. destroy(); is GS2. destroy; is GS1.
Well it's obj.destroy(), then if no obj. is specified it just destroys the object in scope.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
Reply


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:00 AM.


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