PDA

View Full Version : weapon not working


excaliber7388
02-26-2006, 10:21 PM
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.
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
}

ZeLpH_MyStiK
02-26-2006, 11:16 PM
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.

excaliber7388
02-27-2006, 12:40 AM
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

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;
}
}
}

ZeLpH_MyStiK
02-27-2006, 12:35 PM
Read my post -.-
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.

excaliber7388
02-27-2006, 10:24 PM
got it, but now i have a new problem: this part doesn't work
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;
}

ZeLpH_MyStiK
02-28-2006, 03:38 AM
We do not know what those variables are, please clarify.

ApothiX
02-28-2006, 06:25 AM
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.

excaliber7388
02-28-2006, 03:26 PM
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

Damix2
02-28-2006, 09:37 PM
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.

excaliber7388
02-28-2006, 11:12 PM
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?

excaliber7388
02-28-2006, 11:50 PM
Here's the entire block this is working from
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;
}

ZeLpH_MyStiK
03-01-2006, 01:16 AM
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.

excaliber7388
03-01-2006, 04:01 AM
wow brain fart.
Anyway, the images dont work though, they're messed up, and don't point in the right directions

ZeLpH_MyStiK
03-01-2006, 12:34 PM
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.

excaliber7388
03-02-2006, 12:45 AM
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)
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;
}

ZeLpH_MyStiK
03-02-2006, 05:26 AM
I'm getting tired of this. We're not here to create/fix your npc for you. Use some logic.

excaliber7388
03-02-2006, 04:38 PM
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.

Bl0nkt
03-02-2006, 04:56 PM
You should learn GS2.

It's not as hard as you may think.

ApothiX
03-02-2006, 07:55 PM
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 <_<

Andy0687
03-02-2006, 09:49 PM
It is no wonder we have no other proficient scripters here

everyone just huddles into their own little world and stays there -.-

ZeLpH_MyStiK
03-03-2006, 04:43 AM
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. -.-

ApothiX
03-03-2006, 02:40 PM
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.

Andy0687
03-04-2006, 05:44 AM
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).

excaliber7388
03-04-2006, 09:47 PM
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.

projectigi
03-05-2006, 01:23 AM
god
many people said this now
GET SCRIPTERS
they will help you to quickly get your scripts online

excaliber7388
03-05-2006, 04:51 AM
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!! =|

Prozac
03-05-2006, 06:03 AM
Oh! For my next trick, I pull a scripter out from my hat!! =|
exactly. get scripters from where?

As stated above, and from my own experience, and the repeated experience of many others of I have talked to : people with any kind of development talent (or even a complete lack of talent) go and buy a playerworld and either do nothing with it, or the sit and develop it.

And when those who do not have as much skill as they thought they had realise that they need help, they post and mass pm and try their darndest to recruit staff, but 99 times out of 100 the people with any skill worth showing in puclic already works on another server, or own their own server, so even if you hire them, they may only make a couple, if any, npcs (same goes for lat's and levels, or gani or graphic artists) before becoming inactive and leaving you to make your still-in-the-works server by yourself.

On one occasion, someone offered to pay me money to make an npc for them - literally hiring me to make something for their server. I emailed them a working first draft of the script, and then never got paid ... but it was only for a few bucks anyways.

The average playerworld owner pays enough (some would say too much) out of their own pocket, and spending more money to literally hire people and have to pay them by level or by npc produced is like having each server be its own little company, since buying people's skills in this way, to make a graal playerworld, is just about the only way to make sure you have quality people on your team.

But who would invest that kind of money where the line is crossed - that your playerworld becomes your business, right away you want a monetary return on your invenstment. I have heard zero positive feedback from anyone on the referral program - getting money for people buying accounts through your affiliate link - so basically the playerworld becomes a black hole sucking in your time and money for some fun - but not as much fun as it would be if people would help you out just for the fun of it - which, for the above reasons, has become increasingly rare these days.

Old days : limited hosted public playerworlds (sanstrata, dino valley, elven lands etc) + paying customers seeing a few working features = people practically begging to help out

Now : the people who helped out and learned a few things but not enough to run their own server + ability to rent out a server slot and post pretty much whatever you want on there = everyone who has any talent and ability to help you, won't help you, because they want their precious levels and npcs to be on just their server, and they spend what free time they have on their server ..

.. and that = a lot of playerworlds that are average at best, or very good levels but average npcs, or very good npcs or average levels, or in the dozen or less elite group of ultra gifted individuals, a very small amount of good playerworlds ... an inverse bell curve, if you will.

one solution to easing frustration off of paying customers: have graal pay the global scripting team money to go and actually help servers at various stages of development, teaching people to script. Leveling is easier, but still just as if not more time consuming.

this is just part of how graal player culture has gone downhill .. also getting a corporate sponsor may help the game too. gametap maybe?

ZeLpH_MyStiK
03-05-2006, 07:09 PM
...
That's the player's own fault if he/she just buys a server without planning ahead. Buying a server is an investment, thus you should at least think about how you're going to develop the server before typing in your credit card number.

Admins
03-11-2006, 02:06 AM
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?

ApothiX
03-11-2006, 03:01 AM
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 x_x