Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Whats wrong with this (https://forums.graalonline.com/forums/showthread.php?t=18395)

Poogle 12-06-2001 08:11 AM

Whats wrong with this
 
Whats wrong with this script?
if (playerenters) {
toweapons *SpaceWars;
}
if (isweapon) {
disabledefmovement;
disableweapons;
disableselectweapons;
timeout = 0.1;
}
if (timeout) {
if (keydown(1)&&onwall(playerx-0.5,playery)) {
playerx = playerx-0.5;
playerdir = 0;
}
if (keydown(3)&&onwall(playerx+0.5,playery)) {
playerx = playerx+0.5;
playerdir = 0;
}
if (keydown(4)) {
putexplosion 1,playerx,56;
sleep 0.1;
putexplosion 1,playerx,54;
sleep 0.1;
putexplosion 1,playerx,52;
sleep 0.1;
putexplosion 1,playerx,50;
sleep 0.1;
putexplosion 1,playerx,48;
sleep 0.1;
putexplosion 1,playerx,46;
sleep 0.1;
putexplosion 1,playerx,44;
sleep 0.1;
putexplosion 1,playerx,42;
sleep 0.1;
putexplosion 1,playerx,40;
sleep 0.1;
putexplosion 1,playerx,38;
timeout = 0.1;
}

}

BocoC 12-06-2001 08:18 AM

What is the problem with it?

T-Squad 12-06-2001 08:21 AM

AHAHAHAHAAHA

Thats how I used to script when I first started...yes, yes, it is a scary sight to see.

Poogle 12-06-2001 08:22 AM

Quote:

Originally posted by BocoC
What is the problem with it?
the onwall doesnt work if goes over the tiles that block

Faheria_GP2 12-06-2001 10:51 AM

Re: Whats wrong with this
 
Quote:

Originally posted by Poogle
Whats wrong with this script?
if (playerenters) {
toweapons *SpaceWars;
}
if (isweapon) {
disabledefmovement;
disableweapons;
disableselectweapons;
timeout = 0.1;
}
if (timeout) {
if (keydown(1)&&onwall(playerx-0.5,playery)) {
playerx = playerx-0.5;
playerdir = 0;
}
if (keydown(3)&&onwall(playerx+0.5,playery)) {
playerx = playerx+0.5;
playerdir = 0;
}
if (keydown(4)) {
putexplosion 1,playerx,56;
sleep 0.1;
putexplosion 1,playerx,54;
sleep 0.1;
putexplosion 1,playerx,52;
sleep 0.1;
putexplosion 1,playerx,50;
sleep 0.1;
putexplosion 1,playerx,48;
sleep 0.1;
putexplosion 1,playerx,46;
sleep 0.1;
putexplosion 1,playerx,44;
sleep 0.1;
putexplosion 1,playerx,42;
sleep 0.1;
putexplosion 1,playerx,40;
sleep 0.1;
putexplosion 1,playerx,38;
timeout = 0.1;
}

}

you've never heard of a for-loop in your life

Saga2001 12-06-2001 11:59 AM

Re: Whats wrong with this
 
NPC Code:

if (playerenters) {
toweapons *SpaceWars;
timeout=.05;
}
while (timeout) {
disabledefmovement;
disableweapons;
disableselectweapons;
if (keydown(1)&&!onwall(playerx-0.5,playery)) {
playerx-=0.5;
playerdir=0;
}
if (keydown(3)&&!onwall(playerx+0.5,playery)) {
playerx+=0.5;
playerdir=0;
}
if (keydown(4)) {
this.mult=0;
}
if (this.mult<18) {
putexplosion 1,playerx,56-this.mult;
this.mult+=2;
}
sleep .05;
}



there ye go.

aesquivel 12-07-2001 08:20 AM

Re: Re: Whats wrong with this
 
Quote:

Originally posted by Saga2001
NPC Code:

if (playerenters) {
toweapons *SpaceWars;
timeout=.05;
}
while (timeout) {
disabledefmovement;
disableweapons;
disableselectweapons;
if (keydown(1)&&!onwall(playerx-0.5,playery)) {
playerx-=0.5;
playerdir=0;
}
if (keydown(3)&&!onwall(playerx+0.5,playery)) {
playerx+=0.5;
playerdir=0;
}
if (keydown(4)) {
this.mult=0;
}
if (this.mult<18) {
putexplosion 1,playerx,56-this.mult;
this.mult+=2;
}
sleep .05;
}



there ye go.


lolz nice script ;)

Saga2001 12-07-2001 12:36 PM

:-D
 
thanks you are ownage :D

entravial 12-08-2001 04:04 AM

~AlphaFlame~

Hey hey, Poogle... you know, they have this really really l33t thing called "commands.rtf", right? And, like, it has really cool commands that can shorten your scripts! I mean, it's so amazing... I think you should read it a few million times.

Saga2001 12-08-2001 05:49 AM

Quote:

Originally posted by entravial
~AlphaFlame~

Hey hey, Poogle... you know, they have this really really l33t thing called "commands.rtf", right? And, like, it has really cool commands that can shorten your scripts! I mean, it's so amazing... I think you should read it a few million times.

lol he should indeed, bah, i fixed his script and not even a thank you... :-/

btedji 12-08-2001 05:57 AM

timeout needs to be in the main loop

kyle0654 12-08-2001 06:50 AM

Re: Re: Whats wrong with this
 
NPC Code:

if (playerenters) {
toweapons *SpaceWars;
}

if (created&&isweapon) {
disabledefmovement;
disableweapons;
disableselectweapons;
timeout=.05;
}

/* moved everything to the block above
this text, since it would just timeout on
the in-level script and not the weapon
script. */

if (timeout) {
if (keydown(1)&&!onwall(playerx-0.5,playery)) {
playerx-=0.5;
playerdir = 0;
}
if (keydown(3)&&!onwall(playerx+0.5,playery)) {
playerx+=0.5;
playerdir = 0;
}
if (keydown(4)) {
this.mult=0;
}
while (this.mult<18) {
putexplosion 1,playerx,56-this.mult;
this.mult+=2;
sleep .1;
}
timeout = .05;
}


Still kinda ugly, but easy to read. I still think you should have figured that out yourself by troubleshooting...the original problem was just a missing ! in front of the onwall() functions.

Falcor 12-08-2001 07:03 AM

and uhm... when you get an npc weapon, the playerenters and create flags are sent to it so you could just do in the created area, the timeout loop =\


All times are GMT +2. The time now is 07:20 AM.

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