Graal Forums

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

Merlin 09-27-2001 05:42 AM

Improving..
 
well i was working on this to make the speed of player faster but not go on walls well it works but sometimes you get stuck on a wall..
if anyone can help improve i'd appreciate it, thanks.

// NPC made by Merlin
//9-26-01
//speed up
if (playertouchsme) {
toweapons Boot-Test;
this.mode = 0;
}
if (weaponfired) {
if (this.mode==0) {
setplayerprop #c,Boots off;
this.mode=1;
timeout = 0;
}
elseif (weaponfired) {
if (this.mode==1) {
setplayerprop #c,Boots on;
timeout = .5;
this.mode = 0;
}
}
}
if (timeout) {
timeout = .1;
}
if (timeout) {
if (keydown(0)) {
if (this.mode==0) {
if (!onwall(playerx,playery)) {
playery--;
timeout = .1;
}
}
}
}
if (timeout) {
if (keydown(2)) {
if (this.mode==0) {
if (!onwall(playerx,playery)) {
playery++;
timeout = .1;
}
}
}
}
if (timeout) {
if (keydown(1)) {
if (this.mode==0) {
if (!onwall(playerx,playery)) {
playerx--;
timeout = .1;
}
}
}
}
if (timeout) {
if (keydown(3)) {
if (this.mode==0) {
if (!onwall(playerx,playery)) {
playerx++;
timeout = .1;
}
}
}
}
if (playerenters||created) {
if (this.mode==1) {
timeout = .1;
}
}

BocoC 09-27-2001 06:09 AM

Onwall is not a scripter's best friend. But, with my Super-Duper-Awesome-Mega-Onwall-Routine© code, you hit those onwalls on the nose! =P I would have to extract the code and port it to a version which would work for your situation, though.

KJS 09-27-2001 06:20 AM

Re: Improving..
 
sorry to say but your code is the devil...

you have a lot of usless coding...

mabie try this
NPC Code:

if(playertouchsme)
toweapons Boost-up;
if(isweapon&&playerenters)
timeout=0.1;
if(weaponfired)
this.on=1-this.on;
if(timeout&&this.on==1){
for(this.i==0;this.i<4;this.i++) if(keydown(this.i))
if(!onwall(playerx+1.5+vecx(playerdir)*2,playery+1 .5+vecy(playerdir)*2)&&!onwater(playerx+1.5+vecx(p layerdir)*2,playery+1.5+vecy(playerdir)*2)){
playerx+=vecx(playerdir);
playery+=vecy(playerdir);
}
}



try that out... (the onwall and onwater code isn't the best but oh well)...

nyghtGT 09-27-2001 08:05 AM

kool
 
yours is pretty kool (at KJS)

better than i would do ... i am still just starting to get onwall and onwater used properly

KJS 09-27-2001 06:56 PM

Re: Re: Re: Improving..
 
Quote:

Originally posted by Kaimetsu


Yours has a couple of inefficiencies. Try this.on=1-this.on.

humm intresting I have never though of making anything that way befor...

Shard_IceFire 09-27-2001 08:40 PM

lol i'm not even gonna try posting my peddly little script.

Riot-Starter 09-27-2001 11:31 PM

Re: Re: Re: Improving..
 
Quote:

Originally posted by Kaimetsu


Yours has a couple of inefficiencies. Try this.on=1-this.on.

that never works for me i just use:
this.on=(this.on+1)%2

LiquidIce00 09-28-2001 12:26 AM

Re: Re: Re: Re: Re: Improving..
 
Quote:

Originally posted by Kaimetsu


Ack, no! Do not use something so inefficient!

whats the big diference ?
its 1 little line of code that doesnt really matter =\
in real programming it matters if u do a for loop or while loop .. cuz they work faster then the other and differently.. but something so simple =\
you people are weird

Sep3kP2P 09-28-2001 01:10 AM

kjl, u got that onwall crap from newfeatures2001, and it doesnt eve work right =/ if u hold down like up and left u can go thru blocks (at least i could)

KJS 09-28-2001 02:45 AM

Quote:

Originally posted by Sep3kP2P
kjl, u got that onwall crap from newfeatures2001, and it doesnt eve work right =/ if u hold down like up and left u can go thru blocks (at least i could)
first off I didn't get it from newfeatures...

do you know what

playerx+1.5+vecx(playerdir)*2 does?

playerx+1.5 is right in the middle of the player

then vecx*2 = -2, 0, 2

so

(middle of player)+2 or -2

that will get the block right infront of the player....

(and like I said the onwall script isn't the best)...

I didn't feel like making a complex onwall script (I just gave the basic code merlin can do the rest of the touch ups like for onwall and ect)

Cybnext_Design 09-28-2001 03:06 AM

Quote:

Originally posted by Sep3kP2P
kjl, u got that onwall crap from newfeatures2001, and it doesnt eve work right =/ if u hold down like up and left u can go thru blocks (at least i could)
It might look like its from newfeatures, but most scripts that use that kind of check ends up looking just like it.

Xaviar 09-28-2001 04:23 AM

Quote:

Originally posted by Cybnext_Design


It might look like its from newfeatures, but most scripts that use that kind of check ends up looking just like it.

What?? *confused* How would you even connect that in your mind with newfeatures.txt?? :confused:

Cybnext_Design 09-28-2001 05:47 AM

Quote:

Originally posted by Xaviar

What?? *confused* How would you even connect that in your mind with newfeatures.txt?? :confused:

Sep3kP2P said that part of KJL's script was taken out of newfeatures2001.txt, but all of the scripts that use vecx/vecy for onwall/triggeraction/etc end up looking the same.

Xaviar 09-28-2001 08:15 AM

Quote:

Originally posted by Cybnext_Design


Sep3kP2P said that part of KJL's script was taken out of newfeatures2001.txt, but all of the scripts that use vecx/vecy for onwall/triggeraction/etc end up looking the same.

Hehe...Wow..Thats getting pretty lame to copy script straight out of the examples in newfeatures2001.txt...

Sep3kP2P 09-28-2001 08:27 AM

the net script is in newfeatures2001.txt

Xaviar 09-28-2001 08:30 AM

Quote:

Originally posted by Sep3kP2P
the net script is in newfeatures2001.txt
Truly? *slaps forehead* Huh...But thats still pretty lame

btedji 10-03-2001 04:44 AM

if the players x is not a multiple of .5 like when you go along a side of a opject and your x,y gets a wierd decimal if believe that would screw up the onwall thing you listed above


All times are GMT +2. The time now is 12:40 PM.

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