• 🏆 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!

Unit indexers and a question

Status
Not open for further replies.
Level 3
Joined
Apr 7, 2020
Messages
32
I'm considering using a Unit indexer on one of my maps but I'm just curious if there's any potential conflicts with this kind of system. Can it affect performance? What should I look out for? And which Unit indexer is best?
 
Level 14
Joined
Feb 7, 2020
Messages
387
GUI Unit Indexer 1.4.0.0

Easy to install and not expensive on resources. There are myriad systems that run beefier code without hiccups.

The only conflict to consider is other uses of the Get / SetUnitUserData() function (called 'Unit Custom Value' in GUI). If other systems set/use this value, you need to make sure they are set up to use a single instance of a unit indexer i.e. the values aren't going to be overwritten/mismatch, etc.
 
Level 3
Joined
Apr 7, 2020
Messages
32
Ah okay. Thanks for the help as always Planetary! I do not use Unit Custom Value in GUI. I do use the "Point Value" (the one assigned in unit editor) in quite a few of my triggers, though. This won't be an issue?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
And the great thing about a Unit Indexer is that you could have as many Point Values (custom stats) as you wanted in the form of variables.

Example:
  • Events:
  • Map initialization
  • Actions:
  • Set Unit_Type[1] = Footman
  • Set Unit_Shields[1] = 100
  • Set Unit_Type[2] = Rifleman
  • Set Unit_Shields[2] = 200
  • Set Total_Types = 2
Then have a trigger to apply these custom stats like:
A unit enters map -> For each integerA from 1 to Total_Types do If unit-type of triggering unit equal to Unit_Type[IntegerA] then Set Shields[custom value] equal to Unit_Shields[IntegerA]
 
Level 3
Joined
Apr 7, 2020
Messages
32
That would be a very good use for me, consider I already have some assigned point values for "races/types".

I'm curious though. I'm just messing around with this example trigger and once I've created. There is no maximum value of units indexed, right? It might just be a problem with this "display" trigger, but I created over 300 units and it seems to stop indexing beyond random points, first was 215.
 
Status
Not open for further replies.
Top