I'm just starting with this.
anyone can help show me a code that loops thru all objects in the map?
What i'm trying to do is. Find all location of heroes. Also Find all location of WARDS/SENTRY.
anyone? please thanks.
Edit:
Why am I transferred here?
btw, I forgot to note that I'm looking for a JASS code.
Thanks
LOOP code help
Moderator: Cheaters
-
- V.I.P.
- Posts: 98
- Joined: December 4th, 2007, 10:24 am
LOOP code help
Last edited by GeorgeMots on December 8th, 2007, 6:47 pm, edited 1 time in total.
Reason: posts merged
Reason: posts merged
auto-collider for wc3 1.22-- @ http://iliganshack.blogspot.com
-
- Crusader
- Posts: 4236
- Joined: January 27th, 2007, 4:46 pm
- Location: Greece, Veria
Re: LOOP code help
Your post was moved here because it wasnt a map cheating/deprotection request.
And remember dont double post, use the
button at the lower right corner of ur posts.
And remember dont double post, use the

-
- Tyrannical Drama Queen
- Posts: 4445
- Joined: November 19th, 2007, 5:05 am
- Been thanked: 2 times
Re: LOOP code help
Well, you were suppose to get transfered to the JASS Section, but you didn't clearly state that you were looking for a JASS Code instead of a GUI, so my guess is that George kind of leaned toward GUI, since it's more common. And I'm, or perhaps anyone else, are\is not sure what you mean by "finding" the location of heroes and wards/sentries.rnbby wrote:I'm just starting with this.
anyone can help show me a code that loops thru all objects in the map?
What i'm trying to do is. Find all location of heroes. Also Find all location of WARDS/SENTRY.
anyone? please thanks.
Edit:
Why am I transferred here?
btw, I forgot to note that I'm looking for a JASS code.
Thanks
-
- Forum Spammer
- Posts: 635
- Joined: May 29th, 2007, 9:02 am
- Title: Strange old man
- Location: London, England
Re: LOOP code help
I think your looking alittle to much into that 

Sir-Tanks is BACK and working on his new map Acts of War!
Take the best Stupidity test here
Take the best Stupidity test here
-
- V.I.P.
- Posts: 98
- Joined: December 4th, 2007, 10:24 am
Re: LOOP code help
So what function do I need to use?
I try looking at the native functions. I can't get location of a player unit. also looking forward to get a location of a certain item in a map. Is a ward an item or an object? i'm pretty confused.
I try looking at the native functions. I can't get location of a player unit. also looking forward to get a location of a certain item in a map. Is a ward an item or an object? i'm pretty confused.
auto-collider for wc3 1.22-- @ http://iliganshack.blogspot.com
-
- Honorary wc3edit.net Traitor
- Posts: 2507
- Joined: February 1st, 2007, 4:11 pm
- Location: NEVADA
Re: LOOP code help
depends if its placed or not, if its placed, its a unit.rnbby wrote:So what function do I need to use?
I try looking at the native functions. I can't get location of a player unit. also looking forward to get a location of a certain item in a map. Is a ward an item or an object? i'm pretty confused.
-
- V.I.P.
- Posts: 98
- Joined: December 4th, 2007, 10:24 am
Re: LOOP code help
The item is placed.
So it's a unit right?
Thanks.
So it's a unit right?
Thanks.
auto-collider for wc3 1.22-- @ http://iliganshack.blogspot.com
-
- Senior Member
- Posts: 101
- Joined: June 1st, 2007, 9:05 pm
Re: LOOP code help
Since when is an item a unit? All items are widgets. All units are widgets. All widgets are handles. Therefore units are NOT items.
For the items, you can use:
As for the units, you'd need to use groups:
For the items, you can use:
Code: Select all
function True takes nothing returns boolean
return true
endfunction
function SomeFunction takes nothing returns nothing
call EnumItemsInRect(bj_mapInitialPlayableArea,Filter(function True),function yourActionFunc)
endfunction
Code: Select all
function SomeFunction takes nothing returns nothing
local group g=CreateGroup()
call GroupEnumUnitsInRect(g,bj_mapInitialPlayableArea,Filter(function True))
call ForGroup(g,function yourActionFunc)
call DestroyGroup(g)
set g=null
endfunction
-
- V.I.P.
- Posts: 98
- Joined: December 4th, 2007, 10:24 am
Re: LOOP code help
Thanks for the code snippet. I'm gonna mess around this.
auto-collider for wc3 1.22-- @ http://iliganshack.blogspot.com
-
- Forum Staff
- Posts: 829
- Joined: January 28th, 2007, 8:10 pm
- Title: JASS Programmer
- Location: Canada
Re: LOOP code help
Just use null as a filter if there's no condition or anything.HINDYhat wrote:Since when is an item a unit? All items are widgets. All units are widgets. All widgets are handles. Therefore units are NOT items.
For the items, you can use:As for the units, you'd need to use groups:Code: Select all
function yourActionFunc takes nothing returns nothing //Do stuff endfunction function SomeFunction takes nothing returns nothing call EnumItemsInRect(bj_mapInitialPlayableArea,null,function yourActionFunc) endfunction
Code: Select all
function SomeFunction takes nothing returns nothing local group g=CreateGroup() call GroupEnumUnitsInRect(g,bj_mapInitialPlayableArea,null) call ForGroup(g,function yourActionFunc) call DestroyGroup(g) set g=null endfunction