Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Err Help with this script (https://forums.graalonline.com/forums/showthread.php?t=64958)

Coolkid77742 03-26-2006 12:37 AM

Err Help with this script
 
Im trying to get my Item loaded on a server and will be like once this is fixed but why wont this work?
//#CLIENTSIDE
function onWeaponFired() {
this.active = !this.active;
if(this.active) {
replaceani("idle", "caenon-idle");
replaceani("walk", "caenon-walk2");
setani("swim", NULL);
} else {
replaceani("idle", "idle");
replaceani("walk", "walk");
setani("idle", NULL);
}
}

Its supposed to replace the players idle with Caenon-Idle and there walk with Caenon-Walk2 and when its unfired it goes back to normal?

Skyld 03-26-2006 12:52 AM

Is gscript2 enabled on the server?
Are the GANIs downloading properly? (Press F2 ingame)

Coolkid77742 03-26-2006 12:56 AM

No gs2 isnt cant u convert it?

Skyld 03-26-2006 12:58 AM

Quote:

Originally Posted by Coolkid77742
No gs2 isnt cant u convert it?

You will need to submit a support ticket at http://support.graalonline.com/ and request it before using the new engine scripting.

PeptoB 03-26-2006 12:58 AM

GS1:
PHP Code:

//#CLIENTSIDE
if (weaponfired){
unset 
this.active;
if(
this.active) {
replaceani idle,caenon-idle;
replaceani walk,caenon-walk2;
setani swim,;
} else {
replaceani idle,idle;
replaceani walk,walk;
setani idle,;
}



Yen 03-26-2006 12:58 AM

That's GS2.
It only works online.

Coolkid77742 03-26-2006 12:58 AM

thnxz

Coolkid77742 03-26-2006 01:18 AM

got a gs1 vers

Skyld 03-26-2006 01:22 AM

Quote:

Originally Posted by PeptoB
PHP Code:

unset this.active


Not quite.

this.active = !this.active; was used to toggle between true and false (!true == false, !false == true), not just to unset it.

ApothiX 03-26-2006 09:16 PM

Quote:

Originally Posted by Skyld
Not quite.

this.active = !this.active; was used to toggle between true and false (!true == false, !false == true), not just to unset it.

would be: this.active = 1 - this.active; or so.

protagonist 03-27-2006 02:28 AM

Quote:

Originally Posted by ApothiX
would be: this.active = 1 - this.active; or so.

Or something.

ApothiX 03-28-2006 12:59 AM

Quote:

Originally Posted by protagonist
Or something.

Or yourmom. Kekeke, I can be witty too.

Projectshifter 03-28-2006 02:43 AM

Quote:

Originally Posted by ApothiX
would be: this.active = 1 - this.active; or so.

I fail to see why this.active = !this.active wouldn't work? I'm actually rather impressed at the use of it, otherwise it's an annoying 4 line script or so to toggle.

Also instead of converting everything to the old engine, put in a support ticket and go for the new engine. It makes a lot more sense (plus it's more fun and a better learning experience) to do write everything in the new engine instead of converting it later.

Riot 03-28-2006 02:52 AM

Quote:

Originally Posted by Projectshifter
I fail to see why this.active = !this.active wouldn't work? I'm actually rather impressed at the use of it, otherwise it's an annoying 4 line script or so to toggle.

Also instead of converting everything to the old engine, put in a support ticket and go for the new engine. It makes a lot more sense (plus it's more fun and a better learning experience) to do write everything in the new engine instead of converting it later.

this.active = !this.active; does not work in GS1, they asked for a GS1 version of it. They were merely stating that.

ZeLpH_MyStiK 03-28-2006 04:18 AM

Oh no! Projectshifter is getting old!
this.active = (this.active + 1) % 2;
4 lines? try 4 - 3.

napo_p2p 03-28-2006 06:38 AM

Quote:

Originally Posted by ZeLpH_MyStiK
Oh no! Projectshifter is getting old!
this.active = (this.active + 1) % 2;
4 lines? try 4 - 3.

But this.active = 1 - this.active; is, like, more sekc.

BUT this.active = !this.active; is the sekciest of them all! <3 GS2.

Projectshifter 03-28-2006 07:01 AM

Quote:

Originally Posted by ZeLpH_MyStiK
Oh no! Projectshifter is getting old!
this.active = (this.active + 1) % 2;
4 lines? try 4 - 3.

Wow, maybe I am getting old :O I'm going to stop getting on my computer for the first 10 minutes after I wake up. Somehow the use of % totally slipped my mind. Good call though. I'm going to spend this week brushing up on gscript again.

ZeLpH_MyStiK 03-28-2006 08:42 PM

Quote:

Originally Posted by napo_p2p
But this.active = 1 - this.active; is, like, more sekc.

BUT this.active = !this.active; is the sekciest of them all! <3 GS2.

But modulus allows you to have more than 2 switch modes.
i.e.
NPC Code:

this.switch = (this.active + 1) % 3; // <-- 3 switches!
this.switch = (this.active + 1) % 4; // <-- or 4!



Quote:

Originally Posted by Projectshifter
Wow, maybe I am getting old :O I'm going to stop getting on my computer for the first 10 minutes after I wake up. Somehow the use of % totally slipped my mind. Good call though. I'm going to spend this week brushing up on gscript again.

You better! :O It's about time we started on N-Pulse: Improved!

ApothiX 03-30-2006 04:05 PM

Quote:

Originally Posted by ZeLpH_MyStiK
But modulus allows you to have more than 2 switch modes.
i.e.
NPC Code:

this.switch = (this.active + 1) % 3; // <-- 3 switches!
this.switch = (this.active + 1) % 4; // <-- or 4!


But negating the value of a boolean only allows you to have two modes, so I don't know why you're preaching modulus!


All times are GMT +2. The time now is 09:29 PM.

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