Remove Collision of Units

Do you need World Editor help? Ask here!
Forum rules
Before making a new topic:
First, check if your question has already been answered in the Tutorials section.
If you didn't find a solution, use the search function.
If searching didn't help either, you can make a new topic.

Topic title & content:
You must use a descriptive title. (Help plz is not good) (Need help with Dialog buttons is good)
Go into much detail when posting. You should post attachments. Like screenshots of the problem, the map you are making, replays of the error. Or you could even make a screencast (video) of your problem and upload it here.

Spelling:
Grammar seems to be a serious problem amongst teenagers, so use a spell checker or you will get no love.
Read your posts twice, before pressing the reply button.
And do not use profanity. Chatspeak (y r u nub) and Leetspeak (1 C4N S33 H4X) are not welcome here either.

Only World Editor related questions are allowed here!
(Click for Battle.net help) (Click for World Editor help)
TheChosenOreo
Posts: 2
Joined: Tue Aug 16, 2011 10:43 am
Realm: US East
Account: The_Chosen_Oreo
Clan: TMMM

Remove Collision of Units

Unread post by TheChosenOreo »

Hi!

I am having trouble removing the collision of units so they can walk through each other while still having control of the units.

For example: In my maze, I want to have my Demon Hunter walk through the other players' Demon Hunters.

I have the following Triggers:

Trigger: locust

Code: Select all

function locust takes nothing returns nothing
    local unit u = GetEnumUnit()

    call UnitAddAbility(u, 'Aloc')
    call ShowUnit(u, false)
    call ShowUnit(u, true)
    call UnitRemoveAbility(u, 'Aloc')

    set u = null
endfunction

function Trig_locust_Actions takes nothing returns nothing
    local group g = GetUnitsInRectAll(GetEntireMapRect())

    call ForGroup( g, function locust )

    call DestroyGroup(g)
    set g = null
endfunction

function InitTrig_locust takes nothing returns nothing
    set gg_trg_locust = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_locust, 0.01 )
    call TriggerAddAction( gg_trg_locust, function Trig_locust_Actions )
endfunction
Then, In the Map Script Itself...

Trigger: MapScript.j

Code: Select all

function NoCollisionsAtAll takes nothing returns nothing
    call SetUnitPathing(GetEnumUnit(), false)
endfunction

function CollideNone takes nothing returns nothing
    local group g = GetUnitsInRectAll(GetEntireMapRect())
    call ForGroup(g, function NoCollisionsAtAll)
    
    call DestroyGroup(g)
    set g = null
endfunction
In another trigger I call the function, "CollideNone"...

Trigger: OneStepInitLVL1

Code: Select all

function createunits takes nothing returns nothing
    set unit_footman[0] = CreateUnitAtLoc(Player(11), 'hfoo', GetRectCenter(gg_rct_Rect_202), 0.00)
    set unit_footman[1] = CreateUnitAtLoc(Player(11), 'hfoo', GetRectCenter(gg_rct_Rect_209), 0.00)
    set unit_footman[2] = CreateUnitAtLoc(Player(11), 'hfoo', GetRectCenter(gg_rct_Rect_208), 0.00)
    set unit_footman[3] = CreateUnitAtLoc(Player(11), 'hfoo', GetRectCenter(gg_rct_Rect_206), 0.00)
    set unit_footman[4] = CreateUnitAtLoc(Player(11), 'hfoo', GetRectCenter(gg_rct_Rect_248), 0.00)
    set unit_footman[5] = CreateUnitAtLoc(Player(11), 'hfoo', GetRectCenter(gg_rct_Rect_237), 0.00)
    set unit_footman[6] = CreateUnitAtLoc(Player(11), 'hfoo', GetRectCenter(gg_rct_Rect_238), 0.00)
    set unit_footman[7] = CreateUnitAtLoc(Player(11), 'hfoo', GetRectCenter(gg_rct_Rect_205), 0.00)
    set unit_footman[8] = CreateUnitAtLoc(Player(11), 'hfoo', GetRectCenter(gg_rct_Rect_244), 0.00)
    set unit_footman[9] = CreateUnitAtLoc(Player(11), 'hfoo', GetRectCenter(gg_rct_Rect_247), 0.00)
endfunction

function Trig_OneStepInit_Actions takes nothing returns nothing
    call createunits()
    call IssuePointOrderLoc( unit_footman[0], "patrol", GetRectCenter(gg_rct_Rect_207) )
    call IssuePointOrderLoc( unit_footman[1], "patrol", GetRectCenter(gg_rct_Rect_204) )
    call IssuePointOrderLoc( unit_footman[2], "patrol", GetRectCenter(gg_rct_Rect_204) )
    call IssuePointOrderLoc( unit_footman[3], "patrol", GetRectCenter(gg_rct_Rect_203) )
    call IssuePointOrderLoc( unit_footman[4], "patrol", GetRectCenter(gg_rct_Rect_249) )
    call IssuePointOrderLoc( unit_footman[5], "patrol", GetRectCenter(gg_rct_Rect_210) )
    call IssuePointOrderLoc( unit_footman[6], "patrol", GetRectCenter(gg_rct_Rect_239) )
    call IssuePointOrderLoc( unit_footman[7], "patrol", GetRectCenter(gg_rct_Rect_242) )
    call IssuePointOrderLoc( unit_footman[8], "patrol", GetRectCenter(gg_rct_Rect_245) )
    call IssuePointOrderLoc( unit_footman[9], "patrol", GetRectCenter(gg_rct_Rect_246) )
    call CollideNone()
endfunction

//===========================================================================
function InitTrig_OneStepInitLVL1 takes nothing returns nothing
    set gg_trg_OneStepInitLVL1 = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_OneStepInitLVL1, 0.01 )
    call TriggerAddAction( gg_trg_OneStepInitLVL1, function Trig_OneStepInit_Actions )
endfunction
Thank you.

-Oreo

User avatar
3ICE
Admin
Posts: 2629
Joined: Sat Mar 01, 2008 11:34 pm
Realm: Europe
Account: 3ICE
Clan: 3ICE
Location: Hungary
Contact:

Re: Remove Collision of Units

Unread post by 3ICE »

I just set their movement type to none and collision size to 0. Is all that triggering really necessary?
ImageImageImageImageImage
Image
ImageImage

Post Reply

Who is online

Users browsing this forum: No registered users and 60 guests