Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
This resource provides GUIers with the ability to benefit from something like SpellEffectEvent by Bribe
I would like to give full credit to Bribe for this system because it's entirely based on his SpellEffectEvent!
The performance gain is incredible.
What it does is use only one trigger to evaluate one spell trigger rather than a thousand.
I coded it in GUI-Jass, so it doesn't require JNGP.
The GUI-Jass idea is Bribe's as well
GUI creates the variables automatically, and if you use custom scripts for most of the code, it turns out to be just as efficient as Jass ^_^
GUI SpellEvent
Events
Conditions
Actions
Custom script: local integer i = 1
-------- - --------
-------- Call the initialization function. --------
-------- - --------
Custom script: call ExecuteFunc("InitSpellEvent")
-------- - --------
-------- Creating the hashtable. --------
-------- - --------
Hashtable - Create a hashtable
Set SpellEventHash = (Last created hashtable)
-------- - --------
-------- Over here, I'm just looping through all the abilities to be registered and saving the triggers in a hashtable. --------
-------- The only purpose of this is to automatically create the variables. --------
-------- - --------
Set SpellEventTrigger[0] = (This trigger)
Set SpellEventAbility[0] = Orb of Slow
-------- - --------
As you can see, this system is very short and easy to implement because all you have to do is:
1) Open up the trigger editor
2) Copy and paste the trigger to your map (Make sure you go to File >> Preferences and check "Create unknown variables when pasting trigger data")
3) Done!
SpellInit
Events
Map initialization
Conditions
Actions
-------- Set Abilities --------
Set SpellEventAbility[1] = Blizzard
Set SpellEventAbility[2] = MassTeleport
Set SpellEventAbility[3] = Summon Water Elemental
Set SpellEventAbility[4] = Holy Light
Set SpellEventAbility[5] = Resurrection
Set SpellEventAbility[6] = Divine Shield
-------- Set Triggers --------
Set SpellEventTrigger[1] = CastBlizzard <gen>
Set SpellEventTrigger[2] = CastMassTeleport <gen>
Set SpellEventTrigger[3] = CastSummonWaterElemental <gen>
Set SpellEventTrigger[4] = CastHolyLight <gen>
Set SpellEventTrigger[5] = CastResurrection <gen>
Set SpellEventTrigger[6] = CastDivineShield <gen>
-------- Run the Initialization Trigger --------
Trigger - Run SpellEvent GUI <gen> (ignoring conditions)
This will register your spells to the system. When a unit casts SpellEventAbility, SpellEventTrigger will run (while checking conditions in-case you need them.)
You don't need to check what ability is being cast in your spell trigger =)
You may not register more than one trigger for a spell.
If you really want two triggers to run, then the solution would be to execute the second trigger in the first line of the first trigger's actions. Either that, or you could merge the triggers. There are no obvious examples of how two triggers registered to the spell effect event for the same spell is the only way to go.
Make sure you run the SpellEvent GUI trigger only once.
Don't touch any of the custom scripts unless instructed to do so within the comments.
v1.0.0.0
Release
v1.0.0.1
Simplified Implementation by making all variables Auto-create.
Added some comments.
v2.0.0.0
The whole system is now in one trigger only.
Faster and better way of registering spells to the system.
Added more comments.
Fixed possible bug.
v2.1.0.0
You don't need the count variable during registration any more.
i try do that too, with 1 long line custom script for missile (if i ever could fix the problems)
i guess if i use jass where user dont must touch then it is still gui friendly
I like this more than Bribe's SpellEffect coz it doesnt require anything except variables ofc...unfortunately, I rarely make GUI spells, good job anyway Mags, for this I love you again ...
How is this resource not DC'd? Honestly such an amazing resource, way better then [self=http://www.hiveworkshop.com/forums/spells-569/summon-roflcopter-v0-3-a-185808/?prev=mmr%3D6]this useless resource[/self], and will be used in way, way more maps.
Thanks guys
This can't get a DC because it's not /awesome/ enough.
I do have another resource in this section worthy of a DC though
The update is going to be /outstanding/
edit
Actually, I still prefer SpellEffectEvent because it's super-easy-to-use
I just have to call RegisterSpellEffectEvent(ABIL_CODE, function thistype.run)
How is this resource not DC'd? Honestly such an amazing resource, way better then [self=http://www.hiveworkshop.com/forums/spells-569/summon-roflcopter-v0-3-a-185808/?prev=mmr%3D6]this useless resource[/self], and will be used in way, way more maps.
Maybe we should rename Director's Cut to "Staff Favorites". Because it's apparent that people think it means "Community Favorites". If you want to see the community favorites, view the "most popular" or "highest rated" spells.
I'll try to be a little more careful with my language
But maybe renaming dc to staff favorites would be a good idea. It seems like there are a lot of quality resources that should be in the DC zone but aren't. Also, spells have the least DC's of any category.
This is so useful especially when you have a map with a lot of spells (user-made) with low cooldown (such as making a mode to take off ability cooldowns).
1. Downloaded this.
2. Going to check it and import it.
3. ?????
4. Will get Reduced lag.
Me and my Co-Mapper have absolutely no clue how it manages to maintain instances of things like "Triggering Unit" in our custom spells once we converted to this system format, but by god it works and we like it.
5/5 for an amazingly simple and effective system, even if we can't for the life of us work out why it works.
Trigger:
---- event
---- condition
---- action
Trigger Execution instance:
---- triggering unit
---- triggering player
---- chatstring
---- chatstringMatched
---- dyingUnit
---- killingUnit
---- damageSource
---- eventDamage
---- itemManipulated
---- unitManipulating
etc...
When Event runs:
---- create new Trigger Execution data:
-------- set triggering unit for this instance
-------- set triggering player for this instance
-------- set chatstring for this instance
-------- set chatstringMatched for this instance
-------- set dyingUnit for this instance
-------- set killingUnit for this instance
-------- set damageSource for this instance
-------- set eventDamage for this instance
-------- set itemManipulated for this instance
-------- set unitManipulating for this instance
-------- etc...
---- if conditions are true
-------- do actions
But, the above only happens when an event runs.
If we execute a trigger, it only checks the conditions and then executes the actions.
See, what I did is register 1 trigger that runs when a spell effect event occurs
When a spell effect runs, I run only the trigger that corresponds to your spell.
Since the trigger in my system has the data for the triggering unit and such, that data
will be the same for any trigger you use because I'm executing it, not running it by the
event, so the data doesn't change, it uses the data that the parent trigger had
There's about 100ish custom spells, but they're cast by many units, and often many times per second. So while there's only about a 100ish triggers, the performance gain is noticeable.
Holy crap this is nice I'm definitely using this when i release any future spell packs. Would this help with a single cast trigger for a single spell? (with credit of course)
This would help for any spell that uses the event "A unit starts the effects of a spell".
The more spells you have in your map, the more this would help.
So it's been quite a few years now Mr. Magtheridon but this system of yours has withstood the test of time.
It's made it into my and co-mapper's "hall of fame" for systems, and we now use it in every single thing we make now in WCIII.
Previously we used it in a map with about 100ish custom spells, but now it's being used in a map with approximately 500 custom spells and "is attacked" triggers being used. The performance gain is pretty epic.
Edit: for future readers, I made this little snippet which you can use to replace Magtheridon's GUI SpellEvent if you are using GUI Spell System:
JASS:
function InitSpellEvent takes nothing returns nothing
local integer i = 1
loop
exitwhen udg_SpellEventAbility[i] == 0
set udg_Spell__Ability = udg_SpellEventAbility[i]
set udg_Spell__Trigger_OnEffect = udg_SpellEventTrigger[i]
call TriggerExecute(gg_trg_Spell_System)
set i = i + 1
endloop
endfunction
function InitTrig_GUI_SpellEvent takes nothing returns nothing
set gg_trg_GUI_SpellEvent = CreateTrigger()
call TriggerAddAction(gg_trg_GUI_SpellEvent, function InitSpellEvent)
endfunction
I didn't even know it affected performance having lots of the same events, so thank you for the wisdom aswell as for this wonderful solution
Edit: What can I do if I want to use starts the effect of an ability in general, without recognizing a certain ability? Is it possible?
For example if I'd wanna use it with a different condition
Events
Unit - A unit Starts the effect of an ability
Conditions
((Casting unit) has an item of type |c00EED0FFTome of Experience|r) Equal to True
So i have a question. It says one trigger one spell.
How can i write this trigger in the main InitTrigger View attachment 488329 Is it possible? View attachment 488330
I tried this way , but the trigger is triggering actions from any Affection Cast , not only the specific casted one. View attachment 488332
In this case, even if I trigger the level 5 cast, the level 6 will be triggered too.
EDIT : For some reason, it happened only once in the testings :/ View attachment 488333
The thing is that i have plenty of such cases, the question is , if the system will perform as intended if I write it down this way. (Asigning multiple Spells to one trigger - while having different conditions inside the trigger to check what spell fired)
Any particular reason? (just wondering what could go wrong if done in the way I tried above?) I have many triggers when same spells run one specific trigger - but there are different conditions in the trigger itself for each spell - to run various actions depending on the spell.
Nothing would "go wrong" but Spell System is mainly designed to work with single spells. You asked how to make the most of it. I see an opportunity to improve how you look at your code so it is easier to maintain.
One thing that I still have an issue with this is how it is reliant on registering every spell into one initialization which is not ideal for spells uploaded to spell section. I want to make this a dependency to improve speed for my GUI spells but this issue is preventing me from taking advantage of it.
I mean, I can always switch to Spell System for performance gain for OnEffect event but it feels overkill when I don't use Spell System extensive capability since I use Timed Special Effect for a per effect basis spell making approach
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.