Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Conversion to gs2? (https://forums.graalonline.com/forums/showthread.php?t=65209)

Raeiphon 04-05-2006 01:00 PM

Conversion to gs2?
 
NPC Code:

//#CLIENTSIDE
function onCreated() {
this.state = 0;
}

function onWeaponFired() {
setTimer(.2);
}

function onTimeout() {
showimg(200,light4.png,playerx+0.7-imgwidth(light4.png)/32,playery+1-imgheight(light4.png)/32);
changeimgvis(200,3);
changeimgcolors(200,1,.5,0,.9999);
drawoverplayer();
this.state=(this.state+1)%3;
changeimgzoom(200,1+.02*this.state);
setTimer(.2);
}



Doesnt work. At all, and I have NO idea why. It's meant to display a light effect over the player, but it's being a butch and not working. Could someone please explain to me why, so i dont give myself an aneurysm from the thinking.

ApothiX 04-05-2006 02:20 PM

Quote:

Originally Posted by Raeiphon
PHP Code:

showimg(200,light4.png,playerx+0.7-imgwidth(light4.png)/32,playery+1-imgheight(light4.png)/32); 


light4.png needs to be in quotes. and I think you should use the new 'imgwidth' and height functions, I think they're something like getimgwidth("filename")

Quote:

Originally Posted by Raeiphon
PHP Code:

drawoverplayer(); 


The changeimgvis call will make it draw over the player, this function is not needed/doesn't work in WNPCs.

Raeiphon 04-05-2006 06:34 PM

Okay, it works, but not as intended.

It isnt being drawn as light, and I want it drawn underneath the player. I've added drawaslight(); but that doesnt seem to work, and I cant figure out a way to toggle it when i call WeaponFired().

I appreciate the help!

Skyld 04-05-2006 06:50 PM

drawaslight() only affects the NPC's actual image, which in the case of a weapon NPC, is not at all useful.

You can modify where the image is displayed by changing it's layer, i.e. changeimgvis(index, 0); will draw underneath the player, 1 and 2 will draw above the player, 3 above the darkness (seteffect()) layer, 4 upwards on the GUI layer.

Problem is, is that drawing underneath the player will mean that the light effect is mostly shut out by any daynight-style system.

ApothiX 04-06-2006 02:27 PM

For drawing as a light you'd probably want to use changeimgmode() or something along those lines.


All times are GMT +2. The time now is 01:56 PM.

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