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

[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?
 
Level 19
Joined
Jan 3, 2022
Messages
320
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.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,596
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:
Level 7
Joined
Feb 9, 2021
Messages
301
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.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,596
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.
 
Level 7
Joined
Feb 9, 2021
Messages
301
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.
Top