#1
·
לפני 8 שנים
הכנתי כמה סקריפטים קצרים שבודקים Events בסימולטר
דוגמה לאחד מהם :
https://www.youtube.com/watch?v=cfUwIRYGtjE
הכי בסיסי:
[code:1]
trigger.action.outText('Good Day', 15) -- print on the screen for 15 seconds
var = 'nice day'
trigger.action.outText(var, 20) -- print var value
if var == 'nice day' then
trigger.action.setUserFlag('1', true) -- 1=flag number
end
[/code:1]
מי המריא?:
[code:1]
takeoff = {}
function takeoff😮nEvent(event)
if event.id == world.event.S_EVENT_TAKEOFF then
if event.initiator:getID() ~= nil then
u = event.initiator:getPlayerName()
trigger.action.outText(u .. ' just took off', 10)
end
end
end
world.addEventHandler(takeoff)
[/code:1]
אחוזי פגיעה עם תותחים:
מתאים ל f-15 (גם למוסטג, אבל עדיין בבדיקות)
[code:1]
t = 0
t1 = 0
t2 = 0
ammoCount = 0
per = 0
start = {}
function start😮nEvent(event)
if event.id == world.event.S_EVENT_SHOOTING_START then
if event.initiator:getPlayerName() ~= nil then
u = event.initiator:getPlayerName()
t1 = event.time
--trigger.action.outText(u .. ' just fired with guns', 10)
end
end
end
world.addEventHandler(start)
stop = {}
function stop😮nEvent(event)
if event.id == world.event.S_EVENT_SHOOTING_END then
if event.initiator:getPlayerName() ~= nil then
u = event.initiator:getPlayerName()
t2 = event.time
t = t2 - t1
ammoCount = ammoCount+(t*100) -- p-51 t*13.1578947*6 | f-15 t*100
end
end
end
world.addEventHandler(stop)
hitCount = 0
hit = {}
function hit😮nEvent(event)
if event.id == world.event.S_EVENT_HIT then
if event.initiator:getPlayerName() ~= nil then
u = event.initiator:getPlayerName()
hitCount = hitCount+1
per = 100/ammoCount*hitCount
trigger.action.outText(u .. ' Hit percent= ' .. per .. '%', 5)
end
end
end
world.addEventHandler(hit)
[/code:1]
זמן התחברות למתדלק:
Refueling Time -
[code:1]
--reset variables
t = 0
t1 = 0
t2 = 0
u = 0
maxT = 0
--refuel start event
fuelStart = {}
function fuelStart😮nEvent(event)
if event.id == world.event.S_EVENT_REFUELING then
if event.initiator ~= nil then
t1 = event.time
trigger.action.outText('REFUELING START', 10)
end
end
end
world.addEventHandler(fuelStart)
--refuel stop event
fuelStop = {}
function fuelStop😮nEvent(event)
if event.id == world.event.S_EVENT_REFUELING_STOP then
if event.initiator:getID() ~= nil then
u = event.initiator:getPlayerName()
t2 = event.time
trigger.action.outText('REFUELING STOP', 10)
t = t2-t1
trigger.action.outText(u .. ' Fueled for ' .. t .. ' seconds', 60)
if t > maxT then
trigger.action.outText(u .. ' has the longest refuel time' , 60)
maxT = t
end
end
end
end
world.addEventHandler(fuelStop)
[/code:1]
דוגמה לאחד מהם :
https://www.youtube.com/watch?v=cfUwIRYGtjE
הכי בסיסי:
[code:1]
trigger.action.outText('Good Day', 15) -- print on the screen for 15 seconds
var = 'nice day'
trigger.action.outText(var, 20) -- print var value
if var == 'nice day' then
trigger.action.setUserFlag('1', true) -- 1=flag number
end
[/code:1]
מי המריא?:
[code:1]
takeoff = {}
function takeoff😮nEvent(event)
if event.id == world.event.S_EVENT_TAKEOFF then
if event.initiator:getID() ~= nil then
u = event.initiator:getPlayerName()
trigger.action.outText(u .. ' just took off', 10)
end
end
end
world.addEventHandler(takeoff)
[/code:1]
אחוזי פגיעה עם תותחים:
מתאים ל f-15 (גם למוסטג, אבל עדיין בבדיקות)
[code:1]
t = 0
t1 = 0
t2 = 0
ammoCount = 0
per = 0
start = {}
function start😮nEvent(event)
if event.id == world.event.S_EVENT_SHOOTING_START then
if event.initiator:getPlayerName() ~= nil then
u = event.initiator:getPlayerName()
t1 = event.time
--trigger.action.outText(u .. ' just fired with guns', 10)
end
end
end
world.addEventHandler(start)
stop = {}
function stop😮nEvent(event)
if event.id == world.event.S_EVENT_SHOOTING_END then
if event.initiator:getPlayerName() ~= nil then
u = event.initiator:getPlayerName()
t2 = event.time
t = t2 - t1
ammoCount = ammoCount+(t*100) -- p-51 t*13.1578947*6 | f-15 t*100
end
end
end
world.addEventHandler(stop)
hitCount = 0
hit = {}
function hit😮nEvent(event)
if event.id == world.event.S_EVENT_HIT then
if event.initiator:getPlayerName() ~= nil then
u = event.initiator:getPlayerName()
hitCount = hitCount+1
per = 100/ammoCount*hitCount
trigger.action.outText(u .. ' Hit percent= ' .. per .. '%', 5)
end
end
end
world.addEventHandler(hit)
[/code:1]
זמן התחברות למתדלק:
Refueling Time -
[code:1]
--reset variables
t = 0
t1 = 0
t2 = 0
u = 0
maxT = 0
--refuel start event
fuelStart = {}
function fuelStart😮nEvent(event)
if event.id == world.event.S_EVENT_REFUELING then
if event.initiator ~= nil then
t1 = event.time
trigger.action.outText('REFUELING START', 10)
end
end
end
world.addEventHandler(fuelStart)
--refuel stop event
fuelStop = {}
function fuelStop😮nEvent(event)
if event.id == world.event.S_EVENT_REFUELING_STOP then
if event.initiator:getID() ~= nil then
u = event.initiator:getPlayerName()
t2 = event.time
trigger.action.outText('REFUELING STOP', 10)
t = t2-t1
trigger.action.outText(u .. ' Fueled for ' .. t .. ' seconds', 60)
if t > maxT then
trigger.action.outText(u .. ' has the longest refuel time' , 60)
maxT = t
end
end
end
end
world.addEventHandler(fuelStop)
[/code:1]
נערך לאחרונה: לפני 8 שנים · 6 עריכות
