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 08-14-2003, 02:23 PM
ApeHex ApeHex is offline
Registered User
Join Date: Jun 2003
Location: USA
Posts: 72
ApeHex is on a distinguished road
Send a message via AIM to ApeHex
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
__________________
Reply With Quote
  #2  
Old 08-14-2003, 05:04 PM
VeX_RaT_Boy VeX_RaT_Boy is offline
WannaBe Scripter
VeX_RaT_Boy's Avatar
Join Date: Aug 2002
Location: Norway
Posts: 960
VeX_RaT_Boy is on a distinguished road
Send a message via ICQ to VeX_RaT_Boy Send a message via AIM to VeX_RaT_Boy Send a message via Yahoo to VeX_RaT_Boy
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.....
__________________
-Kjetil Valen
Reply With Quote
  #3  
Old 08-14-2003, 07:11 PM
ApeHex ApeHex is offline
Registered User
Join Date: Jun 2003
Location: USA
Posts: 72
ApeHex is on a distinguished road
Send a message via AIM to ApeHex
thanks man ;D

edit:
doesnt seem to work
;o
__________________
Reply With Quote
  #4  
Old 08-14-2003, 07:30 PM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
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
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote
  #5  
Old 08-14-2003, 08:16 PM
ApeHex ApeHex is offline
Registered User
Join Date: Jun 2003
Location: USA
Posts: 72
ApeHex is on a distinguished road
Send a message via AIM to ApeHex
;o
heh, im so used to using strtofloat on variables its getting kind of sad
;\
thanks for the help though


dach, where in missouri are you?
__________________
Reply With Quote
  #6  
Old 08-15-2003, 01:35 AM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
the hillbilly capitol of south st louis, jefferson county, *shudders*
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote
  #7  
Old 08-15-2003, 06:27 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
This code would benefit from adherence to KSI-GS.
__________________
Reply With Quote
  #8  
Old 08-15-2003, 11:35 AM
Snakeandy7 Snakeandy7 is offline
"Member ID=2610"
Snakeandy7's Avatar
Join Date: Mar 2003
Posts: 987
Snakeandy7 is on a distinguished road
Quote:
Originally posted by Kaimetsu
This code would benefit from adherence to KSI-GS.
When will KSI-GS be fineshed?.
__________________
"Freedom is best I tell thee
of all things to be won
then never live within the bond
of slavery my son".


Reply With Quote
  #9  
Old 08-17-2003, 11:33 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
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.
__________________
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:32 AM.


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