"Fear"

Chaos_Knight

New Member
Reaction score
39
In JASS, vJASS, is making of a "Fear" spell possible? "Fear" is like when the [ljass]GetTriggerUnit()[/ljass] moves around in an Area and cant attack. ( I wont remove the ability ).

The Point variable should be like ( GUI )

Trigger:
  • Set TempPoint = (Position of (Triggering unit))

and
Trigger:
  • Set TempPos = (TempPoint offset by ((Random angle), (Random real number between 0.00 and (250.00 + (50.00 x (Real((Level of Fearing Attacks for (Triggering unit)))))))))


They are leaking, yes i know. Just for examples

and in JASS they become
[lJASS] set udg_TempPoint = GetUnitLoc(GetTriggerUnit())
set udg_TempPos = OffsetLocation(udg_TempPoint, GetRandomDirectionDeg(), GetRandomReal(0, ( 250.00 + ( 50.00 * I2R(GetUnitAbilityLevelSwapped('A010', GetTriggerUnit())) ) )))[/lJASS]
 

Chaos_Knight

New Member
Reaction score
39
It's possible, but I'm missing the question in the rest of the post.

I want the unit to randomly move around, in an area of [lJASS]250 + 50 * GetUnitAbilityLevel( u , ID )[/lJASS]

But this doesnt work for me.

now i got this. They move, but not the location i want to.

JASS:
scope FearingAttacks initializer Init

    globals
        
        private constant integer ID = 'A010'
        private constant string SFX = "DarkLightning.mdx"
        private constant string SFX1 = "GlaciarAura.mdx"
    endglobals
    
    private constant function CHANCE takes integer LVL returns integer
        return LVL * 100
    endfunction
    
    private constant function AoE takes integer lvl, real AOE returns integer
        return 250 + 50 * lvl
    endfunction
    
    private function Cons takes nothing returns boolean
        return IsPlayerEnemy(GetOwningPlayer(GetTriggerUnit()), GetOwningPlayer(GetAttacker())) and GetRandomInt(0, 100) <= CHANCE(GetUnitAbilityLevel(GetAttacker(), ID)) and IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == false and GetUnitAbilityLevel(GetAttacker(), ID) > 0
    endfunction
        
    private function Move takes nothing returns nothing
        local unit u = GetTriggerUnit()
        local unit r = GetAttacker()
        local integer i = 0
        local location TempPoint = GetUnitLoc(r)
        local location TempPos = OffsetLocation(udg_TempPoint, GetRandomDirectionDeg(), GetRandomReal(0, ( 250.00 + ( 50.00 * I2R(GetUnitAbilityLevel( r , ID)) ) )))
        loop
            exitwhen i == 20
                call TriggerSleepAction( 0.27 )
                call IssuePointOrderLoc( u , "move" , TempPos )
        endloop
   endfunction
    
    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ( t , EVENT_PLAYER_UNIT_ATTACKED )
        call TriggerAddAction( t , function Move )
        call TriggerAddCondition( t , function Cons )
    endfunction
endscope


JASS:
private function Move takes nothing returns nothing
        local unit u = GetTriggerUnit()
        local unit r = GetAttacker()
        local integer i = 0
        local location TempPoint = GetUnitLoc(r)
        local location TempPos = OffsetLocation(udg_TempPoint, GetRandomDirectionDeg(), GetRandomReal(0, ( 250.00 + ( 50.00 * I2R(GetUnitAbilityLevel( r , ID)) ) )))
        loop
            exitwhen i == 20
                call TriggerSleepAction( 0.27 )
                call IssuePointOrderLoc( u , "move" , TempPos )
        endloop
   endfunction


Is what doesnt work.

I know i dont use the constants, but i will add when i got the "move" to work.
 

Rushhour

New Member
Reaction score
46
JASS:
private function Move takes nothing returns nothing
        local unit u = GetTriggerUnit()
        local unit r = GetAttacker()
        local integer i = 0
        local location TempPoint = GetUnitLoc(r)
        local location TempPos 
        loop
            exitwhen i == 20
                call TriggerSleepAction( 0.27 )
                set TempPos=OffsetLocation(udg_TempPoint, GetRandomDirectionDeg(), GetRandomReal(0, ( 250.00 + ( 50.00 * I2R(GetUnitAbilityLevel( r , ID)) ) )))
                call IssuePointOrderLoc( u , "move" , TempPos )
                call RemoveLocation(TempPos)
        endloop
   endfunction

That's it?! You had one random location and didn't change it in your loop, but you could really improve this.
JASS:
private function Move takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit r = GetAttacker()
local integer i = 0
local real x =GetUnitX(r)
local real y=GetUnitY(r)
//..

        loop
            exitwhen i == 20
            call TriggerSleepAction( 0.27 )
            call IssuePointOrder(u, "move",x+GetRandomReal(0,360),y+ GetRandomReal(0, (250.00+ ( 50.00* I2R(GetUnitAbilityLevel(r,ID))))))
            set i=i+1 //you missed that
       endloop
set u=null
set r=null
endfunction
 

Chaos_Knight

New Member
Reaction score
39
JASS:

private function Move takes nothing returns nothing
        local unit u = GetTriggerUnit()
        local unit r = GetAttacker()
        local integer i = 0
        local location TempPoint = GetUnitLoc(r)
        local location TempPos 
        loop
            exitwhen i == 20
                call TriggerSleepAction( 0.27 )
                set TempPos=OffsetLocation(udg_TempPoint, GetRandomDirectionDeg(), GetRandomReal(0, ( 250.00 + ( 50.00 * I2R(GetUnitAbilityLevel( r , ID)) ) )))
                call IssuePointOrderLoc( u , "move" , TempPos )
                call RemoveLocation(TempPos)
        endloop
   endfunction

That's it?! You had one random location and didn't change it in your loop, but you could really improve this.
JASS:

private function Move takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit r = GetAttacker()
local integer i = 0
local real x =GetUnitX(r)
local real y=GetUnitY(r)
//..

        loop
            exitwhen i == 20
            call TriggerSleepAction( 0.27 )
            call IssuePointOrder(u, "move",x+GetRandomReal(0,360),y+ GetRandomReal(0, (250.00+ ( 50.00* I2R(GetUnitAbilityLevel(r,ID))))))
            set i=i+1 //you missed that
       endloop
set u=null
set r=null
endfunction

Thanks. +rep.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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