HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Adding One-shot special effect.

03-27-2004, 12:28 PM#1
Alfryd
Specifically, I'd like to have the 'Gold credit' special effect play for a unit, without needing to go back later and explicitly remove it. Is there some simple function for this?
03-27-2004, 12:53 PM#2
MMad
Quote:
Originally Posted by Alfryd
Specifically, I'd like to have the 'Gold credit' special effect play for a unit, without needing to go back later and explicitly remove it. Is there some simple function for this?

The Jass Vault has a function which will probably be exactly what you're looking for:

http://kattana.users.whitehat.dk/viewfunc.php?id=31

This is, obviously, in JASS. Doing it in the GUI isn't feasible. You could easily import the function even if you're doing the rest of your coding in the GUI, though..
03-27-2004, 01:40 PM#3
MMad
Quote:
Originally Posted by MMad
This is, obviously, in JASS. Doing it in the GUI isn't feasible. You could easily import the function even if you're doing the rest of your coding in the GUI, though..

EDIT: Ok, I just realized that since this is in the AI/JASS forum that might be a slightly silly comment.. :)
03-27-2004, 02:45 PM#4
Cubasis
Just felt like pointing you at this thing that KaTTaNa compiled: http://www.wc3campaigns.com/showthread.php?t=51430

It has alot of the functions from the Jass Vault in GUI-usable form. Just be careful to not use it with UMSWE at the moment.

Cubasis
03-27-2004, 08:41 PM#5
Alfryd
Not to worry. JASS will do fine. :) But I'm afraid that function won't do the job if I create several special effects in short order (since it's using the Blizzard.j 'last created special effect' variable.) What about.. ah...

call AddSpellEffectByIdLoc(maj_GOLDSPAWN_ABILITY_ID, EFFECT_TYPE_SPECIAL, GetUnitLoc(inn))

If I set maj_GOLDSPAWN_ABILITY_ID to that of an ability that uses the Gold Credit animation, will that play once or over and over again?
I realise I should probably just shut up and test it myself, but I might miss something...
03-27-2004, 09:37 PM#6
Cubasis
Erhm, actually that function works great for most occasions. If you'd look closer, you'd see that it just uses it to move the SFX too it's child into a local variable there. So no matter how often you call it in a row, the only limit you'd have is a graphical/memory one, heh.

But your solution would likely work great.

Cubasis
03-28-2004, 10:42 AM#7
Alfryd
Quote:
Originally Posted by Cubasis40
Erhm, actually that function works great for most occasions. If you'd look closer, you'd see that it just uses it to move the SFX too it's child into a local variable there. So no matter how often you call it in a row, the only limit you'd have is a graphical/memory one, heh.

Oops. Mea Culpa. I have this kind of instinctive aversion for all things blizzard.j related... just wasn't paying attention.
03-28-2004, 12:01 PM#8
Cubasis
Sure, you should, blizzard.j is the death of all! :P

Nah, jk, but we Jass Coders generally stay away from most of its function, except good math ones, like ModuloInteger and stuff.

Cubasis
03-28-2004, 01:55 PM#9
Vexorian
Certain Effects work well with call DestroyEffect(AddSpecialEffect("blah\\bleh.mdl",x,y) )

And a good solution in gui is :

Destroy Effect
Events: none
Conditions:none
Actions:
Custom Script: local effect udg_todestroy=bj_lastCreatedEffect
Wait (effectduration) game time seconds
Destroy Effect - todestroy

Have a special effect variable called todestroy , a real variable called effectduration

and after creating a effect do this

Create Special effect at ....
set effectduration = (the duration of the effect)
Trigger run Destroy Effect <gen>
03-28-2004, 04:55 PM#10
Cacodemon
You can use one Warcraft bug to display non-repeating effects!

Just Use this syntax: call DestroyEffect(CreateEffect...())

YES, IT WORKS! Effect is displayed! If special effect has non-repeating animanion, it will be displayed then destroyed. For effects with repeating animation you should use another algorythms.

This is very, very useful!
03-28-2004, 06:00 PM#11
Cubasis
Lol caco :)

Vex already told this in his post :P, but as he also said, it only works for some (well, most), some other effects don't show at all if you do that. I'm not sure why. I may play with it a bit later.

Cubasis