Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Onwall Detection (https://forums.graalonline.com/forums/showthread.php?t=790)

Grey_Mage 03-31-2001 07:50 AM

How would you make onwall detection for this script?



if (created||timeout) {
if (this.active==1) {
//movement script
if (keydown(0)) {
playery-=0.5;
playerdir = 0;
}
if (keydown(1)) {
playerx-=0.5;
playerdir = 1;
}
if (keydown(2)) {
playery+=0.5;
playerdir = 2;
}
if (keydown(3)) {
playerx+=0.5;
playerdir = 3;
}
setani fglev,l;
disabledefmovement;
}
//Activating or deactivating script.
if (keydown(4)) {
if (this.pressed==0) {
enabledefmovement;
if (this.active==0)
this.active=1;

else

this.active=0;
this.pressed=1;

this.pressed=1;
}
}
else {
this.pressed=0;
}
timeout = 0.05;
}

Thak2 03-31-2001 09:06 PM

You could change your movement things so they look like this:
NPC Code:

if (keydown(1)&&!onwall(playerx,playery+1.5) {
playerx-=0.5;
playerdir = 1;
}



the playerx, and playery+1.5 are the co-ordinates where it looks to see if its onwall, do same for other directions, changing the co-ordinates of the onwall for each... or you can add something like this:
NPC Code:

if (keydown(1)&&onwall(playerx,playery+1.5) {
playerx+=0.3;
playerdir = 1;
}


this'll just bounce him back if in the wall, but youll have to have the original movement script as well.


Grey_Mage 03-31-2001 11:08 PM

Thx
 
Thanks that worked!
ummmmmm... How would you make it do ollieskateboard.gani while on it like press S and it plays it and then goes back to skateboard.gani... fir the same script... When I tried it it froze me...

Thak2 04-02-2001 12:46 AM

I cant remember what keydown s is... maybe 5? If wrong just change it... also, for this to work you will have to have disabledefmovement on
NPC Code:

if (keydown(5)&&timeout) {
setani ollieskateboard,;
// have the gani not loop, and get the aproximite time of it for the following sleep
sleep 1;
setani skateboard,;
}



There, thats a simple way, also if you wanted you could at params to the gani to make diffent style skateboards and colours... just a thought :)

RawPower 04-02-2001 01:13 AM

>=\\
 
You copied our skateboard !

Thak2 04-02-2001 09:46 AM

Grey_Mage did? bad...

Cloud_X 04-04-2001 12:57 AM

Stop stealing shadrock's gani's!
Only i can do that i mean ummm.....*runs away*

Grey_Mage 04-05-2001 07:43 AM

Nah!
 
Nah I didn't steal your skateboard I am trying to make one from scratch!


All times are GMT +2. The time now is 04:38 PM.

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