2 Questions easy as hell for JASSers

KvickaN

TH.net Regular
Reaction score
24
Ok guys I just want to tell you that I do not know ANY JASS AT ALL!

That out of the way, couple of questions!

1. What do I change here to make the hook go THRUE trees?

Code:
scope MeatHook

globals
    private constant integer MH_ID = 'A000'  //Raw code of the Meat Hook ability
    private constant integer Hook_Part_ID = 'h001'  //Raw code of the Hook Part unit
    private constant string Eyecandy = "Objects\\Spawnmodels\\Human\\HumanBlood\\HumanBloodFootman.mdl"  //SFX created on target
    private constant real Range_Base_Value = 700  //Formula for hook range = level * Max_Range_Increment + Range_Base_Value
    private constant real Max_Range_Increment = 600
    private constant real Max_Range = 1000  //A limit for the range of the hook - it will NOT go above this range. Don't want a limit? Then set this value to something... big.
    private constant real Dmg_Base = 300  //Formula for hook damage = level * Dmg_Base
    private constant real Speed = 30  //The distance between 2 Hook_Part_ID units/how fast the hook goes, however, speed should generally be modified through Timer_Interval
    private constant real AoE = 80  //How close a target needs to be to be snagged (remember this adds to the total range of the hook)
    private constant real Timer_Interval = 0.03
endglobals

private struct dat
    unit u
    unit array D[500]
    real ang
    integer lvl
    real rng
    real OX
    real OY
    integer i
    unit p
endstruct

private function Cond takes nothing returns boolean
    return IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) != true and IsUnitType(GetFilterUnit(), UNIT_TYPE_FOOT) == true and GetWidgetLife(GetFilterUnit()) > 0.405 and GetFilterUnit() != bj_ghoul[1]
endfunction

private function Uncreate takes nothing returns nothing
    local timer T = GetExpiredTimer()
    local dat dd = dat(GetHandleInt(T, "dd"))
    local real PX = dd.OX + dd.rng * Cos(dd.ang)
    local real PY = dd.OY + dd.rng * Sin(dd.ang)    
    
    set dd.rng = dd.rng - Speed
    call RemoveUnit(dd.D[dd.i])
    set dd.i = dd.i - 1
    call SetUnitX(dd.p, PX)
    call SetUnitY(dd.p, PY)
    
    if dd.i == 0 then
        call SetUnitPathing(dd.p, true)
        call PauseUnit(dd.p, false)
        set dd.p = null
        set dd.u = null
        call dd.destroy()
        call FlushHandleLocals(T)
        call PauseTimer(T)
        call DestroyTimer(T)
    endif
    
    set T = null
endfunction

private function Create takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local dat d = dat(GetHandleInt(t, "d"))
    local real PX = d.OX + d.rng * Cos(d.ang)
    local real PY = d.OY + d.rng * Sin(d.ang)
    local real r = d.lvl * Max_Range_Increment + Range_Base_Value
    local group g
    local boolexpr b
    local timer T
    
    set d.rng = d.rng + Speed
    
    if d.rng < r and d.rng < Max_Range and d.p == null then
        set g = CreateGroup()
        set bj_ghoul[1] = d.u
        set b = Condition(function Cond)
        call GroupEnumUnitsInRange(g, PX, PY, AoE, b)
        set d.p = FirstOfGroup(g)
        if d.p != null then
            call UnitDamageTarget(d.u, d.p, d.lvl * Dmg_Base, false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null)
            call DestroyEffect(AddSpecialEffectTarget(Eyecandy, d.p, "origin"))
            call SetUnitPathing(d.p, false)
            call PauseUnit(d.p, true)
            call SetUnitX(d.p, PX)
            call SetUnitY(d.p, PY)
            return
        endif        
        set d.D[d.i] = CreateUnit(GetOwningPlayer(d.u), Hook_Part_ID, PX, PY, d.ang * bj_RADTODEG)
        set d.i = d.i + 1
        call DestroyGroup(g)
        call DestroyBoolExpr(b)
        set g = null
        set b = null
    else
        set T = CreateTimer()
        set d.rng = d.rng - Speed
        call SetHandleInt(T, "dd", d)
        call TimerStart(T, Timer_Interval, true, function Uncreate)
        call FlushHandleLocals(t)
        call PauseTimer(t)
        call DestroyTimer(t)
        set T = null
    endif
    
    set t = null
endfunction

private function Cast takes nothing returns nothing
    local timer t = CreateTimer()
    local location l = GetSpellTargetLoc()
    local dat d = dat.create()
    
    set d.u = GetTriggerUnit()
    set d.ang = Atan2(GetLocationY(l)-GetUnitY(d.u), GetLocationX(l)-GetUnitX(d.u))
    set d.lvl = GetUnitAbilityLevel(d.u, MH_ID)
    set d.rng = Speed
    set d.OX = GetUnitX(d.u)
    set d.OY = GetUnitY(d.u)
    set d.i = 1
    
    call SetHandleInt(t, "d", d)
    call TimerStart(t, Timer_Interval, true, function Create)
    
    call RemoveLocation(l)
    
    set t = null
    set l = null
endfunction

private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == MH_ID
endfunction

function InitTrig_Meat_Hook takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition(t, Condition( function Conditions ) )
    call TriggerAddAction( t, function Cast )
    set t = null
endfunction

endscope

2.
Code:
IsUnitType(GetFilterUnit(), UNIT_TYPE_WHAT_SHALL_STAND_HERE_IF_I_WANT_MOVEMENT_TYPE_FOOT?)

+rep for helpers! :)
 

Infinity.4Sk

New Member
Reaction score
6
Im not really sure but maybe the hook has to somehow 'ignore' doodads like trees and gold mines and other objects dont know how to do this but i think thats what u have to do:confused:
 

KvickaN

TH.net Regular
Reaction score
24
Im not really sure but maybe the hook has to somehow 'ignore' doodads like trees and gold mines and other objects dont know how to do this but i think thats what u have to do:confused:

Exactly, its going to be easy for the ones knowing JASS to help me with this :)
 

N-a-z-g-u-l

New Member
Reaction score
30
1. i dont see anything in the script which could stop the spell when there is a tree...

2.
Code:
    constant unittype UNIT_TYPE_HERO                        = ConvertUnitType(0)
    constant unittype UNIT_TYPE_DEAD                        = ConvertUnitType(1)
    constant unittype UNIT_TYPE_STRUCTURE                   = ConvertUnitType(2)

    constant unittype UNIT_TYPE_FLYING                      = ConvertUnitType(3)
    constant unittype UNIT_TYPE_GROUND                      = ConvertUnitType(4)

    constant unittype UNIT_TYPE_ATTACKS_FLYING              = ConvertUnitType(5)
    constant unittype UNIT_TYPE_ATTACKS_GROUND              = ConvertUnitType(6)

    constant unittype UNIT_TYPE_MELEE_ATTACKER              = ConvertUnitType(7)
    constant unittype UNIT_TYPE_RANGED_ATTACKER             = ConvertUnitType(8)

    constant unittype UNIT_TYPE_GIANT                       = ConvertUnitType(9)
    constant unittype UNIT_TYPE_SUMMONED                    = ConvertUnitType(10)
    constant unittype UNIT_TYPE_STUNNED                     = ConvertUnitType(11)
    constant unittype UNIT_TYPE_PLAGUED                     = ConvertUnitType(12)
    constant unittype UNIT_TYPE_SNARED                      = ConvertUnitType(13)

    constant unittype UNIT_TYPE_UNDEAD                      = ConvertUnitType(14)
    constant unittype UNIT_TYPE_MECHANICAL                  = ConvertUnitType(15)
    constant unittype UNIT_TYPE_PEON                        = ConvertUnitType(16)
    constant unittype UNIT_TYPE_SAPPER                      = ConvertUnitType(17)
    constant unittype UNIT_TYPE_TOWNHALL                    = ConvertUnitType(18)    
    constant unittype UNIT_TYPE_ANCIENT                     = ConvertUnitType(19)
    
    constant unittype UNIT_TYPE_TAUREN                      = ConvertUnitType(20)
    constant unittype UNIT_TYPE_POISONED                    = ConvertUnitType(21)
    constant unittype UNIT_TYPE_POLYMORPHED                 = ConvertUnitType(22)
    constant unittype UNIT_TYPE_SLEEPING                    = ConvertUnitType(23)
    constant unittype UNIT_TYPE_RESISTANT                   = ConvertUnitType(24)
    constant unittype UNIT_TYPE_ETHEREAL                    = ConvertUnitType(25)
    constant unittype UNIT_TYPE_MAGIC_IMMUNE                = ConvertUnitType(26)

that are the only UNIT_TYPE variables... i dont think it is possible to check if the unit has foot-movement... (perhaps you could create a unit in water and see what happens, it acts different from other movement types, but thats quite complicated)
 
S

sinners_la_b

Guest
If you want it to only effect foot movement, you will have to settle for UNIT_TYPE_GROUND as i dont think there is a foot movement constant. Note that UNIT_TYPE_GROUND will effect hovering units as well.
 

Infinity.4Sk

New Member
Reaction score
6
the pudges in the map can slowly go through trees so the hook should only hit something that moves by foot making it ignore all other types so if you make that only hit movement type foot part this will mean that any amphibious movement or horse or hover is not affected this would however solve the problem
 

KvickaN

TH.net Regular
Reaction score
24
Changed so pudges cant go thure the trees anymore and ill try GROUND instead now.

Oh and when the hook hits a tree it bounces at the side... I want it to go right thrue.

+rep for helpers, thanks.

Ground worked, thanks.

Just want the hook to ignore all objects now... :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    Actually I was just playing with having some kind of mention of the food forum and recipes on the main page to test and see if it would engage some of those people to post something. It is just weird to get so much traffic and no engagement
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top