2989 Posts in 495 Topics - by 2195 Members - Latest Member: Warayurt

Warcraft III: MapsModelsSkinsIconsSpellsToolsTutorials
WC3 JASS: Code SnippetsJASS and vJASS Spells and SystemsJass Tutorials
Chat @Discord

Author Topic: GetUnitCollisionSize v1 2 (1)  (Read 3561 times)

  • Newbie - level 2
  • **
  • Posts: 17
  • WC3 Models: 0
  • WC3 Tutorials: 0
  • WC3 Tools: 0
  • WC3 Maps: 0
  • WC3 Skins: 0
  • WC3 Icons: 0
  • WC3 Spells: 0
  • Reputation: 0
  • Damn Spell Coder
    • View Profile
GetUnitCollisionSize v1 2 (1)
« on: May 21, 2013, 05:16:02 AM »
This is the GetUnitCollisionSize system,this calculates the collision size of a unit.This calculates 100% correct collision size results.

This is good for:
  • Destroying trees
  • Slide systems
  • Knockback Systems
  • Pathability
  • Immolation based spells
  • Novas
  • Missiles
  • And more.

To use this,just make sure to set the unit to GUCS_U then run the system by using run trigger action,get the collision size by putting the GUCS_Size.Dont change the value or use another value for the size after the system has run.Use the GUCS_Size after or it hasnt been replaced yet.

To Import:
Copy the trigger and variables

Trigger: Test 294532720
   
           
  • GetUnitCollisionSize
  •     Events
  •         Map initialization
  •     Conditions
  •     Actions
  •         Custom script:   call ExecuteFunc("InitGetUnitCollisionSize")
  •         Custom script:   endfunction
  •         -------- ------------------------------------------------ --------
  •         -------- This function calculates the size --------
  •         -------- This function is 100% perfect in calculating --------
  •         -------- ------------------------------------------------ --------
  •         Custom script:   function CheckUnitCollisionSize takes unit u returns integer
  •         -------- ------------------------------------------------ --------
  •         -------- max collision is based on tier 3 halls --------
  •         -------- ------------------------------------------------ --------
  •         Custom script:   local integer maxcollision = 172
  •         Custom script:   local integer a = 0
  •         Custom script:   local integer radius = maxcollision
  •         Custom script:   local real x = GetUnitX(u)
  •         Custom script:   local real y = GetUnitY(u)
  •         Custom script:   loop
  •         Custom script:   if IsUnitInRangeXY(u, x + radius, y, 0) then
  •         Custom script:   set a = radius
  •         Custom script:   else
  •         Custom script:   set maxcollision = radius
  •         Custom script:   endif
  •         Custom script:   exitwhen maxcollision - a <= 1
  •         Custom script:   set radius = (maxcollision + a) / 2
  •         Custom script:   endloop
  •         Custom script:   set radius = radius - maxcollision + a
  •         Custom script:   return radius
  •         Custom script:   endfunction
  •         -------- ------------------------------------------------ --------
  •         -------- This function gets the collision size which also capsulates them for further use --------
  •         -------- ------------------------------------------------ --------
  •         Custom script:   function GetUnitCollisionSize takes nothing returns nothing
  •         Custom script:   local integer id = GetUnitTypeId(udg_GUCS_U)
  •         Custom script:   if not HaveSavedInteger(udg_GUCS_Hash,id,0) == false then
  •         Custom script:   set udg_GUCS_Size = CheckUnitCollisionSize(udg_GUCS_U)
  •         Custom script:   call SaveInteger(udg_GUCS_Hash,id,udg_GUCS_Size,0)
  •         Custom script:   else
  •         Custom script:   set udg_GUCS_Size = LoadInteger(udg_GUCS_Hash,id,0)
  •         Custom script:   endif
  •         Custom script:   endfunction
  •         -------- ------------------------------------------------ --------
  •         -------- Reset --------
  •         -------- ------------------------------------------------ --------
  •         Custom script:   function InitGetUnitCollisionSize takes nothing returns nothing
  •         Custom script:   local trigger t = GetTriggeringTrigger()
  •         Custom script:   call TriggerClearActions(t)
  •         Custom script:   call TriggerAddAction(t,function GetUnitCollisionSize)
           
« Last Edit: May 21, 2013, 05:24:15 AM by moyack »

  • Your Awesome Site Director
  • Recognized User
  • Starter - level 1
  • *
  • Posts: 382
  • WC3 Models: 0
  • WC3 Tutorials: 0
  • WC3 Tools: 0
  • WC3 Maps: 0
  • WC3 Skins: 0
  • WC3 Icons: 0
  • WC3 Spells: 0
  • Reputation: 677
    • View Profile
GetUnitCollisionSize v1 2 (1)
« Reply #1 on: May 21, 2013, 05:17:40 AM »
As always your spells/systems are well made and useful I'm gonna mass approve this all with my lovely 4/5 rating.
Chronicles of Darkness
by: SonofJay

A BlizzMod Hosted Project

They can hate, let them hate, make them hate.

  • Site Owner
  • Administrator
  • Starter - level 4
  • *
  • Posts: 988
  • WC3 Models: 44
  • WC3 Tutorials: 13
  • WC3 Tools: 10
  • WC3 Maps: 12
  • WC3 Skins: 6
  • WC3 Icons: 2
  • WC3 Spells: 5
  • Reputation: 1153
  • Site Admin - I love fix things
    • View Profile
    • Blizzard Modding Information Center
GetUnitCollisionSize v1 2 (1)
« Reply #2 on: May 21, 2013, 05:22:25 AM »
Moved from media so it can handle better the information.

We can give you full hosting for your projects, a complete page!!

A custom altered melee map where you can play Naga and Demons. Check it out!!
Use Dropbox...

 

Blizzard Modding Information Center Starcraft II Modding Information Center Wacraft III Modding Information Center WC3JASS.com - The JASS Vault Chronicles of Darkness - A Warcraft III mod Jetcraft - A Starcraft II mod Troll Smash - A Warcraft III Arena
  Mod DB - Change the Game Power of Corruption - A Warcraft III altered melee map Chaos Realm - The world of Game modders and wc3 addicts Follow us on Facebook!!