![]() |
Scripted ani+show ani destroy itself..
I have a scripted ani being shown by a weapon NPC.
I want that ani to hide itself after it's finished (i tried destroy() in the ani but it didn't work) so I thought I could do something like: PHP Code:
PHP Code:
Is what I want to do possible? |
I'm not too sure if that would work. However, to be sure I'd make the
HTML Code:
if (this.count == 100) { HTML Code:
if (this.count => 100) { |
I actually had that, but I thought that might have been the cause of the access violation, if it looped round again it will try to hide the image again. It doesn't make any difference, still gives access violation :(
|
Is the object to follow a player? What's the objects purpose?
|
It stays exactly where it's placed.
It's a fire ani I scripted, it 'burns out' after 100 timeouts. I can hide the stuff created by the ani but not the actual ani placed by the weapon/ It's displayed serverside using ids <200. |
Ah, why're you displaying it serverside? Some kind of damage effect I assume.
I would've thought that destroy inside the gani would have done it, but you've already tried that. Weird. |
Make sure "weapon" isn't trying to modify the image/gani in any way after hiding.
Also, I think this.indexnum should be thiso.- ? |
You're right, it should be thiso I changed that and it still causes an access violation when hideimg is called. All the weapon NPC does is show the ani, it doesnt do anything else with it.
|
It should not hide itself, that's not working right now, and doesn't make a lot of sense in gani scripts anyway since it's running on each client and you only want to hide it on the client/server that controls the object. Just let the gani script stop displaying something and let a weapon or npc control the showing/hiding of the gani script attr[] (or showimg).
|
Hmm, I've had this problem before (Float text), where when the player is hurt, it places a gani at the players location with showani( ... );
but sometimes they randomly appear around inside levels or gmaps, like they have just been temporaly hided or something.. anyone know how to destroy them (removing them from the level or something)? |
Well I'm at school now so I can't test this for now.
You could get the object of the gani and join it to a class that destroys itself after a time limit. |
Yes, I had that but it caused major server lag.
I made a flamethrower weapon which sets light to places it touches :P making the fires putnpc2 caused huge lag even though they destroyed after 3 seconds. Weirdly, it wasn't just when they were on screen. Even if they'd all been destroyed, the lag would grow every time a new fire was started. |
Eventually the npc was only hidden and not really destroyed ? Normally putnpc2 should not lag a lot
|
It seems like the NPC is not actually being destroyed. I'm calling destroy() on it and eventually after the weapon has been used a lot it causes lag.
If i /clearnpcs overworld.gmap the lag stops until the weapon has been used a lot and it causes lag again. |
Quote:
|
ah! You're right. It's being created serverside but destroyed clientside. I'll try destroying it serverside and see if it fixes it. :)
Edit: Thanks! That seems to have been my problem :D |
I'd recommend something like
HTML Code:
function onCreated() |
Quote:
(Trying to destroy them from the gani) |
Quote:
Make the damage display a player.attribute. Remove the attribute once it's been used. |
Quote:
No experience at that area, the ganises with player.attrs :] |
Quote:
HTML Code:
function onActionclientside(curOption, curMessage) |
Quote:
Still not getting the player.attr[] stuff :[ Got any easier examples? |
Quote:
HTML Code:
//#CLIENTSIDE HTML Code:
//#CLIENTSIDE choose a gani from inside of your graal folder, which is a solid object for example. Edit: I'll write a few documents explaining the advantages to using player attributes. :) |
Quote:
hmm, just one more thing.. on my server some weapons are faster, so alot of flaot texts will come.. so must I use a new player.attr for each flaot text, or can I use an existing attr more ganises? |
Hmmm on Kingdoms we do it so that on serverside we set some player.attr[] to the gani script which displays the hp loss / damage taken. In the gani script onPlayerEnters() it emits a particle with "emitter.continueafterdestroy = true;" so the particle is continuing to move even if the gani script is deleted or restarted. To get several effects using the same gani script there are probably two says:
1. make the gani script being restarted, this can be done by setting the attr[] to "" and then setting the value again (it should be sent again and restart the script if it's not a CONTINUOUS gani, although I have not tested this fully yet) 2. store the actual data that should be displayed into another attr[] and in the gani script check if that data is changed and display another text or effect, let the gani script check for new data until it is removed (by using a 0.05 seconds timeout or so) |
Quote:
|
Quote:
|
Quote:
Why would you want to do that? |
Quote:
emitter.particle.text or emitter.particle.code |
All times are GMT +2. The time now is 03:54 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.