PDA

View Full Version : SendAppearanceEffect Endlessly Looping


zerjz3
11-13-2014, 12:55 PM
Yesterday I discovered SendAppearanceEffect , thought it was super cool (still do) and started thinking of all the things I could do with it. My idea was to create invisible, untargetable NPCs to add particle effects to certain areas of certain zones.

This looks awesome, but I've encountered a problem with it that hopefully is caused by the way I scripted this. The particle effect seems to endlessly loop, spawning itself over and over and over again until my nice looking particles become a jumbled mess of lag.

Included are some pictures to show what I mean, and also the script I am using to spawn the particle effects.

http://i59.tinypic.com/f3ytk6.png

http://i60.tinypic.com/69ib09.png


sub EVENT_SPAWN
{
$npc->SendAppearanceEffect(389);
}
}

zerjz3
11-13-2014, 01:21 PM
I solved this on my own, by coding it as such:

sub EVENT_SPAWN
{
quest::settimer("Effect", 1);
}

sub EVENT_TIMER
{
if($timer eq "Effect")
{
$npc->SendAppearanceEffect(346);
quest::stoptimer("Effect");
}
}

zerjz3
11-13-2014, 01:30 PM
On second thought, this effect disappears when leaving the zone and then coming back. Is there any way to keep these particle effects from disappearing when someone leaves the zone?

Akkadius
11-13-2014, 03:40 PM
Here is a solution to your issue.

When Trevius originally got this packet working he made it so there was an option to send these to an individual client.

So, assuming that your particle is 'static' as in, you send it once it stays for the client, this is what you can do.

Initially, send your particle packet just like you are with the NPC as it is.

And then for clients that zone in, you will need to send the particle to them so that they get the static particle spawned on their screen as well, BUT you only want to send it to that specific client so that you don't have the overlapping particle mess appear on other clients.

Perl_croak(aTHX_ "Usage: Mob::SendAppearanceEffect(THIS, parm1, parm2, parm3, parm4, parm5, singleclient)");

So, how does this end up looking? You need to get a little fancy and control the NPC from the player script.

Something like this.

player.pl
sub EVENT_ENTERZONE{
#::: Make sure your npc_id is your particle npc (Assuming it is unique and there arent multiple of the same NPC)
$entity_list->GetNPCByNPCTypeID(npc_id)->SendAppearanceEffect(346, 0, 0, 0, 0, $client);
}

So to break down what I'm doing, I'm fetching the entity with the entity_list method which means I can then cast methods to it like if I was performing commands on it via the NPC's script.

Does that make sense?

zerjz3
11-13-2014, 05:15 PM
Yes, Akka, that makes perfect sense. I am slowly but surely getting the hang of this stuff. Great learning experience! Thanks for your help, you rock.

Uleat
11-13-2014, 05:49 PM
That thing was starting to show signs of life...