Graalians

Graalians (https://www.graalians.com/forums/index.php)
-   Creative Corner (https://www.graalians.com/forums/forumdisplay.php?f=17)
-   -   John's Scripts (https://www.graalians.com/forums/showthread.php?t=9528)

Johnaudi 09-30-2012 12:59 PM

Okay, any other way I can change the zoom axis? That's how I want it but its not as smooth as I need it to be (when it's further from the player it gets bigger)

callimuc 09-30-2012 01:03 PM

Quote:

Posted by Johnaudi (Post 206439)
Okay, any other way I can change the zoom axis? That's how I want it but its not as smooth as I need it to be (when it's further from the player it gets bigger)

PHP Code:

function onTimeOut() {
  
temp.dist_x player.findimg(200).x;
  
temp.dist_y player.findimg(200).y;
  
temp.len = (this.dist_x this.dist_x this.dist_y this.dist_y) ^ 0.5;
  
findImg(200).zoom = (temp.len>temp.len 1);



Johnaudi 09-30-2012 04:50 PM

ty, i got a problem over here, that the "spin" isnt showing other players (other players see it as not spinning)
any way?

Tricxta 09-30-2012 11:28 PM

Quote:

Posted by callimuc (Post 206443)
PHP Code:

function onTimeOut() {
  
temp.dist_x player.findimg(200).x;
  
temp.dist_y player.findimg(200).y;
  
temp.len = (this.dist_x this.dist_x this.dist_y this.dist_y) ^ 0.5;
  
findImg(200).zoom = (temp.len>temp.len 1);



Looks like you copied this from a bad script example.
Why not just do
PHP Code:

temp.len = (this.dist_x^this.dist_y^2)^0.5

I think it also helps to know where these formulas come from... so just so people know
it's Pythagoras' theorem:a^2+b^2 = c^2 which re-arranges to c = sqrt(a^2+b^2)

and you can find the square root of something without the square root function by using powers which is 0.5
so it's c = (a^2+b^2)^0.5

Only reason i'm saying all this is because I beleive anyone who's striving to be a decent programmer should have a fair bit of base maths knowledge.

callimuc 10-01-2012 10:36 PM

Quote:

Posted by Tricxta (Post 206661)
Looks like you copied this from a bad script example.
Why not just do
PHP Code:

temp.len = (this.dist_x^this.dist_y^2)^0.5

I think it also helps to know where these formulas come from... so just so people know
it's Pythagoras' theorem:a^2+b^2 = c^2 which re-arranges to c = sqrt(a^2+b^2)

and you can find the square root of something without the square root function by using powers which is 0.5
so it's c = (a^2+b^2)^0.5

Only reason i'm saying all this is because I beleive anyone who's striving to be a decent programmer should have a fair bit of base maths knowledge.

oh yea, you are right. been too lazy to think of the formula so i took it from an old script i didnt work on for ages ^^ (but i am familiar with that formula and also understand it, so i didnt copy it without even having knowledge about that)
im pretty familiar with such stuff but im always too lazy to either realize that or fix it into another, nicer looking way. but thats a personal problem of mine, just like i dont realize binomial series that fast and keep calculating them the "normal" way and getting stuck. but during the last year i somewhat improved on that (on realizing such mathematical stuff)

also you are right that people wanting to program should get familiar with that at some time, as it could get annoying for them to keep looking up every formula they will need at some time.

Johnaudi 10-03-2012 05:56 PM

Thanks again guys,
alright so most-likely I was trying to build a movements System. But thus so far all I could do was making the player go at a certain speed using player.x += 0.7; something around this by using keyboard.
but it's still coming thru the walls, I don't want to make it for every level as in
PHP Code:

if (player.x in |20,40|) ... 

is there a way to make a better and cleaner system?

callimuc 10-03-2012 07:39 PM

Quote:

Posted by Johnaudi (Post 208029)
Thanks again guys,
alright so most-likely I was trying to build a movements System. But thus so far all I could do was making the player go at a certain speed using player.x += 0.7; something around this by using keyboard.
but it's still coming thru the walls, I don't want to make it for every level as in
PHP Code:

if (player.x in |20,40|) ... 

is there a way to make a better and cleaner system?

i dont really get what you need. do you need a wallcheck? if so, you can use
PHP Code:

if (onWall(xy)) 

you can also check the following link for a barebone movement system
http://forums.graalonline.com/forums...ad.php?t=78043

Tricxta 10-03-2012 09:57 PM

I also place alot of emphasis on people making use of vecx and vecy, without them you'll have duplicated code and I wont be happy, so make me happy and use them. kthx

callimuc 10-03-2012 11:17 PM

An example for using vecx() and vecy():
http://forums.graalonline.com/forums...hp?t=134263215

Striker 10-06-2012 09:40 AM

i don't under stand a single thing that's why i asked snk for help to learn how to script -_-

Tricxta 10-06-2012 09:51 AM

Quote:

Posted by Striker (Post 209366)
i don't under stand a single thing that's why i asked snk for help to learn how to script -_-

But snk can't teach everyone and develop era as well! :o

Johnaudi 10-06-2012 02:28 PM

alright, last thing of the day, how to set a custom projectile? Not guns projectile. I want something for example, when we shoot it will follow the mouse x and y starting from the player.
I did try using for(a = a + 1) for every dir but it goes in angles, which made me laugh lol.

callimuc 10-06-2012 03:24 PM

Quote:

Posted by Johnaudi (Post 209431)
alright, last thing of the day, how to set a custom projectile? Not guns projectile. I want something for example, when we shoot it will follow the mouse x and y starting from the player.
I did try using for(a = a + 1) for every dir but it goes in angles, which made me laugh lol.

it can also be done with the default projectile system
PHP Code:

temp.angle getangle(player.mousexplayer.mousey);
//angle is being set so the projectile will shoot to the mouse 

anyway, here is a scripted projectile system
http://forums.graalonline.com/forums...hp?t=134259144

Johnaudi 10-07-2012 06:41 AM

I'd not really like to Copy & Paste, more into understanding them.
Well thanks again anyways, but onAddDamage must have (@ "WeaponName").onAddDamage() as a public function, it's pretty annoying, how can I remove the weapon name thingy?

callimuc 10-07-2012 05:42 PM

in the actual weapon (WeaponName) you can do something like:


PHP Code:

//#CLIENTSIDE
function onCreated() {
  
PHEALTH this;
}

public function 
onDoGreeting() {
  
player.chat "hi";


and than in your other script:
PHP Code:

//#CLIENTSIDE
function onCreated() {
  
PHEALTH.onDoGreeting();



ps: sorry that i couldnt get on your server again, internet is acting weird. will come back later


All times are GMT. The time now is 01:23 PM.

Powered by vBulletin/Copyright ©2000 - 2025, vBulletin Solutions Inc.