• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Getting information from object editor

Status
Not open for further replies.
Level 5
Joined
Jul 15, 2012
Messages
101
Is there a way I could get, let's say, a spell's cooldown, or any other stat, into a variable? Or modify the spell's cooldown with triggers/scripts, if not, maybe with some world editor's extension?
 
Yes. Which system do you want to get it in?
HiveWE and PitzerMike have C++ implementations of the parsers that will load the W3O object files and SLKs.
PitzerMike's code is hard to find, though.

The Wurst guys have a Java API for reading and writing the necessary data.
I also have my own Java transcription of the PitzerMike code.

There was also a way to manipulate this data using lua scripts in JNGP if you have an old version of the game. That was powered by PitzerMike's C++ under the hood, if I understood correctly how that stuff worked back then.

---

Now, if you want to load these values from within the Trigger Editor, then there is not really a way. There used to be a tool called ODE that would make it possible, kind of. It allowed you to use pretend functions like "GetUnitMaxLife" or "GetAbilityCooldown" in the JASS code in your Triggers. But the setup was difficult and there are no such functions. So whenever you saved the map, then ODE would replace these functions with the values from the map data. This is a dead-end system that doesn't work well for complicated Trigger code, I don't think, but I did not use it very much. It is generally a dead project now, I think?
 
Specified on cooldown you are lucky because of new natives!

JASS:
native UnitResetCooldown           takes unit whichUnit returns nothing // old native actually

native BlzGetAbilityCooldown                       takes integer abilId, integer level returns real
native BlzSetUnitAbilityCooldown                   takes unit whichUnit, integer abilId, integer level, real cooldown returns nothing
native BlzGetUnitAbilityCooldown                   takes unit whichUnit, integer abilId, integer level returns real
native BlzGetUnitAbilityCooldownRemaining          takes unit whichUnit, integer abilId returns real
native BlzEndUnitAbilityCooldown                   takes unit whichUnit, integer abilCode returns nothing
For reading an ability's coldown the BlzGetAbilityCooldown can get interesting for example, see demo attached.

  • Blizzard Natives
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set ObjectId = (Ability being cast)
      • Set AbilityLevel = (Level of ObjectId for (Triggering unit))
      • -------- ------------------------------------------------------------------------------------------------------------ --------
      • Custom script: set udg_ObjectData_String = R2S(BlzGetAbilityCooldown(udg_ObjectId, udg_AbilityLevel))
      • -------- --------------------------- --------
      • Game - Display to (All players) for 60.00 seconds the text: (Casted Ability's cooldown is: + ObjectData_String)
You can check the current common.j to check for existing natives.

======

Anyways, @TriggerHappy made also a nice Tooltip Hack to read (mostly numerical) object editor fields dynamically. In this "read cooldown" case the tooltip trick works fine, and it would also work for many other numerical fields. You also can see demo attached.

  • Tooltip Approach
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set ObjectId = (Ability being cast)
      • Set AbilityLevel = (Level of ObjectId for (Triggering unit))
      • Set ObjectFieldCode = (Cool + (String(AbilityLevel)))
      • -------- ------------------------------------------------------------------------------------------------------------ --------
      • Custom script: set udg_ObjectData_String = R2S(GetObjectFieldReal(udg_ObjectId, udg_ObjectFieldCode))
      • -------- --------------------------- --------
      • Game - Display to (All players) for 60.00 seconds the text: (Casted Ability's cooldown is: + ObjectData_String)
 

Attachments

  • Read Ability Cooldown.w3x
    14.9 KB · Views: 26
Level 5
Joined
Jul 15, 2012
Messages
101
I did get the HWE (still getting errors on launching jngp..)
Thanks for information guys! Seems helpful and useful for the future, that's what I've been looking for.

Also found this later, didn't know these existed:

  • Unit - Set Attack Interval of (Triggering unit) to 2.00 for weapon index: 1
  • Unit - For Unit (Triggering unit), Set cooldown of ability Acid Bomb, Level: 1 to 5.00
  • Set real = (Ability Cooldown of (Triggering unit) for ability Animate Dead, Level: 1)
  • Set real = (Ability Cooldown Remaining of (Triggering unit) for ability Avatar)
 
Status
Not open for further replies.
Top