PDA

View Full Version : Gani - Emulate "Serverside" particle effects


samich
08-13-2014, 04:20 PM
I've read other posts and I just can't figure it out or get it right. I was wondering if anyone could possibly help me with getting particles to display through a gani (as I've heard, its possible to do) so that some of the effects will show on all players screens.

I've tried several attempts at getting them to display, but it always failed to show to all players.

I know you have to plug in SCRIPT ENDSCRIPT tags into the gani file, but as for displaying the gani, I just don't follow. I feel like maybe I've setup the effect wrong in the gani, such as how it should initialize and continue playing. I just want it to show after an onWeaponFired() call, and turn off after another call.

Simple this.on = !this.on weapon with a gani (for testing).

Any help is much appreciated!

Blah64
08-13-2014, 04:58 PM
are you setting attrs to the ganiscript?

samich
08-13-2014, 05:21 PM
No I'm not. How would I go about doing that?

Blah64
08-13-2014, 06:45 PM
To initialize the script, set a player's attr to the gani:

player.attr[1] = "name.gani";

scriptless
08-13-2014, 09:57 PM
To initialize the script, set a player's attr to the gani:

player.attr[1] = "name.gani";

I've seen this before. But can this pass gani params too? And what are the cords of this gani? If I did idle.gani for example would it align with my player in such a way that it looks like 1 gani or can u see both?

samich
08-14-2014, 01:29 AM
If anyone has a small example, I feel that would be the best way to go about it... I'm still a little confused on how to effectively do this.

Blah64
08-14-2014, 02:18 AM
I believe, sending params to the script is done:

player.attr[1] = "name.gani,param1,param2,param3,etc.";

then they are set as the params for onPlayerEnters() in the gani script.

As for 'player position', I don't think it actually sets the player's gani when you set the attr, you need to do setani() for that still. I might be wrong, but I think it just sets the script part of the gani, so you don't have to worry about it looking like multiple ganis.

example:

onActionProjectile()
{
player.attr[2] = "";
player.attr[2] = "display_hp.gani";
scheduleevent(2,"reset",null);
}

onReset()
{
player.attr[2] = "";
}


Note: I usually clear the attr to "" whenever I set the gani script because I remember there were issues with the script not updating if it was already running when you decide to set it again.

scriptless
08-14-2014, 03:30 AM
I believe, sending params to the script is done:

player.attr[1] = "name.gani,param1,param2,param3,etc.";

then they are set as the params for onPlayerEnters() in the gani script.

As for 'player position', I don't think it actually sets the player's gani when you set the attr, you need to do setani() for that still. I might be wrong, but I think it just sets the script part of the gani, so you don't have to worry about it looking like multiple ganis.

example:

onActionProjectile()
{
player.attr[2] = "";
player.attr[2] = "display_hp.gani";
scheduleevent(2,"reset",null);
}

onReset()
{
player.attr[2] = "";
}


Note: I usually clear the attr to "" whenever I set the gani script because I remember there were issues with the script not updating if it was already running when you decide to set it again.

I ment where is the attr[]'s gani position in relation to the player's position? In other word how does it know to display below, or above player?

Blah64
08-14-2014, 03:52 AM
There's nothing to display, it isn't displaying any actual 'gani'. It is just running the 'gani script', which is usually particle effects. The location of the particle effects are determined by the script, usually in relation to player.x/y and with setting the layer to determine whether it is above things or below things.

scriptless
08-14-2014, 05:19 PM
There's nothing to display, it isn't displaying any actual 'gani'. It is just running the 'gani script', which is usually particle effects. The location of the particle effects are determined by the script, usually in relation to player.x/y and with setting the layer to determine whether it is above things or below things.

Oh ok. Now I understand. I seen someone use a gani in an attr and it showed a gani wad why I asked. They must have used a gani script to show a gani. Explains alot.

Jakov_the_Jakovasaur
08-14-2014, 05:24 PM
Oh ok. Now I understand. I seen someone use a gani in an attr and it showed a gani wad why I asked. They must have used a gani script to show a gani. Explains alot.

its more efficient than using a gani scripted showimg();, plus since v6 you can set LAYER 0 in the text to force the gani to show below the player

scriptless
08-14-2014, 07:32 PM
its more efficient than using a gani scripted showimg();, plus since v6 you can set LAYER 0 in the text to force the gani to show below the player

In what text? The attrtext? Or as text in the file somewhere outside the script and scriptend tags?

Jakov_the_Jakovasaur
08-14-2014, 07:38 PM
In what text? The attrtext? Or as text in the file somewhere outside the script and scriptend tags?

as text within the gani file, like so:


LOOP
CONTINUOUS
SINGLEDIRECTION
DEFAULTHEAD
DEFAULTBODY
LAYER 0

samich
08-15-2014, 01:48 AM
I've tried so many test. I just can't get it.

samich
08-15-2014, 03:16 AM
Got it now! Thanks for the assistance blah! (I guess I'm more tired than I thought haha)

PiX
08-15-2014, 03:45 AM
For future references, this is how a particle emitter which follows the owner can be created in a gani file. Test by setting some attr of a player or npc to the gani file name including the file extension.

GANI0001
SCRIPT
function onPlayerEnters() {
with (findimg(200)) {
if (this.iscreated)
return;
x = player.x + 0.5;
y = player.y + 1;
attachtoowner = true;
with (emitter) {
delaymin = delaymax = 0.05;
nrofparticles = 1;
with (particle) {
lifetime = 1;
image = "block.png";
}
}
this.iscreated = true;
}
}
SCRIPTEND

If you want to put the effect into a gani which also has animation part, you can put everything SCRIPT through SCRIPTEND at the end of the gani file. If it does not work, check in a npc script or weapon script that the emitter portion of your script actually works. Sometimes the behavior of certain code in a gani script can be unexpected, so be aware.