Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-22-2007, 01:40 AM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
Point n click movement system

This script implements a Diablo 2 style movement system. You click on a location and the player will attempt to move there. Included is acceleration and friction, which are configurable from onCreated().
This script used to have stamina and walking/running, but I removed it since most people would probably want to implement their own such system anyway (And to avoid bloating the script with features no one will use which only make it harder to read.).

Here's some documentation to help you expand it if necessary.

onCreated():
  • Variable initialisation.
onTimeout():
  • Acceleration, friction and movement.
SetTarget(x, y):
  • Properly sets this.target.[x/y] which is where the player will accelerate towards.
Accelerate(xspeed, yspeed, maxspeed):
  • Properly increases this.speed.[x/y] to avoid accelerating further than maxspeed.
Move(x, y):
  • Moves the player with block detection.
Distance(x, y):
  • Helper function; returns distance between (0, 0) and (x, y).

Installation: Used as a weapon.
PHP Code:
//#CLIENTSIDE

//**************************************************
function onCreated()
{
  
this.baseSpeed 8;
  
this.acceleration 4;
  
this.baseFriction 0.5;
  
  
this.target.player.1.5;
  
this.target.player.2;
  
  
onTimeout();
}


//**************************************************
function onTimeout()
{
  
// *****Set target position so we know where to move
  
if (leftmousebutton) {
    
SetTarget(mousexmousey);
  }
  
  
// *****Friction (We aren't walking on ice)
  
this.speed.*= this.baseFriction;
  
this.speed.*= this.baseFriction;
  
  
// *****Accelerate so we'll eventually reach that target position.
  
if (Distance(this.target.player.1.5this.target.player.2) > && !this.stopped) {
    
temp.angle getangle(this.target.player.1.5this.target.player.2);
    
temp.speed.cos(temp.angle) * this.acceleration;
    
temp.speed.= -sin(temp.angle) * this.acceleration;
    
    
Accelerate(temp.speed.xtemp.speed.ythis.baseSpeed);
    
    
setani("walk""");
  }
  else
  {
    if (
this.speed.0.5 && this.speed.> -0.5this.speed.0;
    if (
this.speed.0.5 && this.speed.> -0.5this.speed.0;
    
this.stopped true;
    
setani("idle""");
  }
  
  
// *****Actually move the player according to current speed.
  
Move(this.speed.xthis.speed.y);
  if (
this.speed.!= && this.speed.!= 0player.dir getdir(this.speed.xthis.speed.y);

  
setTimer(0.05);
}


//**************************************************
function onMouseDown(button)
{
  
// Set target position so we know where to move.
  
if (button == "left") {
    
SetTarget(mousexmousey);
  }
}


//**************************************************
// Set the position the system will try to reach.
function SetTarget(targetxtargety)
{
    if (
Distance(targetx player.1.5targety player.2) > 1) {
      
this.target.targetx;
      
this.target.targety;
      
this.stopped false;
    }
}


//**************************************************
// Increase the speed in pixels per frame.
function Accelerate(xSpeedySpeedmaxSpeed)
{
  if (
Distance(this.speed.xthis.speed.y) < maxSpeed || (Distance(this.speed.xSpeedthis.speed.ySpeed) - Distance(this.speed.xthis.speed.y)) <= 0) {
    
this.speed.+= xSpeed;
    
this.speed.+= ySpeed;
    
    if (
Distance(this.speed.xthis.speed.y) > maxSpeed) {
      
temp.angle getangle(this.speed.xthis.speed.y);
      
this.speed.cos(temp.angle) * maxSpeed;
      
this.speed.= -sin(temp.angle) * maxSpeed;
    }
  }
}


//**************************************************
// Move the player by specified amount of pixels.
function Move(xSpeedySpeed)
{
  if (!
isapplicationactive) return;
  
  
xSpeed xSpeed<0?int(xSpeed)+1:int(xSpeed);
  
ySpeed ySpeed<0?int(ySpeed)+1:int(ySpeed);
  
  
// --- 'x' movement of the player --- \\
  
if (xSpeed != 0) {
    
temp.int(player.16);
    
temp.xDir = (abs(xSpeed) / xSpeed);
    for (
i=0i<abs(xSpeed); i++) {
      if (!
onwall2(temp.16 temp.xDir * (1/16), player.211)) temp.+= temp.xDir;
      else break;
    }
    
player.temp.16;
  }
  
  
// --- 'y' movement of the player --- \\
  
if (ySpeed != 0) {
    
temp.int(player.16);
    
temp.yDir = (abs(ySpeed) / ySpeed);
    for (
i=0i<abs(ySpeed); i++) {
      if (!
onwall2(player.1temp.16 temp.yDir * (1/16), 11)) temp.+= temp.yDir;
      else break;
    }
    
player.temp.16;
  }
  
  
//Hack
  
if (tiletype(player.1.5player.2) == 3) {
    
setani("sit""");
  }
}


//**************************************************
//Calculate the distance between (0, 0) and (dx, dy).
function Distance(dxdy)
{
  return ((
dx)^+ (dy)^2)^0.5

Reply With Quote
  #2  
Old 03-22-2007, 02:35 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
awesome ^_^
__________________
Deep into the Darkness peering...
Reply With Quote
  #3  
Old 03-22-2007, 02:48 AM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
Nice
Reply With Quote
  #4  
Old 03-22-2007, 03:15 AM
theHAWKER theHAWKER is offline
**FLIP OUT**
theHAWKER's Avatar
Join Date: Mar 2006
Location: canada, vancouver
Posts: 768
theHAWKER is an unknown quantity at this point
where do u put this script? in weapons?
__________________
**FLIP OUT**
Reply With Quote
  #5  
Old 03-22-2007, 03:49 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
It looks good. Doesn't work on servers O.o
__________________
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
  #6  
Old 03-22-2007, 04:12 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Quote:
Originally Posted by theHAWKER View Post
where do u put this script? in weapons?
Damn, GS1 using....UIGGGHGHGSDNGSK

Quote:
Originally Posted by Switch View Post
It looks good. Doesn't work on servers O.o
It works on Mythic so YOU must've ****ed it up.
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #7  
Old 03-22-2007, 04:37 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Quote:
Originally Posted by DrakilorP2P View Post
You click on a location and the player will attempt to move there.
Haha one part of my master plan has been taken . I wanted to make a point and click styled system like Monkey Island.
Reply With Quote
  #8  
Old 03-22-2007, 09:47 AM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
More precise installation instructions:
1. Get access to a server using GS2.
2. Insert the script as a "weapon". For example: System/Movement.
3. Add the weapon to your account, or add a script that automatically adds it when a player connect.

Quote:
Originally Posted by Twinny View Post
Haha one part of my master plan has been taken . I wanted to make a point and click styled system like Monkey Island.
You can view it in two ways:
1. Part of your master plan was taken.
or 2. Someone wrote the script for you.
Reply With Quote
  #9  
Old 03-22-2007, 11:01 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Thats right folks! Now YOUR server can have a small part of Mythic on them!
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #10  
Old 03-22-2007, 03:13 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Quote:
Originally Posted by DrakilorP2P View Post
You can view it in two ways:
1. Part of your master plan was taken.
or 2. Someone wrote the script for you.
I'd have to write a pretty damn good pathfinding system for mine...or get some unlucky LAT to map out possible paths in each level . I suppose you could write a spider to scan all possible paths then save them to a database...hmm...
Reply With Quote
  #11  
Old 03-22-2007, 10:20 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
Links don't work with this, nor does onPlayerTouchsMe() :| Gotta make some checks and so forth, works well on a gmap =D
__________________
Deep into the Darkness peering...
Reply With Quote
  #12  
Old 03-22-2007, 10:37 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Switch View Post
It looks good. Doesn't work on servers O.o
Pretty nice script! I checked it, looks pretty cool. I got no server to test it atm though :/

Edit: Correction: I actually got one, but my RC seems to be totally ****ed up.

Last edited by Skyld; 03-22-2007 at 11:52 PM.. Reason: Now now, children.
Reply With Quote
  #13  
Old 03-22-2007, 11:19 PM
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
Quote:
Originally Posted by Crow View Post
Pretty nice script! I checked it, looks pretty cool. I got no server to test it atm though :/

Edit: Correction: I actually got one, but my RC seems to be totally ****ed up.
I happen to OWN a server and I put it on to test it and it DIDN'T work. AND I had one of my GATs test it RIGHT now. It ALSO didn't work.
__________________
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.

Last edited by Skyld; 03-22-2007 at 11:51 PM.. Reason: Now now, children.
Reply With Quote
  #14  
Old 03-22-2007, 11:41 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Did you add the weapon to yourselves?
Reply With Quote
  #15  
Old 03-23-2007, 12:48 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
Quote:
Originally Posted by Switch View Post
I had one of my GATs test it RIGHT now. It ALSO didn't work.
GAT != NAT

lol

EDIT: How would I reset setTarget()? I've tried a few different method but the player spazzes out or just head north east. :/ Also I tried to make it so the players normal movement isnt afftected by this aswell and failed... any pointers to get me started?
__________________
Deep into the Darkness peering...

Last edited by Angel_Light; 03-23-2007 at 01:17 AM..
Reply With Quote
  #16  
Old 03-23-2007, 01:04 PM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
Quote:
Originally Posted by Angel_Light View Post
EDIT: How would I reset setTarget()? I've tried a few different method but the player spazzes out or just head north east. :/ Also I tried to make it so the players normal movement isnt afftected by this aswell and failed... any pointers to get me started?
disabledefmovement();

this.stopped = true; or setTarget(player.x+1.5, player.y+.2).
The latter may or may not work, but it looks neater.
Reply With Quote
  #17  
Old 03-24-2007, 12:22 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
Quote:
Originally Posted by DrakilorP2P View Post
disabledefmovement();

this.stopped = true; or setTarget(player.x+1.5, player.y+.2).
The latter may or may not work, but it looks neater.
tried player goes to north west
__________________
Deep into the Darkness peering...
Reply With Quote
  #18  
Old 04-10-2007, 11:54 AM
middo middo is offline
VHE Monkey
middo's Avatar
Join Date: Aug 2002
Location: California
Posts: 327
middo is on a distinguished road
Send a message via AIM to middo
I did a little modification so that it works with arrow keys

There was also a bug in the condition before your getdir(speed.x,speed.y)
You had &&'d it, and so it wouldn't update the direction if you were only moving one way. Just replace && with || like I did here.

EDIT: I changed a lot of the code. There were a lot of problems, I tested it with a friend and when we collided, we were stuck on each other! Now you can get out of walls and not fly through them if moving fast (only does the save check if you are stuck in a wall, otherwise you can still have a high speed set and the raytrace won't skip the wall)

LAST EDIT:
I fixed my own bugs and made it work almost perfectly! A saveCheck is set and overrides the speeds to try and get you out of the wall. Works perfectly for me
If you want to use it for mouse still, just uncomment the mouse lines I took out.

PHP Code:
//#CLIENTSIDE

//**************************************************
function onCreated()
{
  
this.baseSpeed 8;
  
this.acceleration 4.5;
  
this.baseFriction .5;
  
  
this.target.player.1.5;
  
this.target.player.2;
  
  
onTimeout();
  
  
disabledefmovement();
}

function 
onPlayerEnters()
{
  
disabledefmovement();
  
this.target.player.1.5;
  
this.target.player.2;  
}


//**************************************************
function onTimeout()
{
  
modY=0;
  
modX=0;
  if (
keydown(0))    modY=-1.2;
  if (
keydown(1))    modX=-1.2;
  if (
keydown(2))    modY=1.2;
  if (
keydown(3))    modX=1.2;

  if (
modY != || modX != 0SetTarget(player.x+1.5+modX,player.y+2+modY);  
  
  
// *****Set target position so we know where to move
  //if (leftmousebutton) {
  //  SetTarget(mousex, mousey);
  //}
  
  // *****Friction (We aren't walking on ice)
  
this.speed.*= this.baseFriction;
  
this.speed.*= this.baseFriction;
  
  
// *****Accelerate so we'll eventually reach that target position.
  
if (Distance(this.target.player.1.5this.target.player.2) > && !this.stopped) {
    
temp.angle getangle(this.target.player.1.5this.target.player.2);
    
temp.speed.cos(temp.angle) * this.acceleration;
    
temp.speed.= -sin(temp.angle) * this.acceleration;
    
    
Accelerate(temp.speed.xtemp.speed.ythis.baseSpeed);
    
setani("walk""");
  }
  else
  {
    if (
this.speed.0.1 && this.speed.> -0.1this.speed.0;
    if (
this.speed.0.1 && this.speed.> -0.1this.speed.0;
    
this.stopped true;
  }
  
  
// *****Actually move the player according to current speed.
  
Move(this.speed.xthis.speed.y);
  if (
this.speed.!= || this.speed.!= 0player.dir getdir(this.speed.xthis.speed.y);
  if ((
modX == && modY == 0) && (this.speed.!=|| this.speed.!=0)) 
  {
  
this.stopped == true;
  
SetTarget(player.x+1.5,player.y+2);
    
//Hack
  
if (tiletype(player.1.5player.2) == 3) {
    
setani("sit""");
  } else {
      
setani("idle""");
    }
  }
  
  
setTimer(0.05);
}


//**************************************************
/*function onMouseDown(button)
{
  // Set target position so we know where to move.
  if (button == "left") {
    SetTarget(mousex, mousey);
  }
}*/


//**************************************************
// Set the position the system will try to reach.
function SetTarget(targetxtargety)
{
    if (
Distance(targetx player.1.5targety player.2) > 1) {
      
this.target.targetx;
      
this.target.targety;
      
this.stopped false;
    }
}


//**************************************************
// Increase the speed in pixels per frame.
function Accelerate(xSpeedySpeedmaxSpeed)
{
  
  if (
Distance(this.speed.xthis.speed.y) < maxSpeed || (Distance(this.speed.xSpeedthis.speed.ySpeed) - Distance(this.speed.xthis.speed.y)) <= 0) {
//    if (modX != 0 || modY != 0) {
    
this.speed.+= xSpeed;
    
this.speed.+= ySpeed;
//    }
    
if (Distance(this.speed.xthis.speed.y) > maxSpeed) {
      
temp.angle getangle(this.speed.xthis.speed.y);
      
this.speed.cos(temp.angle) * maxSpeed;
      
this.speed.= -sin(temp.angle) * maxSpeed;
    }
  }
}

//**************************************************
// Move the player by specified amount of pixels.
function Move(xSpeedySpeed)
{
  
//if (!isapplicationactive) return;
  
  
xSpeed xSpeed<0?int(xSpeed)+1:int(xSpeed);
  
ySpeed ySpeed<0?int(ySpeed)+1:int(ySpeed);
  
  
temp.saveCheck onwall2(player.x+1,player.y+2,1,1); // modify our detection to get unstuck if we are
  
  // --- 'x' movement of the player --- \\
  
if (xSpeed != 0) {
    
temp.xDir = (abs(xSpeed) / xSpeed);
    
temp.int(player.16);
    
temp.scanx 0;
    for (
i=0< (temp.saveCheck .45 abs(xSpeed)); ++ ) {
      if (!
onwall2((temp.x+(i*temp.xDir)) / 16 + (temp.xDir*(temp.saveCheck 24 8)) * (1/16), player.211)) temp.scanx++;
      else if (
temp.saveCheck) continue; else break;
    }
    
temp.x+=(temp.scanx*temp.xDir);
    
player.temp.16;
  }
  
  
// --- 'y' movement of the player --- \\
  
if (ySpeed != 0) {
    
temp.int(player.16);
    
temp.yDir = (abs(ySpeed) / ySpeed);
    
temp.scany 0;    
    for (
i=0i<(temp.saveCheck .45 abs(ySpeed)); i++) {
      if (!
onwall2(player.1, (temp.y+(temp.scany*temp.yDir)) / 16 + (temp.saveCheck 1.5 2) + (temp.yDir*(temp.saveCheck 24 1)) * (1/16), 11)) temp.scany++;
      else if (
temp.saveCheck) continue; else break;
    }
    
temp.y+=(temp.scany*temp.yDir);
    
temp.varia=onwall2(player.x+1,player.y+2,1,1);
    
player.temp.16;
  }
  if (
tiletype(player.1.5player.2) == 3) {
    
setani("sit""");
  }  

}


//**************************************************
//Calculate the distance between (0, 0) and (dx, dy).
function Distance(dxdy)
{
  return ((
dx)^+ (dy)^2)^0.5

I'll be using this I think.
Thanks <3

Last edited by middo; 04-10-2007 at 04:04 PM..
Reply With Quote
  #19  
Old 06-07-2008, 05:56 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
sorry to bring up an old thread but I have a question, in middo's form of this script, near the bottom of the script what is the point of

PHP Code:
temp.varia=onwall2(player.x+1,player.y+2,1,1); 
__________________
Deep into the Darkness peering...
Reply With Quote
  #20  
Old 06-07-2008, 11:50 AM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Angel_Light View Post
sorry to bring up an old thread but I have a question, in middo's form of this script, near the bottom of the script what is the point of

PHP Code:
temp.varia=onwall2(player.x+1,player.y+2,1,1); 
Most likely an unused leftover variable.
Reply With Quote
  #21  
Old 06-07-2008, 06:05 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 Angel_Light View Post
sorry to bring up an old thread but I have a question, in middo's form of this script, near the bottom of the script what is the point of

PHP Code:
temp.varia=onwall2(player.x+1,player.y+2,1,1); 
Without reading the script, it would seem that he is using it for some kind of wall detection, no?
__________________
Reply With Quote
  #22  
Old 06-07-2008, 06:16 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by cbk1994 View Post
Without reading the script, it would seem that he is using it for some kind of wall detection, no?
Well, it isn't used anywhere else. Maybe he wanted to do that first, but I guess he didn't like that idea later ;P
Reply With Quote
  #23  
Old 06-07-2008, 06:24 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 Crow View Post
Well, it isn't used anywhere else. Maybe he wanted to do that first, but I guess he didn't like that idea later ;P
I bet it's just there to piss people off.
__________________
Reply With Quote
  #24  
Old 06-07-2008, 06:44 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
haha, I was did a search last night for all posts that have my server name in it and this came up, it puzzled me. XD
__________________
Deep into the Darkness peering...
Reply With Quote
  #25  
Old 06-07-2008, 10:05 PM
Deas_Voice Deas_Voice is offline
Deas
Deas_Voice's Avatar
Join Date: Jun 2007
Location: Sweden
Posts: 2,264
Deas_Voice is a jewel in the roughDeas_Voice is a jewel in the rough
Send a message via AIM to Deas_Voice Send a message via MSN to Deas_Voice Send a message via Yahoo to Deas_Voice
Quote:
Originally Posted by Angel_Light View Post
haha, I was did a search last night for all posts that have my server name in it and this came up, it puzzled me. XD
how meny posts was it? xD
__________________
.
WTF is real life, and where do I Download it?
There is no Real Life, just AFK!
since 2003~
I Support~
ღAeonღ | ღTestbedღ | ღDelteriaღ

if you are going to rep me, don't be an idiot, leave your name!
I got nothing but love for you
Reply With Quote
  #26  
Old 06-07-2008, 11:13 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 Deas_Voice View Post
how meny posts was it? xD
Name:  varia.png
Views: 225
Size:  782 Bytes
__________________
Reply With Quote
  #27  
Old 06-07-2008, 11:26 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
We are doomed.

Name:  illuminati.png
Views: 380
Size:  420 Bytes
Reply With Quote
  #28  
Old 06-08-2008, 12:27 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by Crow View Post
We are doomed.

Attachment 44843
I don't get it.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #29  
Old 06-08-2008, 01:37 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 xXziroXx View Post
I don't get it.
Neither does a quick Google search ...
__________________
Reply With Quote
  #30  
Old 06-08-2008, 02:28 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
I'm assuming the movie 23. I haven't seen it, but I think it's like the evil 42.
Reply With Quote
  #31  
Old 06-08-2008, 06:45 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
hey! 42 is the answer to life, the universe, and everything!
__________________
Deep into the Darkness peering...
Reply With Quote
  #32  
Old 06-08-2008, 06:58 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 Angel_Light View Post
hey! 42 is the answer to life, the universe, and everything!
Google agrees.

Click image for larger version

Name:	google.png
Views:	221
Size:	14.7 KB
ID:	44844
__________________
Reply With Quote
  #33  
Old 06-08-2008, 10:39 AM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by DustyPorViva View Post
I'm assuming the movie 23. I haven't seen it, but I think it's like the evil 42.
Ding ding ding. 23 and its cross sum 5, Illuminati.
Reply With Quote
  #34  
Old 06-25-2008, 02:59 AM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
Since this thread is already kind of bumped:

PHP Code:
function onActionServerSide()
{
  switch (
params[0]) {    
    case 
"freezeplayer":
      
clientr.frozen true;
    break;
    
    case 
"unfreezeplayer":
      
clientr.frozen false;
    break;
  }
}

//#CLIENTSIDE

//**************************************************
function onCreated()
{
  
this.baseSpeed 12;
  
this.acceleration 2;
  
this.friction.plain 0.75// <- Ordinary, which means 'normal ground'.
  
this.friction.water 0.5;
  
this.friction.chair 0.5;
  
this.friction.air 0.95;
  
this.gravity 2;
  
  
this.baseJumpPower.xy 25;
  
this.baseJumpPower.7;
  
this.doublePressDelay 0.25;
  
  
this.gani.idle "idle";
  
this.gani.walk "walk";
  
this.gani.slowWalk "slowwalk";
  
this.gani.swim "swim";
  
this.gani.sit "sit";
  
  
disabledefmovement();
  
  
onTimeout();
}


//**************************************************
function onKeyPressed(keycodekeynamescancode)
{
  switch (
keyname) {
    case 
"n":
      
this.noclip = !this.noclip;
      
player.chat "Noclip: " SPC this.noclip;
    break;
  }
}


//**************************************************
function onTimeout()
{
  
temp.dirArr = {falsefalsefalsefalse};
  if (
this.freezetime <= 0)
  {
    if (
keydown(0)) temp.dirArr[0] = true;
    if (
keydown(1)) temp.dirArr[1] = true;
    if (
keydown(2)) temp.dirArr[2] = true;
    if (
keydown(3)) temp.dirArr[3] = true;
  }
  
  
// *****Loop throught the keys (temp.dirArr).
  
for (i=0i<4i++) {
    
temp.dir i;
    if (
temp.dirArr[i] == true) {
      if (
this.("keyMode" temp.dir) == 0) {
        
this.("lastKeyPress" temp.dir) = timevar2;
        
this.("keyMode" temp.dir) = 1;
      }
      elseif (
this.("keyMode" temp.dir) == 2) {
        
Jump(temp.dir);
        
this.("keyMode" temp.dir) = 0;
      }
    }
    else {
      if (
this.("keyMode" temp.dir) == 1) {
          
this.("keyMode" temp.dir) = 2;
      }
      if (
timevar2 this.("lastKeyPress" temp.dir) > this.doublePressDelay) {
        
this.("keyMode" temp.dir) = 0;
      }
    }
  }
  
  
// *****Get current friction
  
if (player.== 0) {
    
temp.curtiletype tiletype(player.1.5player.2);
    if (
temp.curtiletype == 11temp.friction this.friction.water;
    elseif (
temp.curtiletype == 3temp.friction this.friction.chair;
    else 
temp.friction this.friction.plain;
  }
  else 
temp.friction this.friction.air;
  
  
// *****Apply friction
  
this.speed.*= temp.friction;
  
this.speed.*= temp.friction;
  if (
this.speed.0.25 && this.speed.> -0.25this.speed.0;
  if (
this.speed.0.25 && this.speed.> -0.25this.speed.0;
  
  
// *****Accelerate so we'll eventually reach that target position.
  
if (player.== && this.freezetime <= 0) {
    if (
keydown(0)) Accelerate(0, -this.accelerationthis.baseSpeed);
    if (
keydown(1)) Accelerate(-this.acceleration0this.baseSpeed);
    if (
keydown(2)) Accelerate(0this.accelerationthis.baseSpeed);
    if (
keydown(3)) Accelerate(this.acceleration0this.baseSpeed);
  }
  
  
// *****Actually move the player according to current speed.
  
Move(this.speed.xthis.speed.y);
  if (!
clientr.frozen && (this.speed.!= || this.speed.!= 0)) player.dir getdir(this.speed.xthis.speed.y);
  
  
// *****Gravity
  
if (player.0this.speed.-= this.gravity;
  elseif (
this.speed.0this.speed.0;
  
player.+= this.speed.16;
  
  
// *****Freeze
  
if (this.freezetime 0this.freezetime -= 0.05;
  
  
// *****Set animation.
  
if (Distance(this.speed.xthis.speed.y) > 0.1) {
    
temp.groundtype GetGroundType();
    if (
temp.groundtype == "water"setani(this.gani.swim"");
    elseif (
temp.groundtype == "chair"setani(this.gani.sit"");
    elseif (!
clientr.frozen && Distance(this.speed.xthis.speed.y) > 0.5) {
      if (
Distance(this.speed.xthis.speed.y) < 7.5setani(this.gani.slowWalk"");
      else 
setani(this.gani.walk"");
    }
    else 
setani(this.gani.idle"");
  }
  
  
setTimer(0.05);
}


//**************************************************
// Increase the speed in pixels per frame.
function Accelerate(xSpeedySpeedmaxSpeed)
{
  if (
Distance(this.speed.xthis.speed.y) < maxSpeed || (Distance(this.speed.xSpeedthis.speed.ySpeed) - Distance(this.speed.xthis.speed.y)) <= 0) {
    
this.speed.+= xSpeed;
    
this.speed.+= ySpeed;
    
    if (
Distance(this.speed.xthis.speed.y) > maxSpeed) {
      
temp.angle getangle(this.speed.xthis.speed.y);
      
this.speed.cos(temp.angle) * maxSpeed;
      
this.speed.= -sin(temp.angle) * maxSpeed;
    }
  }
}


//**************************************************
// Move the player by specified amount of pixels.
function Move(xSpeedySpeed)
{
  if (!
isapplicationactive || clientr.frozen) return;
  
  
xSpeed xSpeed<0?int(xSpeed)+1:int(xSpeed);
  
ySpeed ySpeed<0?int(ySpeed)+1:int(ySpeed);
  
  
// --- 'x' movement of the player --- \\
  
if (xSpeed != 0) {
    
temp.int(player.16);
    
temp.xDir = (abs(xSpeed) / xSpeed);
    for (
i=0i<abs(xSpeed); i++) {
      if (!
onwall2(temp.16 0.75 temp.xDir * (1/16), player.1.751.51.25) || this.nocliptemp.+= temp.xDir;
      else break;
    }
    
player.temp.16;
  }
  
  
// --- 'y' movement of the player --- \\
  
if (ySpeed != 0) {
    
temp.int(player.16);
    
temp.yDir = (abs(ySpeed) / ySpeed);
    for (
i=0i<abs(ySpeed); i++) {
      if (!
onwall2(player.0.75temp.16 1.75 temp.yDir * (1/16), 1.51.25) || this.nocliptemp.+= temp.yDir;
      else break;
    }
    
player.temp.16;
  }
}


//**************************************************
// Jump in the specified direction.
function Jump(direction)
{
  if (
player.== 0) {
    if (
this.speed.== NULLthis.speed.+= this.baseJumpPower.z;
    if (
direction == 0this.speed.-= this.baseJumpPower.xy;
    elseif (
direction == 1this.speed.-= this.baseJumpPower.xy;
    elseif (
direction == 2this.speed.+= this.baseJumpPower.xy;
    elseif (
direction == 3this.speed.+= this.baseJumpPower.xy;
  }
}


//**************************************************
// Prevent the player form accelerating or jumping via keydown() for the specified amount of time.
public function freeze(time) {
  if (
time != NULLthis.freezetime time;
  else return 
this.freezetime;
}


//**************************************************
// Replace ganis to be displayed when walking etc. Read onCreated() for list of variables.
public function replaceGani(typegani)
{
  
makevar("this.gani." type) = gani;
  
player.chat makevar("this.gani." type);
}


//**************************************************
// Returns a string representing the ground type the player is standing on. We need this in order to figure out what gani to use.
function GetGroundType()
{
  
temp.tiletype tiletype(player.1.5player.2);
  if (
temp.tiletype == 11) return "water";
  elseif (
temp.tiletype == 3) return "chair";
  else return 
"ground";
}


//**************************************************
//Calculate the distance between (0, 0) and (dx, dy).
function Distance(dxdy)
{
  return ((
dx)^+ (dy)^2)^0.5;

It's a later revision of the original code that I completely forgot about and found again only recently.
Note: the animations might not work properly since I didn't bother with extensive debugging after modifying it slightly for Code Gallery use.

Like the previous modification posted, this one lets you use the keyboard to move around. Unlike the previous, it uses Accelerate() instead of SetTarget() (*gasp*).
In addition, as a result of the great mind leakage of 1978*, it implements a UT style jump/dodge function which is activated when you tap a direction button twice. It will usually keep you entertained for about sixty seconds.

It's been fooled around with by at least two other coders but I'm unable to deduce who did what exactly.

[Footnote*]
This disastrous event, which killed many, was a result of Xzirox running into the Barsebäck reactor to save a baby from radiation poisoning. The baby had already been burnt to a crisp by the intense heat of course, so he was faced with nought but carbon fumes. The combination of fumes, radiation and a conveniently occurring discharge of electricity momentarily mutated Xzirox into a Mindflayer with great telepathic abilities who lost control of it's telepathic wave transmitters, resulting in all of his most terrible ideas being leaked into a nearby town. I was observing a pane of lead at the time which blocked most of the waves, so I was fortunately only struck with a somewhat innocent idea. However, even this limited exposure caused me to lose a whole night of sleep by forcing me to compulsively finish the feature before finally allowing me to sleep. The Swedish government agreed to pay for the medical bills for the humanification if Xzirox would promise never to attempt to save a baby again. Nowadays the survivors of that terrible accident annually pay respects to the less lucky ones who had their heads explode.
Reply With Quote
  #35  
Old 06-30-2008, 02:52 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Funny story
Will eventually use the scripts for a future project

Last edited by Admins; 06-30-2008 at 11:52 PM..
Reply With Quote
  #36  
Old 06-30-2008, 11:45 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by Stefan View Post
Funny store
Yeah go ahead, laugh at my expense all you want.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #37  
Old 07-01-2008, 01:19 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
Lol Awesome Story
__________________
Reply With Quote
  #38  
Old 11-28-2009, 04:29 PM
Samposse Samposse is offline
Chopa Shopa !
Samposse's Avatar
Join Date: Nov 2008
Location: Norway
Posts: 87
Samposse is an unknown quantity at this point
Send a message via AIM to Samposse Send a message via MSN to Samposse
Think how to PK whoud be like *Old Warcraft style xD
__________________
Delitto :3

A
SERVER
UNDER
CONSTRUCTION !

feel free to ask me about delitto
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 05:09 PM.


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