Finding Unit Within Range Center Unit?

Squll2

je'ne sais pas
Reaction score
76
I actually have three queries, which I will explain in this post but first of all, is there an event response for finding the Unit Within Range Center Unit?

If you dont get what I mean, heres my code (uncompleted)

JASS:
function Trig_Forest_of_Alchemy_Start_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A00A'
endfunction

function Trig_Forest_of_Alchemy_Start_Actions takes nothing returns nothing

    local location l = GetSpellTargetLoc()
    local unit d
    local unit u = GetSpellAbilityUnit()
    local real x = GetLocationX(l)
    local real y = GetLocationY(l)
    local player p = GetOwningPlayer(u)
    
    set d = CreateUnit( p, 'h006', x, y, 0.00 )
    call TriggerRegisterUnitInRangeSimple( gg_trg_Forest_of_Alchemy, 600.00, d )
    
    call PolledWait(1.00)
    
    set p = null
    
endfunction

//===========================================================================
function InitTrig_Forest_of_Alchemy_Start takes nothing returns nothing
    set gg_trg_Forest_of_Alchemy_Start = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Forest_of_Alchemy_Start, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Forest_of_Alchemy_Start, Condition( function Trig_Forest_of_Alchemy_Start_Conditions ) )
    call TriggerAddAction( gg_trg_Forest_of_Alchemy_Start, function Trig_Forest_of_Alchemy_Start_Actions )
endfunction

Thats the intialization trigger, what im doing here as you can probably see it when a unit casts a spell it creates a unit, then adds that unit to a unit within range event to another trigger..

Heres the other trigger (incomplete)

JASS:
function Trig_Forest_of_Alchemy_Conditions takes nothing returns boolean

 local unit u = GetTriggerUnit()
 local unit e = GetEnteringUnit()
 
    if ( not ( IsUnitAliveBJ(e) == true ) ) then
        return false
    endif
    if ( not( IsUnitEnemy(e, GetOwningPlayer(u)) == true ) ) then
        return false
    endif
    return true
    
endfunction

function Trig_Forest_of_Alchemy_Actions takes nothing returns nothing

  local unit u    = GetTriggerUnit()
  local unit e    = GetEnteringUnit()
  local player p  = GetOwningPlayer(u)
  local integer I = GetRandomInt(0, 100)
  local real x    = GetUnitX(u)
  local real y    = GetUnitY(u)
  local unit d
  
  
 if I <= 20 then 
   set d = CreateUnit(p, 'h006', x, y, 0.00)
   call UnitAddAbility (d, 'A00B')
   call IssueTargetOrder(d, "entanglingroots", e)
   
 endif
 
 if I 
    
  
endfunction

//===========================================================================
function InitTrig_Forest_of_Alchemy takes nothing returns nothing
    set gg_trg_Forest_of_Alchemy = CreateTrigger(  )
    call TriggerAddCondition( gg_trg_Forest_of_Alchemy, Condition( function Trig_Forest_of_Alchemy_Conditions ) )
    call TriggerAddAction( gg_trg_Forest_of_Alchemy, function Trig_Forest_of_Alchemy_Actions )
endfunction

And here stems my other two problems, first off, how do I code something depending on the integer I equaling 20-40?

also, is there a way of cleaning up and simplizing the Conditions, surly there must be?

(The Conditions)
JASS:
function Trig_Forest_of_Alchemy_Conditions takes nothing returns boolean

 local unit u = GetTriggerUnit()
 local unit e = GetEnteringUnit()
 
    if ( not ( IsUnitAliveBJ(e) == true ) ) then
        return false
    endif
    if ( not( IsUnitEnemy(e, GetOwningPlayer(u)) == true ) ) then
        return false
    endif
    return true
    
endfunction


Thanks for all the help greatly appreciate it! +rep to anyone who can solve any of my problems!

PS: Where have the spoiler tags gone? :p :(
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
I actually have three queries, which I will explain in this post but first of all, is there an event response for finding the Unit Within Range Center Unit?

Take a look at my system: http://www.thehelper.net/forums/showthread.php?t=109299

It provides the "Center Unit" similar to the way you can get the Triggering Unit.

And here stems my other two problems, first off, how do I code something depending on the integer I equaling 20-40?

JASS:
if I >= 20 and I <= 40 then
 //Actions go here
endif


also, is there a way of cleaning up and simplizing the Conditions, surly there must be?

Yep. "or" and "and" are wonderful. :p

JASS:
function Trig_Forest_of_Alchemy_Conditions takes nothing returns boolean
 //local unit u = GetCenterUnit() //Perhaps you mean the Center unit?  This can be used through the system I linked above
 //local unit e = GetTriggerUnit() //This is the same as the Entering Unit.
    return IsUnitAliveBJ(GetCenterUnit()) and IsUnitEnemy(GetTriggerUnit(),GetOwningPlayer(GetCenterUnit()))
endfunction


PS: Where have the spoiler tags gone? :p :(

They aren't intended for these zones. They are intended to hide text that people aren't supposed to see until they know what they're going to see, not to hide a long code.
 

Squll2

je'ne sais pas
Reaction score
76
Thanks for all the help Darthfeet +rep

But is there any way to do that center unit A not in V jass and B without dling half a million programs ><?

Edit: I heard something about Vjass not wokring online or something? please explain and possibly link me to Vjass programs and tutorials I would be very greatful ^^ (I guess i should start learning it if it still works ^^)

Edit2: Anyone know whats wrong with this one.. its seriously irritatting me everything I do doesnt make it work -_-

JASS:
function Trig_Flask_of_Mind_Control_Conditions takes nothing returns boolean
  return GetSpellAbilityId() == &#039;A00G&#039; 
endfunction

function Trig_Moveit takes nothing returns nothing
    

    local location L = GetRectCenter(gg_rct_Player_Two_Unit_Sender)
    local real x = GetLocationX(L)
    local real y = GetLocationY(L)
    local location L2 = GetRectCenter(gg_rct_Player_9_Unit_Sender)
    local real x2 = GetLocationX(L2)
    local real y2 = GetLocationY(L2)
    local unit e
    
 if IsUnitType(GetEnumUnit(), UNIT_TYPE_STRUCTURE) == false and GetOwningPlayer(GetEnumUnit()) == Player(5) == true then
 
    set e = GetEnumUnit()
    set x = GetLocationX(L2)
    set y = GetLocationY(L2)   
     call SetUnitOwner( e, Player(11), true )
     call SetUnitPosition(e, x, y )

endif     

    
 if IsUnitType(GetEnumUnit(), UNIT_TYPE_STRUCTURE) == false and GetOwningPlayer(GetEnumUnit()) == Player(11) == true then
 
    set e = GetEnumUnit()
    set x = GetLocationX(L)
    set y = GetLocationY(L)   
     call SetUnitOwner( e, Player(5), true )
     call SetUnitPosition(e, x, y )

     
endif   
    
     
  call PolledWait(20.00)  
    set L = null
    set L2 = null

endfunction

function Trig_Flask_of_Mind_Control_Actions takes nothing returns nothing

    local real r = 450.00
    local location l = GetSpellTargetLoc()
    local real x = GetLocationX(l)
    local real y = GetLocationY(l)
    local group g
    local group g2

    
    call GroupEnumUnitsInRange(g, x, y, r, null)
    call PolledWait(0.30)
    call GroupAddGroup(g, g2)
    call PolledWait(0.30)
    call ForGroup(g2, function Trig_Moveit )
    call PolledWait(5.50)
    call DestroyGroup(g)
    set g  = null
    call DestroyGroup(g2)
    set g2 = null

endfunction

//==== Init Trigger NewTrigger ====
function InitTrig_Flask_of_Mind_Control takes nothing returns nothing
    set gg_trg_Flask_of_Mind_Control = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Flask_of_Mind_Control, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition(gg_trg_Flask_of_Mind_Control, Condition(function Trig_Flask_of_Mind_Control_Conditions))
    call TriggerAddAction(gg_trg_Flask_of_Mind_Control, function Trig_Flask_of_Mind_Control_Actions)
endfunction
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
But is there any way to do that center unit A not in V jass and B without dling half a million programs ><?

A. If you can find me a reliable attachment system for units and triggers. vJASS is now the standard for JASS programming..
B. All you need is JASS Newgen Pack, and the systems my script requires. If you don't want to get these, see A.

Edit: I heard something about Vjass not wokring online or something? please explain and possibly link me to Vjass programs and tutorials I would be very greatful ^^ (I guess i should start learning it if it still works ^^)

I have no idea where you got that one from. vJASS is fine for online games.

Jass Newgen Pack

You can find plenty of vJASS tutorials in our Tutorial Repository.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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 The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top