HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Removing Collision almost completely?

12-06-2006, 01:44 AM#1
CoDRaZieL
if you have played dota youv seen mercurial's dagger ability that allows her to walk through trees and units, i am making a drag-unit ability but the target keeps getting stuck behind things, basically the unit will be pulled behind you for a duration, and i need to disable collision for that time, i have tried turning collision off during the trigger, it doesnt help, i have tried giving him several abilities such as locust, but it cannot be removed, would somebody please help me fix this
12-06-2006, 01:57 AM#2
Ryude
Yes, there is a function that disables/enables collision for a unit.

Trigger:
Unit - Turn collision for (Last created unit) Off

You can turn it on or off.
12-06-2006, 02:36 AM#3
CoDRaZieL
the above mentioned trigger doesnt work for me, the unit still collides with everything
12-06-2006, 02:48 AM#4
BBDino
Post your entire trigger, you may be doing soemthing else wrong.
12-06-2006, 04:04 AM#5
Ryude
Did you use (last created unit) or did you specify the unit you need?

Also, what event are you using to trigger this action?
12-06-2006, 05:03 AM#6
CoDRaZieL
Collapse JASS:
function Trig_Spin_Web_Copy_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A00O' ) ) then
        return false
    endif
    return true
endfunction
function Trig_Spin_Web_Timer takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local real dir = GetHandleReal(t, "direction")
    local real steps = GetHandleReal(t, "steps")
    local unit tar = GetHandleUnit(t, "target")
    local unit caster = GetHandleUnit(t, "caster")
    local string model = "Abilities\\Weapons\\BansheeMissile\\BansheeMissile.mdl"
    local real speed = 1500
    local location bycaster = PolarProjectionBJ(GetUnitLoc(caster), -64 , GetUnitFacing(caster) + 0.00)
    local location attarget = GetUnitLoc(tar)
    local location midpoint = PolarProjectionBJ(attarget,DistanceBetweenPoints(bycaster,attarget)/50,AngleBetweenPoints(attarget,bycaster))
    call SetUnitPositionLoc(tar,midpoint)
    call DamagingProjectileLaunchTargetLoc(caster,model,speed,0,GetUnitLoc(caster),0,tar,0,0,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL)
    call SetUnitFacing(tar,AngleBetweenPoints(attarget,bycaster))
    set steps = steps - 1
    call SetHandleReal(t, "steps", steps)    
    if GetUnitState(tar, UNIT_STATE_LIFE) <= 0.49 then
    set steps = 0   
    endif
    if GetUnitState(caster, UNIT_STATE_LIFE) <= 0.49 then
    set steps = 0
    endif
    
    
    if steps <= 0 then
        call DestroyTimer(t)
    endif
    set bycaster = null
    set attarget = null
    set midpoint = null
    set tar = null
    set t = null
    set caster = null    
endfunction

function Trig_Spin_Web_Copy_Actions takes nothing returns nothing
    local real dragdir = GetUnitFacing(GetTriggerUnit())
    local unit dragtar = GetSpellTargetUnit()
    local effect drageff = null
    local timer t = CreateTimer()
    local real duration = 0.05
    local real steps =GetUnitAbilityLevel(GetTriggerUnit(),'A00O') * 40 * 2
    call SetHandleHandle(t, "target",dragtar)
    call SetHandleReal(t, "direction",dragdir)
    call SetHandleReal(t, "steps",steps)
    call SetHandleHandle(t, "caster",GetTriggerUnit())
    set dragdir = GetUnitFacing(GetTriggerUnit())
    set dragtar = GetSpellTargetUnit()
    call PauseUnitBJ( true, dragtar )
    call UnitAddAbility(dragtar,'Agho')
    call SetUnitInvulnerable( dragtar, true)
    call SetUnitPathing( dragtar, false )
    call TimerStart(t,duration,true,function Trig_Spin_Web_Timer)
    call PauseUnitBJ( false, dragtar )
    call SetUnitInvulnerable( dragtar, false )
    call SetUnitPathing( dragtar, true )
    call UnitRemoveAbility(dragtar,'Agho')
    set dragtar = null
endfunction

//===========================================================================
function InitTrig_Spin_Web_Copy takes nothing returns nothing
    set gg_trg_Spin_Web_Copy = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Spin_Web_Copy, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Spin_Web_Copy, Condition( function Trig_Spin_Web_Copy_Conditions ) )
    call TriggerAddAction( gg_trg_Spin_Web_Copy, function Trig_Spin_Web_Copy_Actions )
endfunction


that is my trigger in its entireity its a bit disorganised and probably leaks like the neighbors outdoor tap, but lets try and focus on the issue at hand

EDIT:
Speaking of which id like to thank vexorian for all his help in my jass discovery and of course zoxc for jasscraft which is absolutely wonderful as well as Shadow1500 and all of you JESP spell makers out there, without you guys at wc3campaigns i would have never come to enjoy mapping to this extent
12-06-2006, 09:12 AM#7
Guest
Quote:
Originally Posted by Ryude
Yes, there is a function that disables/enables collision for a unit.

Trigger:
Unit - Turn collision for (Last created unit) Off

You can turn it on or off.

That only allows other units to walk through it, not the other way around. Wierd, I know.

What you want to do is give the targeted unit the Ghost (Visable) ability but that wont let it go through trees, just units.
12-06-2006, 12:32 PM#8
abriko
Try another thing on your unit..like put a special effect on it to see if your local var is well defined and test it. The trigger turn off collision works very well.. the problem is not here.
12-06-2006, 07:13 PM#9
shadow1500
Collapse JASS:
call SetUnitPathing( dragtar, false )
    call TimerStart(t,duration,true,function Trig_Spin_Web_Timer)
    call PauseUnitBJ( false, dragtar )
    call SetUnitInvulnerable( dragtar, false )
    call SetUnitPathing( dragtar, true )
Looks like youre disabling pathing and then instantly enabling it back..
12-06-2006, 08:15 PM#10
abriko
....true..
12-06-2006, 10:04 PM#11
Ryude
Collapse JASS:
function Trig_Spin_Web_Copy_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A00O'
endfunction
function Trig_Spin_Web_Timer takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local real dir = GetHandleReal(t, "direction")
    local real steps = GetHandleReal(t, "steps")
    local unit tar = GetHandleUnit(t, "target")
    local unit caster = GetHandleUnit(t, "caster")
    local string model = "Abilities\\Weapons\\BansheeMissile\\BansheeMissile.mdl"
    local real speed = 1500
    local location bycaster = PolarProjectionBJ(GetUnitLoc(caster), -64 , GetUnitFacing(caster) + 0.00)
    local location attarget = GetUnitLoc(tar)
    local location midpoint = PolarProjectionBJ(attarget,DistanceBetweenPoints(bycaster,attarget)/50,AngleBetweenPoints(attarget,bycaster))
    call SetUnitPositionLoc(tar,midpoint)
    call DamagingProjectileLaunchTargetLoc(caster,model,speed,0,GetUnitLoc(caster),0,tar,0,0,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL)
    call SetUnitFacing(tar,AngleBetweenPoints(attarget,bycaster))
    set steps = steps - 1
    call SetHandleReal(t, "steps", steps)    
    if GetUnitState(tar, UNIT_STATE_LIFE) <= 0.49 then
    set steps = 0   
    endif
    if GetUnitState(caster, UNIT_STATE_LIFE) <= 0.49 then
    set steps = 0
    endif
    
    
    if steps <= 0 then
        call PauseUnitBJ( false, dragtar )
        call SetUnitInvulnerable( dragtar, false )
        call SetUnitPathing( dragtar, true )
        call UnitRemoveAbility(dragtar,'Agho')
        call DestroyTimer(t)
    endif
    set bycaster = null
    set attarget = null
    set midpoint = null
    set tar = null
    set t = null
    set caster = null    
endfunction

function Trig_Spin_Web_Copy_Actions takes nothing returns nothing
    local real dragdir = GetUnitFacing(GetTriggerUnit())
    local unit dragtar = GetSpellTargetUnit()
    local effect drageff = null
    local timer t = CreateTimer()
    local real duration = 0.05
    local real steps =GetUnitAbilityLevel(GetTriggerUnit(),'A00O') * 40 * 2
    call SetHandleHandle(t, "target",dragtar)
    call SetHandleReal(t, "direction",dragdir)
    call SetHandleReal(t, "steps",steps)
    call SetHandleHandle(t, "caster",GetTriggerUnit())
    set dragdir = GetUnitFacing(GetTriggerUnit())
    set dragtar = GetSpellTargetUnit()
    call PauseUnitBJ( true, dragtar )
    call UnitAddAbility(dragtar,'Agho')
    call SetUnitInvulnerable( dragtar, true)
    call SetUnitPathing( dragtar, false )
    call TimerStart(t,duration,true,function Trig_Spin_Web_Timer)
    set dragtar = null
endfunction

//===========================================================================
function InitTrig_Spin_Web_Copy takes nothing returns nothing
    set gg_trg_Spin_Web_Copy = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Spin_Web_Copy, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Spin_Web_Copy, Condition( function Trig_Spin_Web_Copy_Conditions ) )
    call TriggerAddAction( gg_trg_Spin_Web_Copy, function Trig_Spin_Web_Copy_Actions )
endfunction


Try that.
12-06-2006, 10:18 PM#12
wyrmlord
Instead of SetUnitPosition, try SetUnitX and SetUnitY. SetUnitPosition checks for collision while SetUnitX/Y ignores it.
12-06-2006, 11:13 PM#13
Ryude
Quote:
Originally Posted by wyrmlord
Instead of SetUnitPosition, try SetUnitX and SetUnitY. SetUnitPosition checks for collision while SetUnitX/Y ignores it.

Ya, but that's another lesson for another day :P
12-06-2006, 11:18 PM#14
CoDRaZieL
Thanks a lot guys, in 1 day youve managed to solve the problem i spent a sleepless night on

It seems that in my 3 months away from learning jass i had lost a lot of simple things i should have remembered

anyway thank you all for your time and help

Heres the finished code, spell looks good
Collapse JASS:
function Trig_Spin_Web_Copy_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A00O' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Spin_Web_Timer takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local real steps = GetHandleReal(t, "steps")
    local unit tar = GetHandleUnit(t, "target")
    local unit caster = GetHandleUnit(t, "caster")
    local effect ef = GetHandleEffect(t, "effect")
    local string model = "Abilities\\Weapons\\BansheeMissile\\BansheeMissile.mdl"
    local real speed = 1500
    local location bycaster = PolarProjectionBJ(GetUnitLoc(caster), -64 , GetUnitFacing(caster) + 0.00)
    local location attarget = GetUnitLoc(tar)
    local location midpoint = PolarProjectionBJ(attarget,DistanceBetweenPoints(bycaster,attarget)/20,AngleBetweenPoints(attarget,bycaster))
    call SetUnitX(tar,GetLocationX(midpoint))
    call SetUnitY(tar,GetLocationY(midpoint))
    call DamagingProjectileLaunchTargetLoc(caster,model,speed,0,GetUnitLoc(caster),0,tar,0,0,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL)
    call SetUnitFacing(tar,AngleBetweenPoints(attarget,bycaster))
    set steps = steps - 1
    call SetHandleReal(t, "steps", steps)    
    if GetUnitState(tar, UNIT_STATE_LIFE) <= 0.49 then
    set steps = 0   
    endif
    if GetUnitState(caster, UNIT_STATE_LIFE) <= 0.49 then
    set steps = 0
    endif
    
    if steps <= 0 then
        call DestroyTimer(t)
        call SetUnitPathing(tar,true)
        call DestroyEffect(ef)
        call PauseUnitBJ( false, tar )
        call SetUnitInvulnerable( tar, false )

    endif
    set bycaster = null
    set attarget = null
    set midpoint = null
    set tar = null
    set t = null
    set caster = null    
endfunction

function Trig_Spin_Web_Copy_Actions takes nothing returns nothing
    local unit dragtar = GetSpellTargetUnit()
    local effect drageff = AddSpecialEffectTargetUnitBJ( "chest", dragtar, "Abilities\\Spells\\Undead\\Web\\Web_AirTarget.mdl" )
    local timer t = CreateTimer()
    local real duration = 0.05
    local real steps =GetUnitAbilityLevel(GetTriggerUnit(),'A00O') * 40 * 2
    call SetHandleHandle(t, "target",dragtar)
    call SetHandleReal(t, "steps",steps)
    call SetHandleHandle(t, "caster",GetTriggerUnit())
    call SetHandleHandle(t,"effect",drageff)
    call PauseUnitBJ( true, dragtar )
    call SetUnitInvulnerable( dragtar, true)
    call SetUnitPathing( dragtar, false )
    call TimerStart(t,duration,true,function Trig_Spin_Web_Timer)
    set dragtar = null
endfunction

//===========================================================================
function InitTrig_Spin_Web_Copy takes nothing returns nothing
    set gg_trg_Spin_Web_Copy = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Spin_Web_Copy, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Spin_Web_Copy, Condition( function Trig_Spin_Web_Copy_Conditions ) )
    call TriggerAddAction( gg_trg_Spin_Web_Copy, function Trig_Spin_Web_Copy_Actions )
endfunction

12-06-2006, 11:21 PM#15
Ryude
Quote:
Originally Posted by CoDRaZieL
Thanks a lot guys, in 1 day youve managed to solve the problem i spent a sleepless night on

It seems that in my 3 months away from learning jass i had lost a lot of simple things i should have remembered

anyway thank you all for your time and help

JASS is great, and I hope you enjoy the learning part as much as I do. That's the best reason to learn JASS, not because of what it can do but what it teaches you. Determination, Patience, and the ability to come up with new ways to attack a problem and solve it.