Re: Need some pics
Here’s a “draisine” script that you could use to help. It works until you get to a zone break and then locks up the character (However, it doesn’t do this offline, I can cross levels just fine.). It may be of some use to you.
This draisine uses manual manipulation from the player. Essentially, they can travel and get off at any point, along the tracks, that they wish. If the tracks branch off, the player can select the direction they wish to take by holding the appropriate arrow key. They can accelerate by tapping S and get off with A. And if you are accelerated and discontinue tapping S, you will glide to a hault.
Draisine Weapon (With weapon name mouseover)
[code]if (created||playerenters||isleader) {
timeout=0.05;
setimg nyght_icon_draisine.png;
}
if (timeout && mousex>x-0.5 && mousex<x+2 && mousey>y-0.5 && mousey<y+2) {
showtext 550,x+0.8,y+2.2,Arial,c,Draisine;
timeout=0.05;
} else {
showimg 550,;
}
if (playertouchsme) {
toweapons Draisine;
}
if (created && isweapon) {
this.raildirs = {1,3, 0,2, 2,3, 1,2, 0,3, 1,0};
this.acc = 0.25;
this.friction = 0.97;
this.maxspeed = 2;
}
if (weaponfired) {
if (this.on==false) {
this.speed = 0;
this.waypos = 0;
searchforrails();
if (this.on==true)
this.waypos = 2;
}
}
function searchforrails() {
tx = playerx+1.5;
ty = playery+2;
this.outdir = -1;
this.oldrailx = this.railx;
this.oldraily = this.raily;
pushdir = playerdir;
if (!keydown(pushdir)) {
if (keydown((pushdir+1)%4))
pushdir = (pushdir+1)%4;
if (keydown((pushdir-1)%4))
pushdir = (pushdir-1)%4;
}
for (i=0; i<npcscount; i++) {
nx = npcs[i].x;
ny = npcs[i].y;
indir = -1;
outdir = -1;
if (npcs[i].save[9]==1 && tx in |nx,nx+4> && ty in |ny,ny+4>) {
type = npcs[i].save[0];
d1 = this.raildirs[type2];
d2 = this.raildirs[type2+1];
oppdir = (playerdir+2)%4;
if (d1==oppdir) {
indir = d1;
outdir = d2;
} else if (d2==oppdir) {
indir = d2;
outdir = d1;
}
}
if (outdir>=0) {
if (this.outdir<0 || outdir==pushdir || (this.outdir!=pushdir && outdir==playerdir)) {
this.railx = nx;
this.raily = ny;
this.indir = indir;
this.outdir = outdir;
if (outdir==pushdir)
break;
}
}
}
if (this.outdir>=0) {
if (this.waypos>0) {
wayposset = false;
if (this.indir in {0,2}) {
playerx = this.railx+0.5;
this.waypos -= abs(this.raily-this.oldraily);
wayposset = true;
}
if (this.indir in {1,3}) {
playery = this.raily;
this.waypos -= abs(this.railx-this.oldrailx);
wayposset = true;
}
if (wayposset==false) {
if (this.waypos>=4)
this.waypos -= 4;
else
this.waypos = 0;
}
}
this.on = true;
disabledefmovement;
if (strequals(#s(client.race),bomy))
set disablebomymovement;
timeout = 0.05;
}
}
function turnoff() {
this.on = false;
enabledefmovement;
if (strequals(#s(client.race),bomy)) {
unset disablebomymovement;
setani bomy_idle,;
} else
setani idle,;
stopsound train.wav;
}
function setanimation() {
if (strequals(#s(client.race),bomy)) {
if (this.speed==0)
setani bomy_draisine,;
else
setani bomy_draisine2,;
} else {
if (this.speed==0)
setani draisine,;
else
setani draisine2,;
}
}
if (timeout && this.on==true) {
if (keydown(6))
turnoff();
else {
freezeplayer 0.05;
if (keydown(5)) {
if (this.speedkeydown==false) {
this.speed += this.acc;
if (this.speed>this.maxspeed)
this.speed = this.maxspeed;
playlooped train.wav;
}
this.speedkeydown = true;
} else {
this.speedkeydown = false;
}
tox = this.railx+0.5+vecx(this.indir)2;
toy = this.raily+vecy(this.indir)2;
isstraight = (this.indir==(this.outdir+2)%4);
if (isstraight==true) {
tox += this.waypos * vecx(this.outdir);
toy += this.waypos * vecy(this.outdir);
} else {
w = this.waypos/43.14/2;
dside = 1-cos(w);
dforward = sin(w);
fdir = (this.indir+2)%4;
tox += dforward2vecx(fdir);
toy += dforward2vecy(fdir);
tox += dside2vecx(this.outdir);
toy += dside2*vecy(this.outdir);
}
playerx = tox;
playery = toy;
if (!(playerx+1.5 in |this.railx,this.railx+4| && playery+2 in |this.raily,this.raily+4|)
|| (isstraight==true && this.speed>0)) {
this.on = false;
searchforrails();
if (this.on==false)
turnoff();
} else
timeout = 0.05;
if (this.on==true) {
addspeed = this.speed;
if (!(playerx+1.5,playery+2 in |4,60|) && addspeed>1)
addspeed = 1;
this.waypos += addspeed;
if (this.waypos>=2) playerdir = this.outdir;
this.speed *= this.friction;
if (this.speed<0.05)
this.speed = 0;
if (this.speed==0)
stopsound train.wav;
setanimation();
}
}
}
if (playerenters && isweapon) {
if (this.on==true) {
if (playerx<-1) playerx = -1;
if (playerx>62) playerx = 62;
if (playery<-1.5) playery = -1.5;
if (playery>61.5) playery = 61.5;
for (this.i=0; this.i<10; this.i+=0.05) {
this.on = false;
this.waypos = 0;
searchforrails();
if (this.on==true) {
this.waypos = 2;
break;
}
sleep 0.05;
}
if (this.on==false)
turnoff();
}
}[/code]
Up-to-right/left-to-down track
if (created||playerenters||isleader) {
dontblock;
drawunderplayer;
save[9] = 1; // railtrack
save[0] = 2;
timeout=0.05;
}
if (timeout) {
timeout=0.05;
}
Left-to=right/right-to-left Track
if (created||playerenters||isleader) {
dontblock;
drawunderplayer;
save[9] = 1; // railtrack
save[0] = 0;
timeout=0.05;
}
if (timeout) {
timeout=0.05;
}
Right-to-down/Up-to-left Track
if (created||playerenters||isleader) {
dontblock;
drawunderplayer;
save[9] = 1; // railtrack
save[0] = 3;
timeout=0.05;
}
if (timeout) {
timeout=0.05;
}
Up-to-down/down-to-up Track
if (created||playerenters||isleader) {
dontblock;
drawunderplayer;
save[9] = 1; // railtrack
save[0] = 1;
timeout=0.05;
}
if (timeout) {
timeout=0.05;
}
Down-to-left/right-to-up Track
if (created||playerenters||isleader) {
dontblock;
drawunderplayer;
save[9] = 1; // railtrack
save[0] = 5;
timeout=0.05;
}
if (timeout) {
timeout=0.05;
}
Left-to-up/down-to-right Track
if (created||playerenters||isleader) {
dontblock;
drawunderplayer;
save[9] = 1; // railtrack
save[0] = 4;
timeout=0.05;
}
if (timeout) {
timeout=0.05;
}