Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Rotaion? (https://forums.graalonline.com/forums/showthread.php?t=72979)

theHAWKER 03-21-2007 09:16 PM

Rotaion?
 
how do u rotat things?
i tryed this:
PHP Code:

//#CLIENTSIDE
if (created) {
this.rotate =59;


then i tryed to make it random:
PHP Code:

//#CLIENTSIDE
if (created) {
this.rotate random(0,360);


but non of them work >_<

godofwarares 03-21-2007 09:30 PM

Good question, Lol.

I don't think it works in Gs1, Only in Gs2 I think . . .

DustyPorViva 03-21-2007 09:35 PM

Ya, GS2 only... and I believe it's in radians, not degrees.
pi*2=360 degrees

Skyld 03-21-2007 09:38 PM

You can easier get radians from degrees using the degtorad(int deg) command.

contiga 03-21-2007 09:55 PM

That doesnt answer the question tho.

To rotate like an image do:
PHP Code:

//#CLIENTSIDE
function onCreated() {
  
with findImg200)) {
    
image "block.png";
    
thiso.x;
    
thiso.y;
    
rotation degtoraddegrees);
    
layer 4;
  }


(replace degrees with a number)

killerogue 03-21-2007 10:55 PM

Quote:

Originally Posted by theHAWKER (Post 1291424)
how do u rotat things?
i tryed this:
PHP Code:

//#CLIENTSIDE
if (created) {
this.rotate =59;


then i tryed to make it random:
PHP Code:

//#CLIENTSIDE
if (created) {
this.rotate random(0,360);


but non of them work >_<

1st. Script

Well, this.rotate in GS1 or GS2 is only a variable holder an not any kind of parameter, or event.

(I forget the proper name.)

2nd. Script

How would random change anything? >_>

DustyPorViva 03-21-2007 11:01 PM

Quote:

Originally Posted by killerogue (Post 1291479)
2nd. Script

How would random change anything? >_>

He wanted to get a random angle for the rotation.

killerogue 03-21-2007 11:21 PM

Quote:

Originally Posted by DustyPorViva (Post 1291483)
He wanted to get a random angle for the rotation.

I meant as far as it working or not.

theHAWKER 03-22-2007 02:44 AM

Quote:

Originally Posted by killerogue (Post 1291488)
I meant as far as it working or not.

i was just trying somthing difrent :(

And thankyou contiga :D

godofwarares 03-22-2007 02:47 AM

Yeah, 'this.rotate' is just a variable and won't affect the NPC much.

theHAWKER 03-22-2007 03:08 AM

w8 a sec that script dosn't work x.x

Inverness 03-22-2007 05:00 AM

Your grammar makes me nauseous.

xXziroXx 03-22-2007 10:59 AM

PHP Code:

//#CLIENTSIDE
function onCreated()
{
  
with (findImg(200)) {
    
player.xplayer.y;
    
image "block.png";
    
rotation += .1;
  }


This will make a block spin to the left over, and over, and OVER AGAIN! I think you got the brains enough to make it spin to the right!

Admins 03-24-2007 04:02 PM

rotation = random(0, 2*pi) should work

theHAWKER 03-29-2007 02:01 AM

ok thanks guys :D

zokemon 03-29-2007 08:30 AM

Yeah, I know TServerPlayer's have the rotation variable...I think TServerNPC's do aswell.

So a "this.rotation = float;" should suffice.


All times are GMT +2. The time now is 03:27 PM.

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