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 06-19-2012, 12:49 AM
E_Man E_Man is offline
E-Man
E_Man's Avatar
Join Date: Jun 2012
Posts: 81
E_Man will become famous soon enough
Can you give me an example line that uses "shoot because that is kind of confusing. I mainly don't get the variables of : z, angle, zangle, and ganiparams. Also I still don't know how to use setshootparams or how to call it, and setshootparams is to do damage, right?
Reply With Quote
  #2  
Old 06-19-2012, 01:27 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 E_Man View Post
Can you give me an example line that uses "shoot because that is kind of confusing. I mainly don't get the variables of : z, angle, zangle, and ganiparams. Also I still don't know how to use setshootparams or how to call it, and setshootparams is to do damage, right?
GS2 example of the shoot command:

Quote:
Originally Posted by cbk1994 View Post
PHP Code:
temp.player.+ (vecx(player.dir) * 1.5);
temp.player.+ (vecy(player.dir) * 2);
temp.0;

temp.angle = (player.dir 1) * (pi 2);
temp.zangle 0;
temp.power 0;

temp.ani "sword";
temp.aniParam "";
shoot(xyzanglezanglepoweranianiParam); 
Remove the parentheses and a couple other GS2 bits and you're good to go.
__________________
Reply With Quote
  #3  
Old 06-19-2012, 03:02 AM
E_Man E_Man is offline
E-Man
E_Man's Avatar
Join Date: Jun 2012
Posts: 81
E_Man will become famous soon enough
Quote:
Originally Posted by cbk1994 View Post
GS2 example of the shoot command:
I can't use gs2 scripts since I'm trial, but I may be able to figure out how to use the general variables in this command with gs1 with your script. But what is pi, it's in both gs1 and gs2 scripts, is that 3.14 or does it mean something else?
Reply With Quote
  #4  
Old 06-19-2012, 03:36 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 E_Man View Post
But what is pi, it's in both gs1 and gs2 scripts, is that 3.14 or does it mean something else?
Programming languages typically work in radians instead of degrees. There's 2pi radians in a circle.



Notice how the radians on the circle (they have pi attached) compare to the degrees.

So to get the angle bullets should fly at, we can do..
PHP Code:
(player.dir 1) * (pi 2
Let's say I'm facing left, which means my dir is 1.



So we can start filling in values for that expression

PHP Code:
(1) * (pi 2
simplifies to..

PHP Code:
* (pi 2
which simplifies using basic math to simply pi. If we look on that circle, we can see where the angle pi lies.



This is where our bullets will fly. Try the same thing for any direction and you'll find the angle matches up to the direction the player is facing.
__________________
Reply With Quote
  #5  
Old 06-19-2012, 06:44 PM
E_Man E_Man is offline
E-Man
E_Man's Avatar
Join Date: Jun 2012
Posts: 81
E_Man will become famous soon enough
Quote:
Originally Posted by cbk1994 View Post
Programming languages typically work in radians instead of degrees. There's 2pi radians in a circle.



Notice how the radians on the circle (they have pi attached) compare to the degrees.

So to get the angle bullets should fly at, we can do..
PHP Code:
(player.dir 1) * (pi 2
Let's say I'm facing left, which means my dir is 1.



So we can start filling in values for that expression

PHP Code:
(1) * (pi 2
simplifies to..

PHP Code:
* (pi 2
which simplifies using basic math to simply pi. If we look on that circle, we can see where the angle pi lies.



This is where our bullets will fly. Try the same thing for any direction and you'll find the angle matches up to the direction the player is facing.
Ok, I kind of get it, so if looking up, it's 1,pi/2? Also, I still need help with the damage too.
Reply With Quote
  #6  
Old 06-19-2012, 07:11 PM
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 E_Man View Post
Ok, I kind of get it, so if looking up, it's 1,pi/2? Also, I still need help with the damage too.
Up would be pi / 2, yes.

I wouldn't know the best way to handle damage in GS1; assuming you can't use GS2 because you're a trial and have no access to Testbed, have you tried using SuperRewards to get enough gelats for a month of gold? It might take some time, but you can usually squeeze 300 gelats out of it without too much trouble.

I really hate to see someone learning such an old and horrible language (GS1) just because they're a trial.
__________________
Reply With Quote
  #7  
Old 06-19-2012, 07:47 PM
E_Man E_Man is offline
E-Man
E_Man's Avatar
Join Date: Jun 2012
Posts: 81
E_Man will become famous soon enough
Quote:
Originally Posted by cbk1994 View Post
I wouldn't know the best way to handle damage in GS1; assuming you can't use GS2 because you're a trial and have no access to Testbed, have you tried using SuperRewards to get enough gelats for a month of gold? It might take some time, but you can usually squeeze 300 gelats out of it without too much trouble.

I really hate to see someone learning such an old and horrible language (GS1) just because they're a trial.
I already used most of the easy super rewards to get gold once, and I'm uncomfortable with the other things like surveys, but even if I did get gold and go on testbed, I could only do it for a month and then I would be trial again, I wish I could still be a classic account.
Reply With Quote
  #8  
Old 06-19-2012, 11:42 PM
E_Man E_Man is offline
E-Man
E_Man's Avatar
Join Date: Jun 2012
Posts: 81
E_Man will become famous soon enough
Quote:
Programming languages typically work in radians instead of degrees. There's 2pi radians in a circle.



Notice how the radians on the circle (they have pi attached) compare to the degrees.

So to get the angle bullets should fly at, we can do..
PHP Code:
(player.dir + 1) * (pi / 2)
Let's say I'm facing left, which means my dir is 1.



So we can start filling in values for that expression

PHP Code:
(1 + 1) * (pi / 2)
simplifies to..

PHP Code:
2 * (pi / 2)
which simplifies using basic math to simply pi. If we look on that circle, we can see where the angle pi lies.



This is where our bullets will fly. Try the same thing for any direction and you'll find the angle matches up to the direction the player is facing.

Ok, now I completely understand this. Thank you for sending this. I was even able to fix your shorted script that you said earlier

Quote:
Shoot inherits basic gani properties. In this case you can just set the graphics in the gani for each direction and they will be set automatically when fired. You can also simplify the script like so:

PHP Code:
if (weaponfired) {
freezeplayer 0.6;
setani shoot,woodenbow1.png;
sleep 0.2;
shoot playerx-0.8,playery+0.5,2,pi/2*playerdir,0,0,eman_woodenarrow,;
}
You just needed to do this
PHP Code:
if (weaponfired) {
  
freezeplayer 0.6;
  
setani shoot,woodenbow1.png;
  
sleep 0.2;
  
shoot playerx-0.8,playery+0.5,2,pi/2*(playerdir+1),0,0,eman_woodenarrow,;

As you can see, I jst slightly changed the pi/2*playerdir to pi/2*(playerdir+1) because it was shooting 90 degrees more than it should have. But I don't think this script could work shortened because when you try shooting in different directions, the bow gani changes where the bow is coming from so you can't do playery+# and playerx+# because it changes. But just so no one forgets, I will just mention that I still need to figure out how to damage baddy npcs.
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 01:38 PM.


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