Graal Forums

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

ApeHex 08-14-2003 02:23 PM

onwall help
 
ok, i made a speed up script or whatever. i used the original onwall function, but can anyone tell me the onwall2 syntax and stuff?
NPC Code:

// NPC made by ApeHex
if (playerenters) {
playerdir=0;
toweapons speed;
set clientr.gotspeed;
timeout=0.1;
doReset();
}
if (clientr.gotspeed){
if (timeout){
for (i=0;i<4;i++){
if (keydown(i)){
if (!onwall(playerx+this.walkSpeed+vecx(i)*this.walkS peed,playery+this.walkSpeed+vecy(i)*this.walkSpeed )){
playerx+=vecx(i)*this.walkSpeed;
playery+=vecy(i)*this.walkSpeed;
this.lastStep=strtofloat(i);
}
}
}
if (playerz<=-9.5){
playerx-=vecx(this.lastStep)*this.walkSpeed;
playery-=vecy(this.lastStep)*this.walkSpeed;
}
}
if (playeronline){
doTempStrings();
}
timeout=0.1;
}
function doReset(){
setstring clientr.walkSpeed,1.9;
}
function doTempStrings(){
this.walkSpeed=strtofloat(#s(clientr.walkSpeed));
}


i used temporary this.string because i find it easier to manipulate ;o

VeX_RaT_Boy 08-14-2003 05:04 PM

onwall2 is just for version3...It have not been added to version 2.2... (I MIGHT be wrong, but i don't think so)

EDIT:

I forgot the command x.x

onwall2(x,y,width,height)

its a rectangular area that it checks.....

ApeHex 08-14-2003 07:11 PM

thanks man ;D

edit:
doesnt seem to work
;o

Dach 08-14-2003 07:30 PM

Quote:

if (!onwall(playerx+this.walkSpeed+vecx(i)*this.walkSpeed,playery+this.walkSpeed+vecy(i)*this.walkSpeed)){
unless the player is getting bigger as he goes faster, use x+1.5,y+2

Quote:

this.lastStep=strtofloat(i);
i isn't a string here so you don't need the strtofloat()

and I would suggest an increment checker for speed movements so you cant bump into a wall when your not even touching it as you go fast. meaning use a for loop inside the keydown to check each tile before the one you want to move to and jump to the furthest one without passing over a wall

ApeHex 08-14-2003 08:16 PM

;o
heh, im so used to using strtofloat on variables its getting kind of sad
;\
thanks for the help though
:D

dach, where in missouri are you?

Dach 08-15-2003 01:35 AM

the hillbilly capitol of south st louis, jefferson county, *shudders*

Kaimetsu 08-15-2003 06:27 AM

This code would benefit from adherence to KSI-GS.

Snakeandy7 08-15-2003 11:35 AM

Quote:

Originally posted by Kaimetsu
This code would benefit from adherence to KSI-GS.
When will KSI-GS be fineshed?.

Kaimetsu 08-17-2003 11:33 AM

Quote:

Originally posted by Snakeandy7
When will KSI-GS be fineshed?.
*shrugs*

It's not unfinished. I might add to it later on, but it's mostly fine at the moment.


All times are GMT +2. The time now is 02:55 AM.

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