9

» WarCraft 3 / Утечка

NatriY, то что он работает вообще странно, но ошибка нашлась к счастью.
9

» WarCraft 3 / Local unit

function Trig_ShootTest_Actions takes nothing returns nothing


local unit marine = gg_unit_H000_0003
local unit Target = gg_unit_n000_0005
local real xMarine = GetUnitX(marine)
local real yMarine = GetUnitY(marine)
local real xTarget = GetUnitX(Target)
local real yTarget = GetUnitY(Target)
local real angle = bj_RADTODEG * Atan2(yTarget - yMarine, xTarget - xMarine) + GetRandomReal(-12.00, 12.00)
local unit Dummy = CreateUnit(GetOwningPlayer(marine), 'n001', xMarine, yMarine, angle)

local real maxDis = 1200
local real Damege = 50
local real Aoe = 90
local real Speed = 2000

local string BloodEfect = "Objects/Spawnmodels/Human/HumanBlood/HumanBloodKnight.mdl"

local timer TimerAct = CreateTimer()
local integer id = GetHandleId(TimerAct)
 
    if xMarine == xTarget and yMarine == yMarine then
        set angle = GetUnitFacing(marine)
    endif

call SetUnitX(Dummy, xMarine + 106 * Cos(angle * bj_DEGTORAD))
call SetUnitY(Dummy, yMarine + 106 * Sin(angle * bj_DEGTORAD))

call SaveUnitHandle(Hash, id, StringHash("marine"), marine)
call SaveUnitHandle(Hash, id, StringHash("Target"), Target)


call SaveReal(Hash, id, StringHash("Damege"), Damege)
call SaveReal(Hash, id, StringHash("maxDis"), maxDis)
call SaveReal(Hash, id, StringHash("Aoe"), Aoe)
call SaveReal(Hash, id, StringHash("angle"), angle)
call SaveReal(Hash, id, StringHash("Speed"), Speed * 0.03)
call SaveStr(Hash, id, StringHash("BloodEfect"), BloodEfect)
call SaveReal(Hash, id, StringHash("process"), 0)
call SaveGroupHandle(Hash, id, StringHash("group"), CreateGroup())




call SaveUnitHandle(Hash, id, StringHash("Dummy"), Dummy)
call DisplayTextToForce( GetPlayersAll(), "Shoot" )

call TimerStart(TimerAct, 0.03, true, function Trig_ShootTest_Actions2)
    
    
    call SetUnitAnimation( gg_unit_H000_0003, "attack" )

    call StopSoundBJ( gg_snd_GyrocopterImpactHit1, false )
    call PlaySoundBJ( gg_snd_GyrocopterImpactHit1 )
set marine = null
set Target = null
set Dummy = null
set TimerAct = null
    
endfunction
9

» WarCraft 3 / Остановка локального таймера

ImNoobTarenas, понятно я кое что напутал , теперь как остановить стрельбу с помощью таймера остановка вроде срабатывает но не совсем
function Trig_LMB1_Actions takes nothing returns nothing
local timer TimerAct2 = GetExpiredTimer()
local integer BB = GetHandleId(TimerAct2)
local real processs = LoadReal(Hash, BB, StringHash("processs"))


call DisplayTextToForce( GetPlayersAll(), "OFF" )
call PauseTimer(TimerAct2)
call DestroyTimer(TimerAct2)
call SaveReal(Hash, BB, StringHash("processs"), processs)
set TimerAct2 = null

 endfunction

function Trig_ShootTest_Actions3 takes nothing returns nothing
local timer TimerAct = GetExpiredTimer()
local integer id = GetHandleId(TimerAct)
local unit marine = LoadUnitHandle(Hash, id, StringHash("marine"))
local unit Target = LoadUnitHandle(Hash, id, StringHash("Target"))

local unit Dummy = LoadUnitHandle(Hash, id, StringHash("Dummy")) 
local real process = LoadReal(Hash, id, StringHash("process")) + LoadReal(Hash, id, StringHash("Speed"))
local group gACT
local unit u = null

 if process > LoadReal(Hash, id, StringHash("maxDis")) then
 call DestroyGroup(LoadGroupHandle(Hash, id, StringHash("group")))
 call KillUnit(Dummy)
 call FlushChildHashtable(Hash, id)
 call PauseTimer(TimerAct)
 call DestroyTimer(TimerAct)
 
else

 call SaveReal(Hash, id, StringHash("process"), process)
 call SetUnitX(Dummy, GetUnitX(Dummy) + LoadReal(Hash, id, StringHash("Speed")) * Cos(LoadReal(Hash, id, StringHash("angle")) * bj_DEGTORAD))
 call SetUnitY(Dummy, GetUnitY(Dummy) + LoadReal(Hash, id, StringHash("Speed")) * Sin(LoadReal(Hash, id, StringHash("angle")) * bj_DEGTORAD))
 
 set gACT =CreateGroup()
 call GroupEnumUnitsInRange(gACT, GetUnitX(Dummy),GetUnitY(Dummy), LoadReal(Hash, id, StringHash("Aoe")), null )
 
 loop
 
  set u = FirstOfGroup(gACT)
  exitwhen u == null
  
  if GetWidgetLife(u) > 0.405 and not IsUnitInGroup(u, LoadGroupHandle(Hash, id, StringHash("group"))) then
  
      if IsUnitEnemy(u, GetOwningPlayer(marine)) then
         call UnitDamageTarget(marine, u, LoadReal(Hash, id, StringHash("Damege")), false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null)
         call DestroyEffect(AddSpecialEffectTarget(LoadStr(Hash, id, StringHash("BloodEfect")), u, "chest"))
         call RemoveUnit(Dummy)
      else
      
      endif
  
  endif
  
  call GroupRemoveUnit(gACT, u)
  
  endloop
  
   call DestroyGroup(gACT)
   
  endif 
set Target = null
set marine = null
set Dummy = null
set TimerAct = null
set gACT = null

endfunction


function Trig_ShootTest2_Actions takes nothing returns nothing
local unit marine = gg_unit_H000_0003
local unit Target = gg_unit_n000_0005
local real xMarine = GetUnitX(marine)
local real yMarine = GetUnitY(marine)
local real xTarget = GetUnitX(Target)
local real yTarget = GetUnitY(Target)
local real angle = bj_RADTODEG * Atan2(yTarget - yMarine, xTarget - xMarine) + GetRandomReal(-6.00, 6.00)
local unit Dummy = CreateUnit(GetOwningPlayer(marine), 'n001', xMarine, yMarine, angle)

local real maxDis = 1200
local real Damege = 50
local real Aoe = 90
local real Speed = 2000

local string BloodEfect = "Objects/Spawnmodels/Human/HumanBlood/HumanBloodKnight.mdl"
local timer TimerAct = CreateTimer()
local integer id = GetHandleId(TimerAct)
local timer TimerAct2 = CreateTimer()
local integer BB = GetHandleId(TimerAct2)
call SaveReal(Hash, BB, StringHash("processs"), 0)
if xMarine == xTarget and yMarine == yMarine then
        set angle = GetUnitFacing(marine)
    endif

call SetUnitX(Dummy, xMarine + 106 * Cos(angle * bj_DEGTORAD))
call SetUnitY(Dummy, yMarine + 106 * Sin(angle * bj_DEGTORAD))

call SaveUnitHandle(Hash, id, StringHash("marine"), marine)
call SaveUnitHandle(Hash, id, StringHash("Target"), Target)
call SaveUnitHandle(Hash, id, StringHash("Dummy"), Dummy)

call SaveReal(Hash, id, StringHash("Damege"), Damege)
call SaveReal(Hash, id, StringHash("maxDis"), maxDis)
call SaveReal(Hash, id, StringHash("Aoe"), Aoe)
call SaveReal(Hash, id, StringHash("angle"), angle)
call SaveReal(Hash, id, StringHash("Speed"), Speed * 0.03)
call SaveStr(Hash, id, StringHash("BloodEfect"), BloodEfect)
call SaveReal(Hash, id, StringHash("process"), 0)
call SaveGroupHandle(Hash, id, StringHash("group"), CreateGroup())


call TimerStart(TimerAct, 0.03, true, function Trig_ShootTest_Actions3)

    call StopSoundBJ( gg_snd_GyrocopterImpactHit1, false )
    call PlaySoundBJ( gg_snd_GyrocopterImpactHit1 )
    
    call SetUnitAnimation( gg_unit_H000_0003, "attack" )

set marine = null
set Target = null
set Dummy = null
set TimerAct = null
set TimerAct2 = null


endfunction

function Trig_LMB21_Actions takes nothing returns nothing
local timer TimerAct2 = CreateTimer()
local integer BB = GetHandleId(TimerAct2)
call SaveReal(Hash, BB, StringHash("processs"), 0)
call DisplayTextToForce( GetPlayersAll(), "ON" )
call TimerStart(TimerAct2, 0.10, true, function Trig_ShootTest2_Actions)
set TimerAct2 = null
endfunction



function Trig_ShootTest2_Conditions takes nothing returns boolean  
     if ( not ( BlzGetTriggerPlayerMouseButton() == MOUSE_BUTTON_TYPE_RIGHT ) ) then
        return false
    endif
    return true
endfunction




//===========================================================================


Таймер не останавливается
function Trig_LMB22_Actions takes nothing returns nothing
local timer TimerAct2 = GetExpiredTimer()
local integer BB = GetHandleId(TimerAct2)



call DisplayTextToForce( GetPlayersAll(), "Off" )
call PauseTimer(TimerAct2)
call DestroyTimer(TimerAct2)

set TimerAct2 = null

 endfunction
 
 
 
 function Trig_LMB21_Actions takes nothing returns nothing
local timer TimerAct2 = CreateTimer()
local integer BB = GetHandleId(TimerAct2)
call SaveReal(Hash, BB, StringHash("processs"), 0)
call DisplayTextToForce( GetPlayersAll(), "On" )
call TimerStart(TimerAct2, 0.10, false, function Trig_LMB21_Actions)
set TimerAct2 = null
endfunction




 function Trig_LMB22_Conditions takes nothing returns boolean  
     if ( not ( BlzGetTriggerPlayerMouseButton() == MOUSE_BUTTON_TYPE_RIGHT ) ) then
        return false
    endif
    return true
endfunction
function Trig_LMB21_Conditions takes nothing returns boolean  
     if ( not ( BlzGetTriggerPlayerMouseButton() == MOUSE_BUTTON_TYPE_RIGHT ) ) then
        return false
    endif
    return true
endfunction

 
 
//===========================================================================
function InitTrig_LMB2 takes nothing returns nothing
    set gg_trg_LMB2 = CreateTrigger(  )
    
    call TriggerAddCondition( gg_trg_LMB2, Condition( function Trig_LMB22_Conditions ) )
    call TriggerAddCondition( gg_trg_LMB2, Condition( function Trig_LMB21_Conditions ) )

endfunction
9

» WarCraft 3 / Движение дамми юнита

rsfghd, когда делаю два события ошибку выдает

rsfghd, мне нужны примеры я просто сообразить не могу.
9

» WarCraft 3 / Движение дамми юнита

я его просто читаю и вижу кукиш😅

и как правильно этот loop выглядит еще хотелось бы знать ато ересь у меня какая-то
9

» WarCraft 3 / Движение дамми юнита

rsfghd, как в видосе бы только на мой лад твой код мне не очень прнятен.
9

» WarCraft 3 / Движение дамми юнита

rsfghd, я знаю вот по этому не могу Loop сделать и заствить кучу снарядов веером лететь.
9

» WarCraft 3 / Движение дамми юнита

rsfghd, мне бы еще разобраться как сделать мультишот на базе моего кода не могу Loop впихнуть почему-то на локалки ругается.
9

» WarCraft 3 / Движение дамми юнита

rsfghd, Не знаю как 😄

rsfghd, Нашел нужно было в переменную maxDist исправить на maxDis 😅
9

» WarCraft 3 / Движение дамми юнита

rsfghd, Дамик создается нормально в нужном направлении но не летит

Либо я тут что то напортачил
local timer TimerAct = GetExpiredTimer()
local integer id = GetHandleId(TimerAct)
local unit marine = LoadUnitHandle(Hash, id, StringHash("marine"))


local unit Dummy = LoadUnitHandle(Hash, id, StringHash("Dummy")) 
local real process = LoadReal(Hash, id, StringHash("process")) + LoadReal(Hash, id, StringHash("Speed"))
local group gACT
local unit u = null

 if process > LoadReal(Hash, id, StringHash("maxDist"))  then
 call DestroyGroup(LoadGroupHandle(Hash, id, StringHash("group")))
 call KillUnit(Dummy)
 call FlushChildHashtable(Hash, id)
 call PauseTimer(TimerAct)
 call DestroyTimer(TimerAct)
 
else

 call SaveReal(Hash, id, StringHash("process"), process)
 call SetUnitX(Dummy, GetUnitX(Dummy) + LoadReal(Hash, id, StringHash("Speed")) * Cos(LoadReal(Hash, id, StringHash("angle")) * bj_DEGTORAD))
 call SetUnitY(Dummy, GetUnitY(Dummy) + LoadReal(Hash, id, StringHash("Speed")) * Sin(LoadReal(Hash, id, StringHash("angle")) * bj_DEGTORAD))
 
 set gACT =CreateGroup()
 call GroupEnumUnitsInRange(gACT, GetUnitX(Dummy),GetUnitY(Dummy), LoadReal(Hash, id, StringHash("Aoe")), null )
 
 loop
 
  set u = FirstOfGroup(gACT)
  exitwhen u == null
  
  if GetWidgetLife(u) > 0.405 and not IsUnitInGroup(u, LoadGroupHandle(Hash, id, StringHash("group"))) then
  
      if IsUnitEnemy(u, GetOwningPlayer(marine)) then
         call UnitDamageTarget(marine, u, LoadReal(Hash, id, StringHash("Damege")), false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null)
         call DestroyEffect(AddSpecialEffectTarget(LoadStr(Hash, id, StringHash("BloodEfect")), u, "chest"))
      else
      
      endif
  
  endif
  
  call GroupRemoveUnit(gACT, u)
  
  endloop
  
   call DestroyGroup(gACT)
   
  endif 

set marine = null
set Dummy = null
set TimerAct = null
set gACT = null

endfunction
9

» WarCraft 3 / "SIMPLESTATUSBAR"

Фониус Персон, Главное показатель здоровья выноситься без проблем а вот показания опыта в списке функций не могу найти.