Finding Unit Within Range Center Unit?

Squll2

je'ne sais pas
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

Super Mod
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
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() == 'A00G' 
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

Super Mod
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.
  • The Helper The Helper:
    what is this Ghan? https://enterprise.ghannet.com/ you are totally holding out on us my friend
  • Ghan Ghan:
    Not mine, I just ran the server. They let the domain expire but it was a cool project so I kept it alive there.
  • Ghan Ghan:
    Used to be enterpriserpg.com I think.
  • The Helper The Helper:
    If you go to the world editor tutorials site and click the starcraft link it takes you there :)
  • Ghan Ghan:
    lol
  • Ghan Ghan:
    I forgot about that alias name. (The full URL still went to the correct site.) That should be fixed.
  • Ghan Ghan:
    Silkroad Forums site really needs help.
  • Ghan Ghan:
    Its software has been out of support since 2017.
  • Ghan Ghan:
    The woes of using custom styles....
  • The Helper The Helper:
    does anyone still use silk road forums?
  • Ghan Ghan:
    It's about as active as here I'd say. Not much going on.
  • Wizard Wizard:
    I think it doesn't help that the silk road game isn't as popular any more I think. The only MMO I play these days is FFXIV like most other people I know.
  • The Helper The Helper:
    I checked a status page for players and it says the game has 500 daily players.
  • The Helper The Helper:
    I cannot believe that site is still going I wonder if Ryoko is involved with it at all would love to talk to him again and see what he is up to
  • The Helper The Helper:
    my oldest daughter failed her driving test today for her license she is 22 and yes I have been driving her everywhere her whole life
  • The Helper The Helper:
    Now they are blaming me on Facebook for her failure LOL I am accepting it because it is my failure I am her driving teacher even though she had certified driving instruction from the best place in town I for some reason cannot teach her how to drive this is frustrating
  • jonas jonas:
    I didn't get my license until I was 25
    +1
  • The Helper The Helper:
    Back in the old days when I was getting a license people were getting them at 16 yrs old and many were getting hardships so they could get them earlier. Almost nobody did not drive when they were able. Nowadays though....
  • Ghan Ghan:
    Why drive when there's Uber Eats?
    +2
  • The Helper The Helper:
    I hope Varine is OK have not heard from him in a while.
    +1
  • Ghan Ghan:
    Diablo 2 Resurrected launching in 9 days.
  • The Helper The Helper:
    Just got a new to me computer hope it will run it
  • jonas jonas:
    I would buy if it had better modding support than D2, like a small lua script engine or much less hardcoded stuff
  • Ghan Ghan:
    Lots of folks are upset that they aren't supporting mods.

    Members online

    No members online now.

    Affiliates

    Hive Workshop NUON Dome
    Top