• 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!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[Solved] How to create a certain type/property to detect it? (vJass)

Status
Not open for further replies.
Level 7
Joined
Feb 9, 2021
Messages
301
What is the best way to detect that selected unit/object is of a certain type? For example, I want my spell to select all objects in area 300 and move the ones that have property X? (don't want to do it through Buff) Is group the only way?
 
I have to guess you need to mark some units as special to do something with them later? That is why you don't use game's own unit types etc?
Why not add them to a special group when they enter the map and when the spell is activated, compare distance for all units in that group. Only units within 300 area will be affected.
 
What other way would you do it?

Pick every unit in radius -> If picked unit meets X condition -> Move picked unit

Pick every destructable in radius -> If picked destructable meets X condition -> Move picked destructable

Those are the only two objects you can really move, unless you have some custom objects you've created. In that case you could store them in an Array and enumerate over them, finding whichever ones meet your desired conditions.

For property X, storing properties can be done in may ways. I often tell GUI users to create hidden passive abilities and use them as "classifications". Then you can check the level of these abilities on the unit -> If level of Dragon Classification for (Picked unit) Equal to 1 then...

You could use a Hashtable to track a Boolean for the desired Object. If Load 0 of Handle(Object) in Hashtable Equal to True then...
 
Last edited:
What other way would you do it?

Pick every unit in radius -> If picked unit meets X condition -> Move picked unit

Pick every destructable in radius -> If picked destructable meets X condition -> Move picked destructable

Those are the only two objects you can really move, unless you have some custom objects you've created. In that case you could store them in an Array and enumerate over them, finding whichever ones meet your desired conditions.

For property X, storing properties can be done in may ways. I often tell GUI users to create hidden passive abilities and use them as "classifications". Then you can check the level of these abilities on the unit -> If level of Dragon Classification for (Picked unit) Equal to 1 then...

You could use a Hashtable to track a Boolean for the desired Object. If Load 0 of Handle(Object) in Hashtable Equal to True then...
I was thinking that it might be possible to make a variable inside an instance of my choice that indicates that it is an object I want. To put into perspective, I use a misissle system. I want my spell to check all missiles in the area and then do actions only with a specific type of a missile. I know that I can add all my type to the group, but I thought there might be a better way.
 
If the system you're using has a Struct you can easily add your own variables to it.
If Missile.IsYourType then...

Depends on which system you're using.
 
If the system you're using has a Struct you can easily add your own variables to it.
If Missile.IsYourType then...

Depends on which system you're using.
I think I got it. Thanks.
 
Status
Not open for further replies.
Back
Top