через область, отслеживание дропа предмета в область, таймер, удаление и замену предмета. такой вот алгоритм. Это правило не сложно соблюдать: отвергая чужую идею, предложи взамен свою
Можно, но скорее всего поздно вечером по мск. И там да - jass код, нежели чем триггеры. Это правило не сложно соблюдать: отвергая чужую идею, предложи взамен свою
Stwirk, вот так это у нас сделано. Увы, это джасс.
Но поверь мне, на гуи это очень просто реализовать по той логике, что я описал выше.
globals rect BonfireRect=null integer BonfireTime=1488777 group BonfireGroup=CreateGroup() unit BonfireUnit endglobals
function Bonfire_move takes nothing returns nothing local timer t=GetExpiredTimer() local integer id=GetHandleId(t) local unit dammi=LoadUnitHandle(udg_Hash,id,0) local real tx=LoadReal(udg_Hash,id,1) local real ty=LoadReal(udg_Hash,id,2) local real angle=LoadReal(udg_Hash,id,3) local real distance=LoadReal(udg_Hash,id,4) local real speed=LoadReal(udg_Hash,id,5) local real x=GetUnitX(dammi) local real y=GetUnitY(dammi) local group g local unit f if distance<15. then call PauseTimer(t) call DestroyTimer(t) call FlushChildHashtable(udg_Hash,id) call KillUnit(dammi) set g=CreateGroup() call GroupEnumUnitsInRange(g,tx,ty,200.,null) loop set f=FirstOfGroup(g) exitwhen f==null if GetWidgetLife(f)>0.405 and not IsUnitType(f,UNIT_TYPE_STRUCTURE) then call UnitDamageTarget(f,f,GetRandomReal(60.,90.),true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_UNIVERSAL,null) call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\GyroCopter\\GyroCopterImpact.mdl",f,"head")) call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\GyroCopter\\GyroCopterImpact.mdl",f,"chest")) endif call GroupRemoveUnit(g,f) endloop call DestroyGroup(g) else call SetUnitX(dammi,x+speed*Cos(angle)) call SetUnitY(dammi,y+speed*Sin(angle)) call SaveReal(udg_Hash,id,4,distance-speed) endif set t=null set dammi=null set g=null set f=null endfunction
function Bonfire_Enum takes nothing returns nothing local item lot=GetEnumItem() local item lot2 local integer t local real x local real y local integer c local real r local real angle local timer ti local integer id if GetWidgetLife(GetEnumItem())>0.405 and (GetItemTypeId(GetEnumItem())=='I00H' or GetItemTypeId(GetEnumItem())=='I02K' or GetItemTypeId(GetEnumItem())=='I00A' or GetItemTypeId(GetEnumItem())=='I02J' or GetItemTypeId(GetEnumItem())=='I00I' or GetItemTypeId(GetEnumItem())=='I046' or GetItemTypeId(GetEnumItem())=='I01D' or (GetItemTypeId(GetEnumItem())=='I01P' and GetItemCharges(GetEnumItem())>2) or GetItemTypeId(GetEnumItem())=='I00N') then set t=LoadInteger(udg_Hash,GetHandleId(lot),BonfireTime) //deistvia dlia vzrivov herni vsiakoi// if GetItemTypeId(GetEnumItem())=='I02K' or GetItemTypeId(GetEnumItem())=='I00A' or GetItemTypeId(GetEnumItem())=='I02J' then if t>2 then set x=GetItemX(lot) set y=GetItemY(lot) set c=GetItemCharges(lot) call FlushChildHashtable(udg_Hash,GetHandleId(lot)) if GetItemTypeId(lot)=='I02J' then //dinamit call RemoveItem(lot) call GroupEnumUnitsInRange(BonfireGroup,x,y,350.,null) call DestroyEffect(AddSpecialEffect("ExplosionBIG.mdx",x,y)) loop set BonfireUnit=FirstOfGroup(BonfireGroup) exitwhen BonfireUnit==null call UnitDamageTarget(BonfireUnit,BonfireUnit,100.*c,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_UNIVERSAL,null) call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\RedDragonBreath\\RedDragonMissile.mdl",BonfireUnit,"chest")) call GroupRemoveUnit(BonfireGroup,BonfireUnit) endloop elseif GetItemTypeId(lot)=='I02K' then //poroh call RemoveItem(lot) call GroupEnumUnitsInRange(BonfireGroup,x,y,250.,null) call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\FragDriller\\FragDriller.mdl",x,y)) loop set BonfireUnit=FirstOfGroup(BonfireGroup) exitwhen BonfireUnit==null call UnitDamageTarget(BonfireUnit,BonfireUnit,GetRandomReal(30.,40.),true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_UNIVERSAL,null) call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\GyroCopter\\GyroCopterImpact.mdl",BonfireUnit,"head")) call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\GyroCopter\\GyroCopterImpact.mdl",BonfireUnit,"chest")) call GroupRemoveUnit(BonfireGroup,BonfireUnit) endloop elseif GetItemTypeId(lot)=='I00A' then //patroni call RemoveItem(lot) call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\FragDriller\\FragDriller.mdl",x,y)) call DestroyEffect(AddSpecialEffect("ExplosionBIG.mdx",x,y)) set t=0 loop exitwhen t>c set ti=CreateTimer() set id=GetHandleId(ti) set angle=GetRandomReal(0,6.28414143) set r=GetRandomReal(600.,1500.) call SaveUnitHandle(udg_Hash,id,0,CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE),'h025',x,y,angle*bj_RADTODEG)) call SaveReal(udg_Hash,id,1,x+r*Cos(angle)) call SaveReal(udg_Hash,id,2,y+r*Sin(angle)) call SaveReal(udg_Hash,id,3,angle) call SaveReal(udg_Hash,id,4,r) call SaveReal(udg_Hash,id,5,r/25.) call TimerStart(ti,0.035,true,function Bonfire_move) set t=t+1 endloop endif else call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl",GetItemX(lot),GetItemY(lot))) call SaveInteger(udg_Hash,GetHandleId(lot),BonfireTime,t+1) endif else //deistvia dlia gotovki edi// if t>8 then //remove item\add item set x=GetItemX(lot) set y=GetItemY(lot) set c=GetItemCharges(lot) call FlushChildHashtable(udg_Hash,GetHandleId(lot)) if GetItemTypeId(lot)=='I00H' then //svinina call RemoveItem(lot) set lot=CreateItem('I00K',x,y) call SetItemCharges(lot,c) elseif GetItemTypeId(lot)=='I00I' then //olenina call RemoveItem(lot) set lot=CreateItem('I00J',x,y) call SetItemCharges(lot,c) elseif GetItemTypeId(lot)=='I046' then //kuriatina call RemoveItem(lot) set lot=CreateItem('I047',x,y) call SetItemCharges(lot,c) elseif GetItemTypeId(lot)=='I01D' then //medveghatina call RemoveItem(lot) set lot=CreateItem('I01E',x,y) call SetItemCharges(lot,c) elseif GetItemTypeId(lot)=='I00N' then //grenki call RemoveItem(lot) set lot=CreateItem('I02W',x,y) call SetItemCharges(lot,4*c) elseif GetItemTypeId(lot)=='I01P' then //muka call RemoveItem(lot) set lot=CreateItem('I00N',x,y) call SetItemCharges(lot,c/3) if c>GetItemCharges(lot)*3 then set lot2=CreateItem('I01P',x,y) call SetItemCharges(lot2,c-GetItemCharges(lot)*3) endif endif else call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\GyroCopter\\GyroCopterMissile.mdl",GetItemX(lot),GetItemY(lot))) call SaveInteger(udg_Hash,GetHandleId(lot),BonfireTime,t+1) endif endif endif set lot=null set lot2=null set ti=null endfunction
function Trig_Bonfire_Actions takes nothing returns nothing call EnumItemsInRect(BonfireRect,null,function Bonfire_Enum) endfunction
//=========================================================================== function InitTrig_Bonfire takes nothing returns nothing set gg_trg_Bonfire = CreateTrigger( ) set BonfireRect=Rect(-637.7-150.,400-150.,-637.7+150.,400.+150) call TriggerRegisterTimerEvent(gg_trg_Bonfire, 1., true) call TriggerAddAction( gg_trg_Bonfire, function Trig_Bonfire_Actions ) endfunction
function Trig_BonfireFix_Conditions takes nothing returns boolean if GetIssuedOrderId()==OrderId("attack") and GetItemLevel(GetOrderTargetItem())==5 and GetOrderTargetItem() != null and RectContainsCoords(BonfireRect, GetItemX(GetOrderTargetItem()), GetItemY(GetOrderTargetItem())) then call PauseUnit(GetTriggerUnit(),true) call IssueImmediateOrder(GetTriggerUnit(),"stop") call PauseUnit(GetTriggerUnit(),false) call SimError(GetTriggerPlayer(),"Нельзя атаковать еду возле костра!") endif return false endfunction
//=========================================================================== function InitTrig_BonfireFix takes nothing returns nothing set gg_trg_BonfireFix = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_BonfireFix, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER ) call TriggerAddCondition( gg_trg_BonfireFix, Condition( function Trig_BonfireFix_Conditions ) ) endfunction
Это правило не сложно соблюдать: отвергая чужую идею, предложи взамен свою