[HELP]Remove Item Around Unit

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

Post Reply
zUsername
Forum Addict
Posts: 407
Joined: February 25th, 2011, 3:16 am
Location: Unknown

[HELP]Remove Item Around Unit

Post by zUsername »

I want to create region then pick every item in region and do action Remove.
Here my code, but it's didn't work .

globals
Spoiler:
trigger cba= CreateTrigger()
rect gg_rct_Hack = Rect( -3008.0, -224.0, -2656.0, 256.0 )
location udg_TempLoc = null

endglobals
Spoiler:
function RemoveItems takes nothing returns nothing
call RemoveItem( GetLastCreatedItem() )
endfunction
function MoveRects takes nothing returns nothing
set udg_TempLoc = GetUnitLoc(GetTriggerUnit())
call MoveRectToLoc(gg_rct_Hack,udg_TempLoc)
call EnumItemsInRectBJ( gg_rct_Hack, function RemoveItems)
endfunction

function main
Spoiler:
local integer abc=0
loop
exitwhen abc>11
call TriggerRegisterPlayerChatEvent(cba,Player(abc),"-clear",false)
set abc=abc+1
endloop
call TriggerAddAction(cba,function MoveRects )


Thanks you .
Apple
Forum Staff
Posts: 1470
Joined: November 3rd, 2010, 10:48 am
Title: Best Player
Location: Singapore
Contact:

Re: [HELP]Remove Item Around Unit

Post by Apple »

Since I didn't mess with those jass, I don't know what's wrong. Here are my doubts..
read starting from from function main to globals
Spoiler:
globals
trigger cba= CreateTrigger()
rect gg_rct_Hack = Rect( -3008.0, -224.0, -2656.0, 256.0 ) // why not use GetEntireMapRect()
location udg_TempLoc = null

endglobals

function RemoveItems takes nothing returns nothing
call RemoveItem( GetLastCreatedItem() )
//Remove items that are created previously, really? are they created?
endfunction
function MoveRects takes nothing returns nothing
set udg_TempLoc = GetUnitLoc(GetTriggerUnit())
//sets the temploc to player
call MoveRectToLoc(gg_rct_Hack,udg_TempLoc)
//move whatever in rect to loc
call EnumItemsInRectBJ( gg_rct_Hack, function RemoveItems)
//whatever in the full map rect are taking RemoveItems Function
endfunction

function main takes nothing returns nothing
local integer abc=0
loop
exitwhen abc>11
call TriggerRegisterPlayerChatEvent(cba,Player(abc),"-clear",false)
set abc=abc+1
endloop
call TriggerAddAction(cba,function MoveRects )
//function main looks fine, -clear triggers MoveRects function
endfunction
Request a map? Follow the rulesHERE
Request templateHERE
Please, do not PM me.
On the side note, I'm still playing vampirism speed on malaysia room, occasionally in Garena. Bcuz too lazy to find out where else I can play them.
zUsername
Forum Addict
Posts: 407
Joined: February 25th, 2011, 3:16 am
Location: Unknown

Re: [HELP]Remove Item Around Unit

Post by zUsername »

As u said "why not use GetEntireMapRect()" I only need region around unit not whole map.
And what are you thinking about get entire map to unit location????
User avatar
haxorico
Super Moderator
Posts: 3188
Joined: February 24th, 2009, 1:31 pm
Location: JEW LAND
Contact:

Re: [HELP]Remove Item Around Unit

Post by haxorico »

It is quite simple actually.
Notice, that the trigger is running every time a player is writing -clear.
Thus, it means the trigger is activated by a PLAYER, not by a UNIT.
You have in your code - set udg_TempLoc = GetUnitLoc(GetTriggerUnit())
What is the triggering unit?
I think you want it to be on the picked units (notice I said units not unit)
So you will need to have the following:

function MoveRects takes nothing returns nothing
local group pickedGroup=CreateGroup() //Creating a group for the picked units
local unit pickedUnit //the first unit in the group
call GroupEnumUnitsSelected(pickedGroup,GetTriggerPlayer(),null) //insert all the picked units to the group
loop
set pickedUnit=FirstOfGroup(pickedGroup) // Picking the first unit in the group.
exitwhen haxUnit==null //end the loop if we don't have any more units
// Your code here
call GroupRemoveUnit(pickedGroup,pickedUnit) //remove the unit from the group after we have the command.
endloop
call DestroyGroup(pickedGroup)//remove leaks
set pickedGroup=null//remove leaks
set pickedUnit=null//remove leaks
endfunction
Image
Spoiler:
(02:24:09)

Code: Select all

ChatBot: FatherSpace logs into the Chat.
(02:24:28) Lanaya: Gtfo ken.
(02:24:33) ChatBot: FatherSpace logs out of the Chat.
(02:24:40) Lanaya: Thought so. bitch.
(02:24:44) ChatBot: FatherSpace logs into the Chat.
(02:24:48) FatherSpace: Can I come back yet?
(02:24:51) Lanaya: What'd i say earlier.
(02:24:51) Lanaya: No.
(02:24:58) FatherSpace: Let's try this...
(02:25:01) ChatBot: Lanaya has been logged out (Kicked).

Code: Select all


(14:33:51) 2Pac: Do you know what'S so funny?
(14:34:01) Lanaya: No, please show me.
(14:34:07) 2Pac: This.
(14:34:09) ChatBot: Lanaya has been logged out (Kicked).
(14:34:10) 2Pac:


Code: Select all

(14:35:59) haxorico: No one will belive me if I say "I got this song from 2pac on MSN" lolz ^^
(14:36:02) Lanaya: lolz.
(14:36:16) 2Pac: I AIN'T DEAD FFS.
(14:36:26) 2Pac: I'm a living legend, y'now.
(14:37:17) haxorico: why is 2Pac a legend?
(14:37:28) Lanaya: He's the worse rapper evar.

Code: Select all

(15:42:51) Lanaya: can i suck , . . .

Code: Select all

(13:55:21) ChatBot: 2Pac rolls 1d100 and gets 1.
(13:55:21) ChatBot: haxorico rolls 1d2 and gets 2.
(13:55:27) haxorico: owned?

Code: Select all

GeorgeMots: xplain what happens in SP. Why cant you save?
dast.-:i need play with 2 players

Code: Select all

(21:53:08) (673237): plzplzplz, im sorry about before.
(21:53:26) FatherSpace: I'm sorry you were born.
(21:53:31) ChatBot: (673237) has been logged out (Kicked).


Code: Select all

(10:08:02) Bartimaeus: you do know run I youtube channel for my favorite music, right?
Apple
Forum Staff
Posts: 1470
Joined: November 3rd, 2010, 10:48 am
Title: Best Player
Location: Singapore
Contact:

Re: [HELP]Remove Item Around Unit

Post by Apple »

Assumed what you're asking for is something that removes everything on the floor.
Haxorico's explanation is fabulous.
Request a map? Follow the rulesHERE
Request templateHERE
Please, do not PM me.
On the side note, I'm still playing vampirism speed on malaysia room, occasionally in Garena. Bcuz too lazy to find out where else I can play them.
User avatar
haxorico
Super Moderator
Posts: 3188
Joined: February 24th, 2009, 1:31 pm
Location: JEW LAND
Contact:

Re: [HELP]Remove Item Around Unit

Post by haxorico »

If it is for everything on the floor, no need to get the region from the picked units.
I assumed there is a radios for the unit, as you can see, I didn't have any code regarding the items.
Image
Spoiler:
(02:24:09)

Code: Select all

ChatBot: FatherSpace logs into the Chat.
(02:24:28) Lanaya: Gtfo ken.
(02:24:33) ChatBot: FatherSpace logs out of the Chat.
(02:24:40) Lanaya: Thought so. bitch.
(02:24:44) ChatBot: FatherSpace logs into the Chat.
(02:24:48) FatherSpace: Can I come back yet?
(02:24:51) Lanaya: What'd i say earlier.
(02:24:51) Lanaya: No.
(02:24:58) FatherSpace: Let's try this...
(02:25:01) ChatBot: Lanaya has been logged out (Kicked).

Code: Select all


(14:33:51) 2Pac: Do you know what'S so funny?
(14:34:01) Lanaya: No, please show me.
(14:34:07) 2Pac: This.
(14:34:09) ChatBot: Lanaya has been logged out (Kicked).
(14:34:10) 2Pac:


Code: Select all

(14:35:59) haxorico: No one will belive me if I say "I got this song from 2pac on MSN" lolz ^^
(14:36:02) Lanaya: lolz.
(14:36:16) 2Pac: I AIN'T DEAD FFS.
(14:36:26) 2Pac: I'm a living legend, y'now.
(14:37:17) haxorico: why is 2Pac a legend?
(14:37:28) Lanaya: He's the worse rapper evar.

Code: Select all

(15:42:51) Lanaya: can i suck , . . .

Code: Select all

(13:55:21) ChatBot: 2Pac rolls 1d100 and gets 1.
(13:55:21) ChatBot: haxorico rolls 1d2 and gets 2.
(13:55:27) haxorico: owned?

Code: Select all

GeorgeMots: xplain what happens in SP. Why cant you save?
dast.-:i need play with 2 players

Code: Select all

(21:53:08) (673237): plzplzplz, im sorry about before.
(21:53:26) FatherSpace: I'm sorry you were born.
(21:53:31) ChatBot: (673237) has been logged out (Kicked).


Code: Select all

(10:08:02) Bartimaeus: you do know run I youtube channel for my favorite music, right?
zUsername
Forum Addict
Posts: 407
Joined: February 25th, 2011, 3:16 am
Location: Unknown

Re: [HELP]Remove Item Around Unit

Post by zUsername »

Thanks haxorico , but I don't know why ur code and my code didn't work. :(:(
User avatar
haxorico
Super Moderator
Posts: 3188
Joined: February 24th, 2009, 1:31 pm
Location: JEW LAND
Contact:

Re: [HELP]Remove Item Around Unit

Post by haxorico »

I explained why your code didn't work.
Your trigger has a player-event and you are using the "triggeringunit" command. That makes no sense.
Image
Spoiler:
(02:24:09)

Code: Select all

ChatBot: FatherSpace logs into the Chat.
(02:24:28) Lanaya: Gtfo ken.
(02:24:33) ChatBot: FatherSpace logs out of the Chat.
(02:24:40) Lanaya: Thought so. bitch.
(02:24:44) ChatBot: FatherSpace logs into the Chat.
(02:24:48) FatherSpace: Can I come back yet?
(02:24:51) Lanaya: What'd i say earlier.
(02:24:51) Lanaya: No.
(02:24:58) FatherSpace: Let's try this...
(02:25:01) ChatBot: Lanaya has been logged out (Kicked).

Code: Select all


(14:33:51) 2Pac: Do you know what'S so funny?
(14:34:01) Lanaya: No, please show me.
(14:34:07) 2Pac: This.
(14:34:09) ChatBot: Lanaya has been logged out (Kicked).
(14:34:10) 2Pac:


Code: Select all

(14:35:59) haxorico: No one will belive me if I say "I got this song from 2pac on MSN" lolz ^^
(14:36:02) Lanaya: lolz.
(14:36:16) 2Pac: I AIN'T DEAD FFS.
(14:36:26) 2Pac: I'm a living legend, y'now.
(14:37:17) haxorico: why is 2Pac a legend?
(14:37:28) Lanaya: He's the worse rapper evar.

Code: Select all

(15:42:51) Lanaya: can i suck , . . .

Code: Select all

(13:55:21) ChatBot: 2Pac rolls 1d100 and gets 1.
(13:55:21) ChatBot: haxorico rolls 1d2 and gets 2.
(13:55:27) haxorico: owned?

Code: Select all

GeorgeMots: xplain what happens in SP. Why cant you save?
dast.-:i need play with 2 players

Code: Select all

(21:53:08) (673237): plzplzplz, im sorry about before.
(21:53:26) FatherSpace: I'm sorry you were born.
(21:53:31) ChatBot: (673237) has been logged out (Kicked).


Code: Select all

(10:08:02) Bartimaeus: you do know run I youtube channel for my favorite music, right?
zUsername
Forum Addict
Posts: 407
Joined: February 25th, 2011, 3:16 am
Location: Unknown

Re: [HELP]Remove Item Around Unit

Post by zUsername »

Problem solved ! Thanks you Haxorico .
Post Reply