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 02-26-2006, 10:21 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
weapon not working

this is a big script, and I'm haiving trouble finding it's problems. Since i'm not posting the full script, assume that all variables and strings are accounted for. The problem is, when I click, nothing happens, and the target doesn't follow the mouse.
NPC Code:
if(weaponfired && playermp>(20-strtofloat(#s(clientr.divine_skill))))
{
timeout=.05;
//stuff
if(strtofloat(#s(clientr.divine_mode))==1)
{
//stuff
if(playerdir==0)
{
for(this.i=2;this.i<20;this.i++)
{
showimg 0,dr-divine_light_attack.png,playerx+.5,playery-this.i;
changeimgpart 0,34,0,32,32;
hitobjects strtofloat(#s(clientr.divine_attack)),playerx+.5,p layery-this.i;
sleep .05;
}
}
else if(playerdir==2)
{
for(this.i=2;this.i<20;this.i++)
{
//stuff
}
}
else if(playerdir==1)
{
for(this.i=0;this.i<20;this.i++)
{
//stuff
}
}
else if(playerdir==3)
{
for(this.i=2;this.i<20;this.i++)
{
//stuff
}
}
hideimg 0;
}
if(strtofloat(#s(clientr.divine_mode))==2 || timeout)
{
//stuff
showimg 300,dr-crosshairs.png,mousex-.5,mousey-.5;
if(mousedown && leftmousebutton)
{
//stuff
for(this.i=0;this.i<this.c+1;this.i++)
{
//stuff
{
//stuff
{
//stuff
}
if(this.y>mousey)
{
//stuff
}
}
if(this.x>mousex)
{
//stuff
if(this.y<mousey)
{
//stuff
if(this.y>mousey)
{
//stuff
}
}
if(this.y<mousey)
{
//stuff
if(this.x<mousex)
{
//stuff
}
if(this.x>mousex)
{
//stuff
}
}
if(this.y>mousey)
{
//stuff
if(this.x<mousex)
{
//stuff
}
if(this.x>mousex)
{
//stuff
}
}
//stuff
sleep .05;
}
}
if(isweapon && this.inuse==1 && keypressed && strequals(#p(1),A))
{
hideimg 300;
this.inuse=0;
timeout=0;
}
timeout=.05;
}

//stuff
}

Reply With Quote
  #2  
Old 02-26-2006, 11:16 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
Read your other threads please.
Do not confuse events with booleans.
keypressed is an event.
weaponfired is an event.
this.var == 1 is a boolean.
playermp > 20 is a boolean.
__________________
Reply With Quote
  #3  
Old 02-27-2006, 12:40 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 simplified it a bit. When you fire the weapon, the character freezes, clicking and A do nothing, and the fire appears, but does not follow
NPC Code:

if(weaponfired)
{
//stuff
if(strtofloat(#s(clientr.divine_mode))==2 || timeout && strtofloat(#s(clientr.divine_mode))==2)
{
//stuff
this.inuse=1;
if(this.inuse==1 ||timeout && this.inuse==1)
{
showimg 300,fire.gif,mousex,mousey;
timeout=.05;
}

if(mousedown && this.inuse==1)
{
putexplosion 1,mousex,mousey;
enabledefmovement;
}
if(keypressed && strequals(#p(1),A))
{
hideimg 300;
timeout=0;
this.inuse=0;
enabledefmovement;
}
}
}

Reply With Quote
  #4  
Old 02-27-2006, 12:35 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
Read my post -.-
Quote:
Originally Posted by ZeLpH_MyStiK
Read your other threads please.
Do not confuse events with booleans.
keypressed is an event.
weaponfired is an event.
this.var == 1 is a boolean.
playermp > 20 is a boolean.
__________________
Reply With Quote
  #5  
Old 02-27-2006, 10:24 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
got it, but now i have a new problem: this part doesn't work
NPC Code:
for(this.i=0;this.i<this.c+1;this.i++)
{
if(this.x<this.mousex)
{
this.x++;
if(this.y<this.mousey)
{
showimg 0,dr-divine_light_attack.png,this.x,this.y;
changeimgpart 0,68,0,32,32;
}
else if(this.y>this.mousey)
{
showimg 0,dr-divine_light_attack.png,this.x,this.y;
changeimgpart 0,68,68,32,32;
}
}
else if(this.x>this.mousex)
{
this.x--;
if(this.y<this.mousey)
{
showimg 0,dr-divine_light_attack.png,this.x,this.y;
changeimgpart 0,68,0,32,32;
}
else if(this.y>this.mousey)
{
showimg 0,dr-divine_light_attack.png,this.x,this.y;
changeimgpart 0,68,68,32,32;
}
}
else if(this.y<this.mousey)
{
this.y++;
if(this.x<this.mousex)
{
showimg 0,dr-divine_light_attack.png,this.x,this.y;
changeimgpart 0,68,68,32,32;
}
else if(this.x>this.mousex)
{
showimg 0,dr-divine_light_attack.png,this.x,this.y;
changeimgpart 0,0,0,32,32;
}
}
else if(this.y>this.mousey)
{
this.y--;
if(this.x<this.mousex)
{
showimg 0,dr-divine_light_attack.png,this.x,this.y;
changeimgpart 0,68,68,32,32;
}
else if(this.x>this.mousex)
{
showimg 0,dr-divine_light_attack.png,this.x,this.y;
changeimgpart 0,0,0,32,32;
}
}
sleep .05;
}


Last edited by excaliber7388; 02-28-2006 at 12:51 AM..
Reply With Quote
  #6  
Old 02-28-2006, 03:38 AM
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
We do not know what those variables are, please clarify.
__________________
Reply With Quote
  #7  
Old 02-28-2006, 03:26 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
Quote:
Originally Posted by ZeLpH_MyStiK
We do not know what those variables are, please clarify.
Good point XD
this.x and this.y are the coordinates of the showimg
this.playerx and this.playery are the players coordinates when the weapon is fired
this.mousex and this.mousey are the coordinates of the mouse when the weapon is fired
Reply With Quote
  #8  
Old 02-28-2006, 06:25 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
At a quick glance, you should not be using this.x and this.y as variables, especially if you intend on having the new engine enabled some day.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #9  
Old 02-28-2006, 09:37 PM
Damix2 Damix2 is offline
RED SQUARE CLUB
Join Date: Nov 2003
Location: NY-what's better?
Posts: 3,577
Damix2 will become famous soon enough
Quote:
Originally Posted by ApothiX
At a quick glance, you should not be using this.x and this.y as variables, especially if you intend on having the new engine enabled some day.

Yes, ran into many problems with that.

They are reserved.
__________________
Reply With Quote
  #10  
Old 02-28-2006, 11:12 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
Quote:
Originally Posted by Damix2
Yes, ran into many problems with that.

They are reserved.
Ouch i'll chsnge them. GS2 is enabled on DR, could this be a reason it doesn't work?
Reply With Quote
  #11  
Old 02-28-2006, 11:50 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
Here's the entire block this is working from
NPC Code:
if(mousedown && this.inuse==1 && leftmousebutton)
{
mousex=this.mousex;
mousey=this.mousey;
this.playerx=playerx;
this.playery=playery;
this.px=playerx;
this.py=playery;
this.x2=abs(this.mousex-this.playerx);
this.c=(this.px^2+this.py^2)^.25;
hitobjects strtofloat(#s(clientr.divine_attack)),mousex-.5,mousey-.5;
hitobjects strtofloat(#s(clientr.divine_attack)),mousex+.5,mo usey+.5;
hitobjects strtofloat(#s(clientr.divine_attack)),mousex,mouse y;
for(this.i=0;this.i<this.c;this.i++)
{
if(this.px<this.mousex)
{
this.px++;
if(this.py<this.mousey)
{
showimg 0,dr-divine_light_attack.png,this.px,this.py;
changeimgpart 0,68,0,32,32;
}
if(this.py>this.mousey)
{
showimg 0,dr-divine_light_attack.png,this.px,this.py;
changeimgpart 0,68,68,32,32;
}
}
if(this.px>this.mousex)
{
this.px--;
if(this.py<this.mousey)
{
showimg 0,dr-divine_light_attack.png,this.px,this.py;
changeimgpart 0,68,0,32,32;
}
if(this.py>this.mousey)
{
showimg 0,dr-divine_light_attack.png,this.px,this.py;
changeimgpart 0,68,68,32,32;
}
}
if(this.py<this.mousey)
{
this.py++;
if(this.px<this.mousex)
{
showimg 0,dr-divine_light_attack.png,this.px,this.py;
changeimgpart 0,68,68,32,32;
}
if(this.px>this.mousex)
{
showimg 0,dr-divine_light_attack.png,this.px,this.py;
changeimgpart 0,0,0,32,32;
}
}
if(this.py>this.mousey)
{
this.py--;
if(this.px<this.mousex)
{
showimg 0,dr-divine_light_attack.png,this.px,this.py;
changeimgpart 0,68,68,32,32;
}
if(this.px>this.mousex)
{
showimg 0,dr-divine_light_attack.png,this.px,this.py;
changeimgpart 0,0,0,32,32;
}
}
sleep .05;
}
enabledefmovement;
triggeraction 0,0,serverside,Divine Light,exp_gaining;
triggeraction 0,0,serverside,Divine Light,mp;
hideimg 300;
hideimg 0;
this.inuse=0;
}

Reply With Quote
  #12  
Old 03-01-2006, 01:16 AM
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
Now another problem you have is that you're now trying to set your mouse coordinates with:
mousex=this.mousex;
mousey=this.mousey;
which is not possible.
__________________
Reply With Quote
  #13  
Old 03-01-2006, 04:01 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
wow brain fart.
Anyway, the images dont work though, they're messed up, and don't point in the right directions
Reply With Quote
  #14  
Old 03-01-2006, 12:34 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
Then there's something wrong with the execution of this script. I suggest you run through this script once by hand and see where it isn't doing what you want it to do.
__________________
Reply With Quote
  #15  
Old 03-02-2006, 12:45 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
fixed the above, here's the next problem. They don't always point in the right direction
(for the changeimgpart: 24,0 is up 34,68 is down 0,34 is left 68,34 is right)
NPC Code:
if(this.px>this.mousex-2 && this.px<this.mousex+4 && this.py>this.mousey)
{
changeimgpart 0,34,0,32,32;
}
if(this.px>this.mousex-2 && this.px<this.mousex+4 && this.py<this.mousey)
{
changeimgpart 0,34,68,32,32;
}
if(this.py>this.mousey-1 && this.py<this.mousey+3 && this.px<this.mousex)
{
changeimgpart 0,68,34,32,32;
}
if(this.py>this.mousey-1 && this.py<this.mousey+3 && this.px>this.mousex)
{
changeimgpart 0,0,34,32,32;
}

Reply With Quote
  #16  
Old 03-02-2006, 04:56 PM
Bl0nkt Bl0nkt is offline
Era Developer
Bl0nkt's Avatar
Join Date: Mar 2005
Location: Pennsylvania
Posts: 1,589
Bl0nkt will become famous soon enough
Send a message via AIM to Bl0nkt
You should learn GS2.

It's not as hard as you may think.
Reply With Quote
  #17  
Old 03-02-2006, 05:26 AM
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
I'm getting tired of this. We're not here to create/fix your npc for you. Use some logic.
__________________
Reply With Quote
  #18  
Old 03-02-2006, 04:38 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
Quote:
Originally Posted by ZeLpH_MyStiK
I'm getting tired of this. We're not here to create/fix your npc for you. Use some logic.
Oh well, thanks anyway. I know I can find the problem, i was just hoping another pair of eyes would help me do it quicker.
Reply With Quote
  #19  
Old 03-02-2006, 07:55 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by excaliber7388
Oh well, thanks anyway. I know I can find the problem, i was just hoping another pair of eyes would help me do it quicker.
Then hire some scripters on your server. You have been making a lot of these post, and it is getting really annoying <_<
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #20  
Old 03-02-2006, 09:49 PM
Andy0687 Andy0687 is offline
Enigma
Join Date: Feb 2002
Posts: 1,072
Andy0687 is on a distinguished road
It is no wonder we have no other proficient scripters here

everyone just huddles into their own little world and stays there -.-
Reply With Quote
  #21  
Old 03-03-2006, 04:43 AM
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 Andy0687
It is no wonder we have no other proficient scripters here

everyone just huddles into their own little world and stays there -.-
And it is no wonder everyone just huddles into their own little world and stays there. -.-
__________________
Reply With Quote
  #22  
Old 03-03-2006, 02:40 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Andy0687
It is no wonder we have no other proficient scripters here

everyone just huddles into their own little world and stays there -.-
Perhaps you should take a look at all the posts made by Excaliber before you go rhyming off blatant accusations. Maybe then, will you see just how much me trys before he posts about a problem.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #23  
Old 03-04-2006, 05:44 AM
Andy0687 Andy0687 is offline
Enigma
Join Date: Feb 2002
Posts: 1,072
Andy0687 is on a distinguished road
Quote:
Originally Posted by ApothiX
Perhaps you should take a look at all the posts made by Excaliber before you go rhyming off blatant accusations. Maybe then, will you see just how much me trys before he posts about a problem.
Sorry maybe i was not thinking right when i made my prior post, I cant seem to remember exactily what i was reading/thinking at the time.

I have watched him post a few times about problems, and i re-read this thread and saw how he is posting here.

I guess if you dont help someone they wont ever get better.

I apologize if i came off a bit wrong (which i guess i did).
Reply With Quote
  #24  
Old 03-04-2006, 09:47 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
Quote:
Originally Posted by ApothiX
Perhaps you should take a look at all the posts made by Excaliber before you go rhyming off blatant accusations. Maybe then, will you see just how much me trys before he posts about a problem.
actually, I was working on this for a few hours before posting, and I fixed it without help I ask because I'm using this on my server, and need it done quickly, as I have 1,000 other things to do as well.
Reply With Quote
  #25  
Old 03-05-2006, 01:23 AM
projectigi projectigi is offline
Registered User
Join Date: Jan 2004
Posts: 403
projectigi is an unknown quantity at this point
god
many people said this now
GET SCRIPTERS
they will help you to quickly get your scripts online
__________________
Reply With Quote
  #26  
Old 03-05-2006, 04:51 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
Quote:
Originally Posted by projectigi
god
many people said this now
GET SCRIPTERS
they will help you to quickly get your scripts online
Oh! For my next trick, I pull a scripter out from my hat!! =|
Reply With Quote
  #27  
Old 03-11-2006, 02:06 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
We are working on better documentation and script examples, also working systems you can use for new servers. That should probably help with setting up an interesting invironment?
Reply With Quote
  #28  
Old 03-11-2006, 03:01 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Stefan
We are working on better documentation and script examples, also working systems you can use for new servers. That should probably help with setting up an interesting invironment?
Hmm, documentation and examples maybe, but working systems I think would just make people more lazy than they already are
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
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 04:11 PM.


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