• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

how to ping every doodad on the map?

Status
Not open for further replies.
Level 7
Joined
Nov 18, 2012
Messages
312
like that?
JASS:
 call EnumDestructablesInRect(GetEntireMapRect(), null, function PingSelectedDestructable)
call EnumDestructablesInRect(GetWorldBounds(), null, function PingSelectedDestructable)
still has no idea how to ping them
 
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
5,010
Like this:
JASS:
//If you use "null" for a boolexpr argument it actually causes a memory leak.
//Dumb bug, but to fix it you just need one global function that always returns true.
//Something like Rising_Dusk's GroupUtils includes this automatically so instead of "Filter(AlwaysTrue)" below you would use "BOOLEXPR_TRUE".
function AlwaysTrue takes nothing returns boolean
    return true
endfunction

function PingSelectedDestructable takes nothing returns nothing
    local destructable d = GetEnumDestructable()
    call PingMinimap(GetDestructableX(d), GetDestructableY(d), DURATION)
    //could use PingMinimapEx() to get colors and other effects too
    set d = null
endfunction

//...

call EnumDestructablesInRect(bj_playableMapRect, Filter(AlwaysTrue), function PingSelectedDestructable)

Another solution: just use the filter to ping everything.
JASS:
function PingSelectedDestructable takes nothing returns @boolean@
    local destructable d = GetEnumDestructable()
    call PingMinimap(GetDestructableX(d), GetDestructableY(d), DURATION)
    //could use PingMinimapEx() to get colors and other effects too
    set d = null
  @ return false@
endfunction

//...

call EnumDestructablesInRect(bj_playableMapRect, Filter(PingSelectedDestructable), null)
//Fairly certain you don't have to worry about leaks from passing null codes, though I could be wrong.
 
Last edited:

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,197
how to ping every doodad on the map?
Not possible. Doodads do not really exist as far as game state goes.
Pick all destructables in map
ping for player X at location of picked destructable
Could hit operation limits. Might be wise to break maps into segments and run the search on each segment.
still has no idea how to ping them
With the action that makes a ping? In GUI it might involve cleaning up location leaks.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,197
I think the null boolexpr has been patched out, and even if not Nes says in this thread that the same boolexpr is used and new ones are not created for each call.
At some stage some boffins from WC3Campagins said that null boolexprs leaks. It is not that boolexprs leak, just the functions that use them leak if they are passed null. The leak is completely trivial outside of dynamic use cases because it is mostly generated once at map initialization during trigger initialization. It might have been patched, I never really kept track of it as WC3 suffers far worse leaks.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,197
I forgot the actual amount but it was definately lower than 15.
I think it is higher than 16... Probably either 32 or 64. Might be affected by other mini-map icons (maybe its a limit to mini-map overlays). Could also be due to thread crashes caused by operation limits of finding so many possible targets to ping, as was once experienced with the "Parasite" map series.
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
You can either just do it with GetLocalPlayer() or you can add the players to a force and display for all players in force. However the latter is still going to just do a GetLocalPlayer() call for the requested players.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Doodads are static and hardly have any interaction support. You could instead transform the war3map.doo file to jass lines but as doodads are used for decoration, there is often several thousands of them and you want to ping them all at the same moment? On the other hand, if there are only a few, you may rather represent them (dummies) by other objects.
 
Status
Not open for further replies.
Top