Graal Forums

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

Spark910 07-13-2002 04:07 AM

Lantern
 
Here what I have, door.png for a test...

NPC Code:

if (playertouchsme) {
toweapons Lamp;
}
if (weaponfired) {
if (!client.on) {
set client.on;
replaceani idle,lamp_idle;
replaceani walk,lamp_walk;
timeout=.05;
}
}

else
{
unset client.on;
replaceani idle,idle;
replaceani walk,walk;
hideimg 023;
}
if (timeout) {
if (client.on) {
showimg 023,door.png,playerx,playery;
timeout=.05;
}
}




Whats wrong, it dont show up!?

Python523 07-13-2002 04:44 AM

for one, to shorten the script for the on/off part, use something like
this.on=abs(this.on-1);
if(this.on==1){
//stuff
}
also, you sure the showimg part is right? try setting a drawing height
and
right now the else statement is unsetting the flag if something other than weaponfired happened

user13-xo 07-13-2002 01:51 PM

Re: Lantern
 
Quote:

Originally posted by Spark910
Here what I have, door.png for a test...

NPC Code:

if (playertouchsme) {
toweapons Lamp;
}
if (weaponfired) {
if (!client.on) {
set client.on;
replaceani idle,lamp_idle;
replaceani walk,lamp_walk;
timeout=.05;
}
}

else
{
unset client.on;
replaceani idle,idle;
replaceani walk,walk;
hideimg 023;
}
if (timeout) {
if (client.on) {
showimg 023,door.png,playerx,playery;
timeout=.05;
}
}




Whats wrong, it dont show up!?

try 23 instead of 023?

MrGannondorf 07-14-2002 02:54 AM

whas the "client." part do? is it like "server." effects flags and strings?

Torankusu 07-14-2002 06:44 AM

Quote:

Originally posted by MrGannondorf
whas the "client." part do? is it like "server." effects flags and strings?
"client." is like a "local." flag.

Stored in the user's account, able to be changed by the client, and read by the server.

I think..

Shiftk03- 07-14-2002 03:28 PM

Quote:

Originally posted by Kaimetsu


Difference is that local.stuff isn't sent to the server.

Thats why they shouldn't be confused with each other.

Spark910 07-14-2002 04:06 PM

Quote:

Originally posted by Kaimetsu
Grim Squeaker:

The "weaponfired" flag can never return false, though Graal might read your timeouts as a false weaponfired, thus unsetting the client.on flag.
Just move the else part to be after the if (!client.on) instead.

You don't need to set a drawing height for showimg, if you don't set one it automattically get's set to a drawing height of 2.

He was the one that helped the most, Thankyou! And thanks to the rest of you for trying to help.. Ill get full code done with working lights in 20mins and give it out for you all...

Spark910 07-14-2002 04:33 PM

Damn still stuck, the index of light 2, i cant get it to set lighteffect of 023 index,

NPC Code:

if (playertouchsme) {
toweapons bob;
}
if (weaponfired) {
if (!client.on) {
set client.on;
replaceani idle,lamp_idle;
replaceani walk,lamp_walk;
timeout=.05;
}
else
{
unset client.on;
replaceani idle,idle;
replaceani walk,walk;
hideimg 023;
}
}
if (timeout) {
if (client.on) {
showimg 023,light2.png,playerx-1,playery-1.5;
changecoloreffects 023,1,0,0,0; //Unknown Command?
drawaslight;
dontblock;
timeout=.05;
}
}



Also t does not reconise this command, what other ways can you do it:

NPC Code:

changecoloreffects 023,1,0,0,0; //Unknown Command?


Spark910 07-16-2002 06:48 PM

Quote:

Originally posted by Kaimetsu
Grim Squeaker:

The actual command is changeimgcolors.

Why thankyou! =D

Nearl;y done now, just getting perfect coloring....


All times are GMT +2. The time now is 10:47 PM.

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