• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[GUI-friendly] Advanced Buff Engine

[GUI-Friendly] Advanced Buff Engine
System Requirements

GABE is an extension of GTS that facilitates creation and management of unit buffs. It maintains a list of buffs for each unit on the map, allowing you to iterate over the buffs that a unit has, or count how many buffs of a certain type are present on a unit. The list of buffs is maintained by GLL, from my Data Structures project.

GABE is a powerful system built from simpler modules, therefore it has quite a few requirements. However, you will probably already be using a unit indexer and GTS is a useful system for GUI users which you might find applications for. Furthermore, you will probably find that GABE fits all your needs for a Buff system that is extremely customizable and efficient, so importing all the requirements is likely to be worth the trouble.

Since this system is made with GUI users in mind, as well as JASS users, it employs GUI Unit Event by Bribe as its unit indexer. However, it is compatible with other unit indexers, but you must delete the unit registration and deregistration trigger and replace it with one that uses the API of your preferred unit indexer.

Buff:

Each buff created with this system is, in fact, a timer. Therefore, the system uses the GTS_Hashtable instead of emplying its own separate Hashtable. From now on, buffs created with this system will be referred to as "buffs" and normal buffs created by the object editor will be referred to as "wc3 buffs".

You can specify a buff type for each buff, which is an integer value. Abilities and wc3 buffs are also integers, so the buff type of a buff can be an ability or wc3 buff. For more information, see the "Using the System" section.

You can specify two units for each buff: 1 target unit and 1 source unit.

Finally, you can specify a duration for your buff.

Each buff has its own unique ID, which is the handle ID of its timer (an integer), and is usually stored in the variable "GTS_CustomValue".

You can specify two triggers for each buff: 1 trigger that runs when the buff is dispelled and another that runs when the buff's timer expires.


How to Import:
  1. Open World Editor. File -> Preferences -> Tick box for "Automatically create unknown variables (...)"
  2. Copy the text in this map header into the map header of your own map
  3. Copy the trigger category "GUI MUI Engine" into your map
  4. Done!
Using the System:



Add Buff to Unit




  • Actions
    • -------- We set this to 0 because we want to create a new buff --------
    • Set GTS_CustomValue = 0
    • -------- This integer represents the Buff Type of the new buff --------
    • Set GABE_BuffType = YourInteger
    • -------- This is the unit who is creating the buff --------
    • Set GABE_Source = (Triggering unit)
    • -------- This is the unit who is receiving the buff --------
    • Set GABE_Target = (Triggering unit)
    • -------- This is the duration of the buff --------
    • Set GTS_TimeOut = 5.00
    • -------- This is the trigger which gets executed when the buff expires --------
    • Set GTS_Trigger = Sprint End Copy <gen>
    • -------- This is the trigger which gets executed when the buff is dispelled --------
    • Set GABE_DispelTrigger = Sprint End Copy <gen>
    • -------- Finally, we run the system's main trigger --------
    • Trigger - Run GABE Main <gen> (ignoring conditions)



Test Map:


Command

Action

kill

Kills and removes from the game your selected units.

The Test Map has 3 coded unit indexers, each one working separately for Footman, Rifleman and Knights. Thus, each unit indexer recycles indexes separately and has its own Recycle Key. Check out the triggers to see how Recycle Keys work.

Updates and Version History:
v1:
1.0.0 > Initial Release
2.0.0 >
API change: all functions now include "GMUI_" prefix.
Added GMUI_Initialize function
Upcoming:
Credits:

Vexorian -> vJass struct recycle algorithm

Attachments

  • Guhun Advanced Buff Engine.w3x
    60.5 KB · Views: 23
Last edited:
Top