Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-13-2008, 07:11 PM
Knightmare1 Knightmare1 is offline
Billy Allan
Knightmare1's Avatar
Join Date: Apr 2007
Posts: 804
Knightmare1 can only hope to improve
Rotating?

how do you rotate an image instead of having it 4 directions? for example, a car. is it like:
PHP Code:
if ( keydown) )
{
  
this.angle += .2;

and how do you make it move in the direction by pressing up?
__________________
I am the devil, I am here to do to devils work.
Reply With Quote
  #2  
Old 01-13-2008, 07:31 PM
Rapidwolve24 Rapidwolve24 is offline
North*
Join Date: Oct 2007
Location: Massachusetts
Posts: 178
Rapidwolve24 is on a distinguished road
Send a message via AIM to Rapidwolve24 Send a message via MSN to Rapidwolve24
Here are some snippets from one of my car scripts.

To move in direction of angle:
PHP Code:
temp.newx player.+ (this.graalspeed cos(this.angle));
temp.newy player.+ (this.graalspeed * -sin(this.angle)); 
To accelerate:
PHP Code:
function Accelerate()
{
  
this.smod 0;
  
this.speed += (this.speed this.maxspeed) ? 0.20 0;

Turns:
PHP Code:
function LeftTurn()
{
  
this.angle += degtorad(this.turnpower);
    
  if (
radtodeg(this.angle)+this.turnpower <= 0)
  {
    
this.angle degtorad(360);
  } 
  
    if (
radtodeg(this.angle)+this.turnpower >= 360)
  {
    
this.angle degtorad(0);
  }
  
}

function 
RightTurn()
{
  
this.angle -= degtorad(this.turnpower);
  
  if (
radtodeg(this.angle)+this.turnpower >= 360)
  {
    
this.angle degtorad(359);
  } 
  
  if (
radtodeg(this.angle)+this.turnpower <= 0)
  {
    
this.angle degtorad(360);
  }
    

Reply With Quote
  #3  
Old 01-13-2008, 08:14 PM
Knightmare1 Knightmare1 is offline
Billy Allan
Knightmare1's Avatar
Join Date: Apr 2007
Posts: 804
Knightmare1 can only hope to improve
well, ork made a car script that doesnt work, but it rotates the car. why wont it work?
PHP Code:
//#CLIENTSIDE
function onCreated() enabledefmovement();
function 
onPlayerChats()
{
  if (
player.chat == "/car")
  {
    
onCreated();
    
this.car = !this.car;
    if (
this.caronTimeOut();
    if (!
this.carsetTimer);
  }
}
function 
onTimeOut()
{
  
disabledefmovement();
  
showimg1"ut_car-upd_up.gif"player.xplayer.);
  
findimg).rotation this.ang;
  if ( 
keydown) )
  {
    
this.ang -= .1;
  }
  if ( 
keydown) )
  {
    
this.ang += .1;
  }
  if ( 
keydown) )
  {
    
player.-= costhis.ang ) * 1;
    
player.-= sinthis.ang ) * 1
  }
  
setTimer0.05 );

it shows the car, the car rotates, but it still goes the direction that your holding. (and it shows the charecter)
__________________
I am the devil, I am here to do to devils work.
Reply With Quote
  #4  
Old 01-13-2008, 09:00 PM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
I would normally set the player's gani and just send parameters to the gani to control the angle of the car (using a gani script). This effectively hides the players and makes sure that all other players can see the rotation of the car.

From my initial inspection, the only thing I can see that would be causing a movement issue is that you should do:
PHP Code:
player.-= cos(this.ang) * 1
When I have more time, I'll take a further look at it. But, play around with it more and let us know if you have any success .
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.

Last edited by napo_p2p; 01-13-2008 at 11:16 PM.. Reason: Sign error :P
Reply With Quote
  #5  
Old 01-13-2008, 09:37 PM
Jeffyy Jeffyy is offline
Graphics Artist
Jeffyy's Avatar
Join Date: Dec 2007
Location: USA, NJ
Posts: 82
Jeffyy is an unknown quantity at this point
PHP Code:
//#CLIENTSIDE
function onCreated() enabledefmovement();
function 
onPlayerChats()
{
  if (
player.chat == "/car")
  {
    
onCreated();
    
this.car = !this.car;
    if (
this.caronTimeOut();
    if (!
this.carsetTimer.5 );
  }
}
function 
onTimeOut()
{
  
disabledefmovement();
  
showimg1"<image name>"player.xplayer.);
  
findimg).rotation this.ang
    if ( 
keydown) )
  {
    
this.ang -= .1;
    
timeout;
  }
  if ( 
keydown) )
  {
    
this.ang += .1;
    
timeout;
  }
  if ( 
keydown0) )
  {
    
player.-= costhis.ang ) * 1;
    
player.+= sinthis.ang ) * 1
  }
  
setTimer0.05 );

  
temp.newx player.+ (this.graalspeed cos(this.angle));
  
temp.newy player.+ (this.graalspeed * -sin(this.angle));

function 
Accelerate()
{
  
this.smod 0;
  
this.speed += (this.speed this.maxspeed) ? .20 1;


function 
LeftTurn()
{
  
this.angle += degtorad(this.turnpower);
  
timeout;
    
  if (
radtodeg(this.angle)+this.turnpower <= 0)
  {
    
this.angle degtorad(360);
  } 
  
    if (
radtodeg(this.angle)+this.turnpower >= 360)
  {
    
this.angle degtorad(0);
  }
  
}

function 
RightTurn()
{
  
this.angle -= degtorad(this.turnpower);
  
  if (
radtodeg(this.angle)+this.turnpower >= 360)
  {
    
this.angle degtorad(359);
  } 
  
  if (
radtodeg(this.angle)+this.turnpower <= 0)
  {
    
this.angle degtorad(360);
  }
  } 
Fixed it up and tried it, Works great. Have fun :]

Last edited by Jeffyy; 01-13-2008 at 09:40 PM.. Reason: Almost forgot, Make sure the car image is facing left.
Reply With Quote
  #6  
Old 01-13-2008, 09:42 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
PHP Code:
player.+= cos(this.ang);
player.-= sin(this.ang); 
:O
and this.ang should be between 0 and pi*2
(if you're not into trig you can just use degtorad() to convert radians to degrees (for example: degtorad(360); degtorad(145); etc.) )
__________________
Reply With Quote
  #7  
Old 01-13-2008, 09:42 PM
Knightmare1 Knightmare1 is offline
Billy Allan
Knightmare1's Avatar
Join Date: Apr 2007
Posts: 804
Knightmare1 can only hope to improve
Quote:
Originally Posted by Jeffyy View Post
PHP Code:
//#CLIENTSIDE
function onCreated() enabledefmovement();
function 
onPlayerChats()
{
  if (
player.chat == "/car")
  {
    
onCreated();
    
this.car = !this.car;
    if (
this.caronTimeOut();
    if (!
this.carsetTimer.5 );
  }
}
function 
onTimeOut()
{
  
disabledefmovement();
  
showimg1"<image name>"player.xplayer.);
  
findimg).rotation this.ang
    if ( 
keydown) )
  {
    
this.ang -= .1;
    
timeout;
  }
  if ( 
keydown) )
  {
    
this.ang += .1;
    
timeout;
  }
  if ( 
keydown0) )
  {
    
player.-= costhis.ang ) * 1;
    
player.+= sinthis.ang ) * 1
  }
  
setTimer0.05 );

  
temp.newx player.+ (this.graalspeed cos(this.angle));
  
temp.newy player.+ (this.graalspeed * -sin(this.angle));

function 
Accelerate()
{
  
this.smod 0;
  
this.speed += (this.speed this.maxspeed) ? .20 1;


function 
LeftTurn()
{
  
this.angle += degtorad(this.turnpower);
  
timeout;
    
  if (
radtodeg(this.angle)+this.turnpower <= 0)
  {
    
this.angle degtorad(360);
  } 
  
    if (
radtodeg(this.angle)+this.turnpower >= 360)
  {
    
this.angle degtorad(0);
  }
  
}

function 
RightTurn()
{
  
this.angle -= degtorad(this.turnpower);
  
  if (
radtodeg(this.angle)+this.turnpower >= 360)
  {
    
this.angle degtorad(359);
  } 
  
  if (
radtodeg(this.angle)+this.turnpower <= 0)
  {
    
this.angle degtorad(360);
  }
  } 
Fixed it up and tried it, Works great. Have fun :]
it still doesnt work for me. i can make it go, but it still shows me walking in the direction and it is slow unless your going the up direction.
__________________
I am the devil, I am here to do to devils work.

Last edited by Knightmare1; 01-13-2008 at 10:02 PM..
Reply With Quote
  #8  
Old 01-13-2008, 09:44 PM
Jeffyy Jeffyy is offline
Graphics Artist
Jeffyy's Avatar
Join Date: Dec 2007
Location: USA, NJ
Posts: 82
Jeffyy is an unknown quantity at this point
Quote:
Originally Posted by Knightmare1 View Post
it still doesnt work for me.
Did you add the image?
Reply With Quote
  #9  
Old 01-13-2008, 09:47 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Jeffyy View Post
Did you add the image?
Seriously, all you did was copy and pasting Rapid's functions into the post..

If it worked for you, I'll bet if you remove that you pasted it will work, since you didn't edit the original script to use those functions..
__________________
Reply With Quote
  #10  
Old 01-13-2008, 09:50 PM
Jeffyy Jeffyy is offline
Graphics Artist
Jeffyy's Avatar
Join Date: Dec 2007
Location: USA, NJ
Posts: 82
Jeffyy is an unknown quantity at this point
Ya... I did that and changed the buttons so up is go instead of left. I said i fixed it up, I didn't say I made it...
Reply With Quote
  #11  
Old 01-13-2008, 09:51 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Jeffyy View Post
Ya... I did that and changed the buttons so up is go instead of left. I said i fixed it up, I didn't say I made it...
All he needed was to change a little minus to a plus, not some fancy functions ;o
__________________
Reply With Quote
  #12  
Old 01-13-2008, 09:55 PM
Jeffyy Jeffyy is offline
Graphics Artist
Jeffyy's Avatar
Join Date: Dec 2007
Location: USA, NJ
Posts: 82
Jeffyy is an unknown quantity at this point
Quote:
Originally Posted by Jeffyy View Post
PHP Code:
//#CLIENTSIDE
function onCreated() enabledefmovement();
function 
onPlayerChats()
{
  if (
player.chat == "/car")
  {
    
onCreated();
    
this.car = !this.car;
    if (
this.caronTimeOut();
    if (!
this.carsetTimer.5 );
  }
}
function 
onTimeOut()
{
  
disabledefmovement();
  
showimg1"<image name>"player.xplayer.);
  
findimg).rotation this.ang
    if ( 
keydown) )
  {
    
this.ang -= .1;
    
timeout;
  }
  if ( 
keydown) )
  {
    
this.ang += .1;
    
timeout;
  }
  if ( 
keydown0) )
  {
    
player.-= costhis.ang ) * 1;
    
player.+= sinthis.ang ) * 1
  }
  
setTimer0.05 );

  
temp.newx player.+ (this.graalspeed cos(this.angle));
  
temp.newy player.+ (this.graalspeed * -sin(this.angle));

function 
Accelerate()
{
  
this.smod 0;
  
this.speed += (this.speed this.maxspeed) ? .20 1;


function 
LeftTurn()
{
  
this.angle += degtorad(this.turnpower);
  
timeout;
    
  if (
radtodeg(this.angle)+this.turnpower <= 0)
  {
    
this.angle degtorad(360);
  } 
  
    if (
radtodeg(this.angle)+this.turnpower >= 360)
  {
    
this.angle degtorad(0);
  }
  
}

function 
RightTurn()
{
  
this.angle -= degtorad(this.turnpower);
  
  if (
radtodeg(this.angle)+this.turnpower >= 360)
  {
    
this.angle degtorad(359);
  } 
  
  if (
radtodeg(this.angle)+this.turnpower <= 0)
  {
    
this.angle degtorad(360);
  }
  } 
Fixed it up and tried it, Works great. Have fun :]

Can you read... All I said was that "I FIXED IT UP A ABIT." There are no Fancy functions... I don't think.
Reply With Quote
  #13  
Old 01-13-2008, 10:05 PM
Knightmare1 Knightmare1 is offline
Billy Allan
Knightmare1's Avatar
Join Date: Apr 2007
Posts: 804
Knightmare1 can only hope to improve
Quote:
Originally Posted by Jeffyy View Post
Can you read... All I said was that "I FIXED IT UP A ABIT." There are no Fancy functions... I don't think.
you also said it works. did it go slow like when i tried it?
__________________
I am the devil, I am here to do to devils work.
Reply With Quote
  #14  
Old 01-13-2008, 10:08 PM
Jeffyy Jeffyy is offline
Graphics Artist
Jeffyy's Avatar
Join Date: Dec 2007
Location: USA, NJ
Posts: 82
Jeffyy is an unknown quantity at this point
Uhh... You can adjust the script for how fast you want to go, And it does work. Log on Riot.
Reply With Quote
  #15  
Old 01-13-2008, 10:34 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Jeffyy View Post
Can you read... All I said was that "I FIXED IT UP A ABIT." There are no Fancy functions... I don't think.
***** @ inability to see (Yes, Stephen's quote xD)

look at the bottom of your script o_o
__________________
Reply With Quote
  #16  
Old 01-13-2008, 10:36 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Knightmare1 View Post
you also said it works. did it go slow like when i tried it?
it goes slow because of:

PHP Code:
player.-= costhis.ang ) * 1;  // *1 isn't needed..
player.+= sinthis.ang ) * 1;  // *1 isn't needed

// why would you multiply something by 1..? 
try it around, for example

PHP Code:
player.-= costhis.ang ) * 3;
player.+= sinthis.ang ) * 3
or you can replace 3 with a variable for example named this.speed
and change that var based on how fast the car would drive..
__________________
Reply With Quote
  #17  
Old 01-14-2008, 01:06 AM
Knightmare1 Knightmare1 is offline
Billy Allan
Knightmare1's Avatar
Join Date: Apr 2007
Posts: 804
Knightmare1 can only hope to improve
i found the problem. now, how do i make it so a player cant walk?
__________________
I am the devil, I am here to do to devils work.

Last edited by Knightmare1; 01-14-2008 at 01:17 AM..
Reply With Quote
  #18  
Old 01-14-2008, 01:23 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by Knightmare1 View Post
i found the problem. now, how do i make it so a player cant walk?
disabledefmovement(); should normally do it, but I see that it is already in the script.
My guess is that there is a custom movement system that is interfering with the car script. You will probably need to disable that movement system while someone is in a car.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #19  
Old 01-14-2008, 02:51 AM
Knightmare1 Knightmare1 is offline
Billy Allan
Knightmare1's Avatar
Join Date: Apr 2007
Posts: 804
Knightmare1 can only hope to improve
Quote:
Originally Posted by napo_p2p View Post
disabledefmovement(); should normally do it, but I see that it is already in the script.
My guess is that there is a custom movement system that is interfering with the car script. You will probably need to disable that movement system while someone is in a car.
oooooo so remove the weapon? and it can go over walls!
__________________
I am the devil, I am here to do to devils work.
Reply With Quote
  #20  
Old 01-14-2008, 03:58 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by Knightmare1 View Post
oooooo so remove the weapon? and it can go over walls!
For testing, I guess you could remove the weapon. When it goes to players though, you could just have the movement system stop working when a car is on.

That script is able to go over walls because you need to add some onwall detection :P. I think you have the skills to play around with onwall detection yourself. If you hit a snag, you know where to ask .
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #21  
Old 01-14-2008, 04:22 AM
Knightmare1 Knightmare1 is offline
Billy Allan
Knightmare1's Avatar
Join Date: Apr 2007
Posts: 804
Knightmare1 can only hope to improve
Quote:
Originally Posted by napo_p2p View Post
For testing, I guess you could remove the weapon. When it goes to players though, you could just have the movement system stop working when a car is on.

That script is able to go over walls because you need to add some onwall detection :P. I think you have the skills to play around with onwall detection yourself. If you hit a snag, you know where to ask .
i got it to work!!! now i am gonna try to make it slow down... here is the script that works:
PHP Code:
//#CLIENTSIDE
function onCreated() enabledefmovement();
function 
onPlayerChats()
{
  if (
player.chat == "/car")
  {
    
onCreated();
    
this.car = !this.car;
    if (
this.caronTimeOut();
    if (!
this.carsetTimer);
  }
}
function 
onTimeOut()
{
  
disabledefmovement();
  
client.frozen true;
  
showimg1"utopia_car3.gif"player.xplayer.);
  
setani"blank"null );
  
findimg).rotation this.ang
    if ( 
keydown) )
  {
    
this.ang -= .1;
    
timeout;
  }
  if ( 
keydown) )
  {
    
this.ang += .1;
    
timeout;
  }
  if ( 
keydown0) )
  {
    
player.-= costhis.ang ) * 1.2;
    
player.+= sinthis.ang ) * 1.2
  }
  
setTimer0.05 );

  
temp.newx player.+ (this.graalspeed cos(this.angle));
  
temp.newy player.+ (this.graalspeed * -sin(this.angle));

function 
Accelerate()
{
  
this.smod 0;
  
this.speed += (this.speed this.maxspeed) ? .20 1;


function 
LeftTurn()
{
  
this.angle += degtorad(this.turnpower);
  
timeout;
    
  if (
radtodeg(this.angle)+this.turnpower <= 0)
  {
    
this.angle degtorad(360);
  } 
  
    if (
radtodeg(this.angle)+this.turnpower >= 360)
  {
    
this.angle degtorad(0);
  }
  
}

function 
RightTurn()
{
  
this.angle -= degtorad(this.turnpower);
  
  if (
radtodeg(this.angle)+this.turnpower >= 360)
  {
    
this.angle degtorad(359);
  } 
  
  if (
radtodeg(this.angle)+this.turnpower <= 0)
  {
    
this.angle degtorad(360);
  }

__________________
I am the devil, I am here to do to devils work.

Last edited by Knightmare1; 01-14-2008 at 04:56 AM..
Reply With Quote
  #22  
Old 01-14-2008, 10:13 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Knightmare1 View Post
i got it to work!!! now i am gonna try to make it slow down... here is the script that works:
PHP Code:
... 
You didn't read what I wrote to Jeffyy, did you?
__________________
Reply With Quote
  #23  
Old 01-14-2008, 11:52 PM
Knightmare1 Knightmare1 is offline
Billy Allan
Knightmare1's Avatar
Join Date: Apr 2007
Posts: 804
Knightmare1 can only hope to improve
and now a new problem showed up, you can only see yourself rotate on your screen. you cant see anyone else rotate, and no one can see you rotate.
__________________
I am the devil, I am here to do to devils work.
Reply With Quote
  #24  
Old 01-15-2008, 12:06 AM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Doesn't the img index have to be like 200+ ??
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #25  
Old 01-15-2008, 12:21 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Switch View Post
Doesn't the img index have to be like 200+ ??
Naw

(some very low negative number) to -1 are local (client only)
0 to 200 makes it so other players can see it
index 200 ++ up are local (client only)

Quote:
Originally Posted by Knightmare1 View Post
and now a new problem showed up, you can only see yourself rotate on your screen. you cant see anyone else rotate, and no one can see you rotate.
It would be better if you make it a gani tho, or you can use Dusty's player effect function:
http://forums.graalonline.com/forums...ad.php?t=78118

and set client.rotation to wanted rotation number
__________________
Reply With Quote
  #26  
Old 01-15-2008, 01:01 AM
Knightmare1 Knightmare1 is offline
Billy Allan
Knightmare1's Avatar
Join Date: Apr 2007
Posts: 804
Knightmare1 can only hope to improve
Quote:
Originally Posted by Chompy View Post
Naw

(some very low negative number) to -1 are local (client only)
0 to 200 makes it so other players can see it
index 200 ++ up are local (client only)



It would be better if you make it a gani tho, or you can use Dusty's player effect function:
http://forums.graalonline.com/forums...ad.php?t=78118

and set client.rotation to wanted rotation number
client.rotation?
so
PHP Code:
findimg).client.rotation this.ang
PHP Code:
//This is by Nightmare
//if i leave/get fired this must be deleted.
//this belongs to knightmare1 and only him, not Graalonline.
//unless you have my permission, this is only for Nightmare.
//#CLIENTSIDE
function onCreated() 
{
  
client.frozen false;
}
function 
onPlayerChats()
{
  if (
player.chat == "/car")
  {
    
onCreated();
    
this.car = !this.car;
    if (
this.caronTimeOut();
    if (!
this.carsetTimer);
  }
}
function 
onTimeOut()
{
  
client.frozen true
  
showimg1"utopia_car3.gif"player.xplayer.); 
  
setani"blank"null ); 
  
findimg).client.rotation this.ang;
    if ( 
keydown) ) 
  { 
    
this.ang -= .1
    
timeout
  } 
  if ( 
keydown) ) 
  { 
    
this.ang += .1
    
timeout
  } 
  if ( 
keydown0) ) 
  { 
    
player.-= costhis.ang ) * 1.2
    
player.+= sinthis.ang ) * 1.2;  
  } 
  
setTimer0.05 ); 
}  
  
temp.newx player.+ (this.graalspeed cos(this.angle)); 
  
temp.newy player.+ (this.graalspeed * -sin(this.angle)); 

function 
Accelerate() 

  
this.smod 0
  
this.speed += (this.speed this.maxspeed) ? .20 1
}  

function 
LeftTurn() 

  
this.angle += degtorad(this.turnpower); 
  
timeout
     
  if (
radtodeg(this.angle)+this.turnpower <= 0
  { 
    
this.angle degtorad(360); 
  }  
   
    if (
radtodeg(this.angle)+this.turnpower >= 360
  { 
    
this.angle degtorad(0); 
  } 
   


function 
RightTurn() 

  
this.angle -= degtorad(this.turnpower); 
   
  if (
radtodeg(this.angle)+this.turnpower >= 360
  { 
    
this.angle degtorad(359); 
  }  
   
  if (
radtodeg(this.angle)+this.turnpower <= 0
  { 
    
this.angle degtorad(360); 
  } 

__________________
I am the devil, I am here to do to devils work.
Reply With Quote
  #27  
Old 01-15-2008, 01:35 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by Knightmare1 View Post
PHP Code:
//This is by Nightmare
//if i leave/get fired this must be deleted.
//this belongs to knightmare1 and only him, not Graalonline.
//unless you have my permission, this is only for Nightmare. 
lol.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #28  
Old 01-15-2008, 03:53 AM
Knightmare1 Knightmare1 is offline
Billy Allan
Knightmare1's Avatar
Join Date: Apr 2007
Posts: 804
Knightmare1 can only hope to improve
Quote:
Originally Posted by Tigairius View Post
lol.
__________________
I am the devil, I am here to do to devils work.
Reply With Quote
  #29  
Old 01-15-2008, 04:09 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Knightmare1 View Post
client.rotation?
so
PHP Code:
findimg).client.rotation this.ang
PHP Code:
... 
uhm, no

you set client.rotation = this.ang; But then you would need to gani the car tho
__________________
Reply With Quote
  #30  
Old 01-15-2008, 10:17 PM
Knightmare1 Knightmare1 is offline
Billy Allan
Knightmare1's Avatar
Join Date: Apr 2007
Posts: 804
Knightmare1 can only hope to improve
Quote:
Originally Posted by Chompy View Post
uhm, no

you set client.rotation = this.ang; But then you would need to gani the car tho
but would i make the car gani only 1 direction?
__________________
I am the devil, I am here to do to devils work.
Reply With Quote
  #31  
Old 01-15-2008, 11:26 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Knightmare1 View Post
but would i make the car gani only 1 direction?
I haven't seen the image, but it would probably been only the left direction though, if you are going to rotate the player
__________________
Reply With Quote
  #32  
Old 01-18-2008, 05:36 PM
Knightmare1 Knightmare1 is offline
Billy Allan
Knightmare1's Avatar
Join Date: Apr 2007
Posts: 804
Knightmare1 can only hope to improve
there is another car script i found, and it does gani, but it shows the car under you not rotating, but the direction is right. this was by chris.
PHP Code:
//#CLIENTSIDE
function onPlayerChats()
{
  if ( 
player.chat == ":car" )
  {
    
this.car this.car;
    if ( 
this.car )
    {
      
client.frozen true;
      
setTimer0.05 );
    }
    else
    {
      
player.attr[6] = "";
      
client.frozen false;
      
setTimer);
    }
  }
}
function 
onTimeOut()
{
  
client.frozen true;    
  
player.getMoveXthis.accel );
  
player.getMoveYthis.accel );
  if ( 
keydown) )
  {
    
this.carAngle += .2;  
  }
  if ( 
keydown) )
  {
    
this.carAngle -= .2;
  }
  
  
temp.dx getMoveX);
  
temp.dy getMoveY);
  
player.dir getdirtemp.dx player.xtemp.dy player.);
  if ( 
keydown) )
  {
    
this.accel this.accel .1 this.accel .1;
  }
  else
  {
    
this.accel this.accel .1 this.accel this.accel .1;
  }
  
player.getMoveXthis.accel );
  
player.getMoveYthis.accel );
  
client.car_angle this.carAngle;
  
player.attr[5] = this.carAngle;
  
  
setAni"sit""" );
  
player.attr[6] = "ut_car.gani";

  
setTimer0.05 );
}
function 
getMoveXspeed )
{
  return 
player.sinthis.carAngle ) * speed;
}
function 
getMoveYspeed )
{
  return 
player.costhis.carAngle ) * speed;

__________________
I am the devil, I am here to do to devils work.
Reply With Quote
  #33  
Old 01-18-2008, 09:43 PM
Rapidwolve24 Rapidwolve24 is offline
North*
Join Date: Oct 2007
Location: Massachusetts
Posts: 178
Rapidwolve24 is on a distinguished road
Send a message via AIM to Rapidwolve24 Send a message via MSN to Rapidwolve24
Quote:
Originally Posted by Knightmare1 View Post
there is another car script i found, and it does gani, but it shows the car under you not rotating, but the direction is right. this was by chris.
PHP Code:
//#CLIENTSIDE
function onPlayerChats()
{
  if ( 
player.chat == ":car" )
  {
    
this.car this.car;
    if ( 
this.car )
    {
      
client.frozen true;
      
setTimer0.05 );
    }
    else
    {
      
player.attr[6] = "";
      
client.frozen false;
      
setTimer);
    }
  }
}
function 
onTimeOut()
{
  
client.frozen true;    
  
player.getMoveXthis.accel );
  
player.getMoveYthis.accel );
  if ( 
keydown) )
  {
    
this.carAngle += .2;  
  }
  if ( 
keydown) )
  {
    
this.carAngle -= .2;
  }
  
  
temp.dx getMoveX);
  
temp.dy getMoveY);
  
player.dir getdirtemp.dx player.xtemp.dy player.);
  if ( 
keydown) )
  {
    
this.accel this.accel .1 this.accel .1;
  }
  else
  {
    
this.accel this.accel .1 this.accel this.accel .1;
  }
  
player.getMoveXthis.accel );
  
player.getMoveYthis.accel );
  
client.car_angle this.carAngle;
  
player.attr[5] = this.carAngle;
  
  
setAni"sit""" );
  
player.attr[6] = "ut_car.gani";

  
setTimer0.05 );
}
function 
getMoveXspeed )
{
  return 
player.sinthis.carAngle ) * speed;
}
function 
getMoveYspeed )
{
  return 
player.costhis.carAngle ) * speed;

Are you are using findImg(index).rotation = player.attr[5] somewhere in the Gani script? Also it is showing under the player because the visibility is too low (you should be hiding the player anyways). changeimgvis(index, 3) should work though.
Reply With Quote
  #34  
Old 01-19-2008, 03:20 AM
Knightmare1 Knightmare1 is offline
Billy Allan
Knightmare1's Avatar
Join Date: Apr 2007
Posts: 804
Knightmare1 can only hope to improve
Quote:
Originally Posted by Rapidwolve24 View Post
Are you are using findImg(index).rotation = player.attr[5] somewhere in the Gani script? Also it is showing under the player because the visibility is too low (you should be hiding the player anyways). changeimgvis(index, 3) should work though.
i would put findImg(index).rotation = player.attr[5] just anywhere in the gani script?
__________________
I am the devil, I am here to do to devils work.
Reply With Quote
  #35  
Old 01-19-2008, 05:37 AM
Rapidwolve24 Rapidwolve24 is offline
North*
Join Date: Oct 2007
Location: Massachusetts
Posts: 178
Rapidwolve24 is on a distinguished road
Send a message via AIM to Rapidwolve24 Send a message via MSN to Rapidwolve24
Quote:
Originally Posted by Knightmare1 View Post
i would put findImg(index).rotation = player.attr[5] just anywhere in the gani script?
Under where ever the showimg(..) is, and it also should be in a timeout.
Don't actually put index, replace it with whatever index your showimg() is.
Reply With Quote
  #36  
Old 01-19-2008, 05:54 AM
Knightmare1 Knightmare1 is offline
Billy Allan
Knightmare1's Avatar
Join Date: Apr 2007
Posts: 804
Knightmare1 can only hope to improve
Quote:
Originally Posted by Rapidwolve24 View Post
Under where ever the showimg(..) is, and it also should be in a timeout.
Don't actually put index, replace it with whatever index your showimg() is.
i didnt do showimg.. its a gani, not an image.
__________________
I am the devil, I am here to do to devils work.
Reply With Quote
  #37  
Old 01-20-2008, 05:08 PM
Rapidwolve24 Rapidwolve24 is offline
North*
Join Date: Oct 2007
Location: Massachusetts
Posts: 178
Rapidwolve24 is on a distinguished road
Send a message via AIM to Rapidwolve24 Send a message via MSN to Rapidwolve24
You should be putting the showimg function in the gani script.
Reply With Quote
  #38  
Old 01-20-2008, 05:37 PM
Knightmare1 Knightmare1 is offline
Billy Allan
Knightmare1's Avatar
Join Date: Apr 2007
Posts: 804
Knightmare1 can only hope to improve
Quote:
Originally Posted by Rapidwolve24 View Post
You should be putting the showimg function in the gani script.
where would i put it.... ? and what do you mean by gani script?
__________________
I am the devil, I am here to do to devils work.
Reply With Quote
  #39  
Old 01-29-2008, 12:09 AM
Knightmare1 Knightmare1 is offline
Billy Allan
Knightmare1's Avatar
Join Date: Apr 2007
Posts: 804
Knightmare1 can only hope to improve
Sorry, i cant edit the last post, but i get what you mean by gani script, so how would i make it so the gani can turn in the script?
would i use
PHP Code:
GANI0001
SPRITE   20 utopia_car5
.gif    0    0   60  100 sprite

SINGLEDIRECTION
DEFAULTHEAD head19
.png
DEFAULTBODY body
.png

ANI
  20  
--26
ANIEND
SCRIPT
function onCreated()
{
  
showimg1"utopia_car5.gif"player.xplayer.); 
  
findimg).rotation player.attr[5]; 

__________________
I am the devil, I am here to do to devils work.
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 11:41 PM.


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