Lua:
require ('notifications')
require ('timers')
local score = 0
local score1
function tp_ursa1 ( event )
local wws1 = "ursa_trigger"
local wwss1 = "ursa"
local ent11 = Entities:FindByName(nil, wws1)
local ent111 = Entities:FindByName(nil, wwss1)
local posx1 = math.random ( -1088, 1088 )
local posy1 = math.random ( -832, 832 )
local point11 = ent11:GetAbsOrigin()
local npc11 = "ursa_npc"
local urs1 = Entities:FindByName(nil,npc11)
local point1 = urs1:GetAbsOrigin()
if math.abs(point1.x - point11.x) <= 128 and math.abs(point1.y - point11.y) <= 128 then -- Триггер, реагирующий на приближение юнита
ent11:SetAbsOrigin(Vector(posx1,posy1,128))
ent111:SetAbsOrigin(Vector(posx1,posy1,128))
score = score + 1
Notifications:ClearTopFromAll()
Notifications:Top( nPlayerNumber, {text="Score:", class="NotificationMessage", style={color="red", ["font-size"]="45px"}, duration=5})
Notifications:Top( nPlayerNumber, {text=tostring(score), class="NotificationMessage", style={color="red", ["font-size"]="45px"}, duration=5, continue=true})
end
end
function Timer (event1)
local wws = "ursa_trigger"
local wwss = "ursa"
local ent = Entities:FindByName(nil, wws)
local ent1 = Entities:FindByName(nil, wwss)
local hero = event1.activator
local nPlayerNumber = hero:GetPlayerOwnerID()
local fCountdown = 10
Timers:CreateTimer(0, function()
if fCountdown > 0 then
Notifications:ClearBottomFromAll()
Notifications:Bottom( nPlayerNumber, {text=tostring(fCountdown), class="NotificationMessage", style={color="red", ["font-size"]="45px"}, duration=1})
fCountdown = fCountdown - 1
return 1
else
score1=score
local start = "Start_training"
local start1 = Entities:FindByName(nil, start)
start1:Enable()
Notifications:Bottom( nPlayerNumber, {text="Nice Job! Go to the fire to start over.", class="NotificationMessage", style={color="red", ["font-size"]="45px"}, duration=5})
Notifications:Bottom( nPlayerNumber, {text=tostring(score1), class="NotificationMessage", style={color="red", ["font-size"]="45px"}, duration=5})
ent:SetAbsOrigin(Vector(posx,posy,-500))
ent1:SetAbsOrigin(Vector(posx,posy,-500))
return nil
end
end)
end
Последнее редактирование: