-
Posts
16 -
Joined
-
Last visited
About DarK_FeneR996
- Birthday 12/08/1996
Personal Information
-
Flight Simulators
Digital Combat Simulator
-
Location
Sardinia, Italy
-
Interests
Gaming, Drift
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
Save variables for After Server Restart
DarK_FeneR996 replied to DarK_FeneR996's topic in Scripting Tips, Tricks & Issues
What do you mean with Remove LFS and IO from "Sanitization"? How? "Sanitize"? Antivirus Scan? -
Save variables for After Server Restart
DarK_FeneR996 replied to DarK_FeneR996's topic in Scripting Tips, Tricks & Issues
Really thank you mate, I will try it -
Hi all, I'd like to save some variables from a Lua script to use them after the server restart. Stupid exhample: -Lua script has the Variable "Lives" to 4, then saves it to somewhere (how???) -the server restarts -Lua reload from somewhere (how???) the Variable "Lives" (so set it back to 4 just as saved) Can anybody help? thanks for reading
-
Yesterday (24/Gen/2023) I got to teach how to use the PAL, VSL and other: I report as this guy did, the diamond got missing. When trying to use PAL it was able to lock, even without that diamond showing up. I fly the F14 by 3 years and I was in A/A mode. He's not wrong when he says that diamond was missing. The problem was gone when that other guy in F14 left the server. Idk why.
-
Still Nothing? :(
-
on searchObjects: parameter #2 (function) missed
DarK_FeneR996 replied to DarK_FeneR996's topic in Mission Editor
Yea mates thanks yesterday I found it out the way to store ejected pilot infos really thank you all ^-^ -
on searchObjects: parameter #2 (function) missed
DarK_FeneR996 replied to DarK_FeneR996's topic in Mission Editor
My intention is to find the EJECTED PILOT (not the chair). Using the CHAIR POS I wanna search for the EJECTED PILOT in that area. Once i get the pilot pos, I will use it to recover him with an heli, using a command near him SADLY I don't know what category is the Paratrooper (ejected pilot)... I took a look some threads but nothing solved. Suggestions? I just need how to find the paratrooper (ejected pilot) and then, later, get his position for recover mission EDIT: S_EVENT_DISCARD_CHAIR_AFTER_EJECTION I've just noticed this EVENT you mentioned (I missed it in the lists online) and seems it gets the pilot (paratrooper) position. Am I right? -
Did u solved?
-
Hey there guys, I'm having troubles all day with this new function (for my knowledge)... Can anyone explain me what's wrong? local debug = false local EventHandl = {} local ParatroopObjType = {Object.Category.UNIT, Object.Category.STATIC, Object.Category.SCENERY, Object.Category.WEAPON} Parat = {} Parat.SelfOBJ = {} Parat.EjectedBy = {} PilotLives = {} paraTroopID = 0 ParatroopSphereSrc = { id = world.VolumeType.SPHERE, params = { radius = 10.0, }, } world.addEventHandler(EventHandl) function EventHandl:onEvent(EventData) if EventData.id == world.event.S_EVENT_EJECTION then if EventData.initiator ~= nil and EventData.initiator:getPlayerName() ~= nil then local pName = EventData.initiator:getPlayerName() local ejSeatPos = EventData.target:getPosition().p ParatroopSphereSrc = { params = { point = ejSeatPos, }, } --Find object paratroop world.searchObjects(ParatroopObjType, ParatroopSphereSrc, pObj) --error here, parameter #2 (function) missed local pPos = Parat.SelfOBJ[paraTroopID]:getPosition().p trigger.action.outText("(" .. paraTroopID .. ")" .. "Chute Spotted by " .. pName .. "Obj SELFID: " .. Parat.SelfOBJ[paraTroopID]:getID() .. "\nPosX: " .. pPos.x .. "\nPosY: " .. pPos.y .. "\nPosZ: " .. pPos.z, 5) Parat.SelfOBJ[paraTroopID] = EventData.target --Memo paratrooper unique mission ID Parat.EjectedBy[paraTroopID] = pName --Memo initiator name paraTroopID = paraTroopID + 1 end end ParatroopSphereSrc = { params = { point = nil, }, } end local pObj = function(foundItem, val) Parat.SelfOBJ[paraTroopID] = foundItem:getID() return true end trigger.action.outText("Paratroopers Script loaded", 5) Thanks for help
-
Attemp to index global 'UNIT' (a nil value)
DarK_FeneR996 replied to DarK_FeneR996's topic in Mission Editor
YAY! After this I changed it and it works (I got some errors in function "function isAnyKrashGndUnit(uname)" but I solved it by myself) Really thank you guys for your time ^-^ Here is the fine script, maybe it can be useful as exhample for others ... UnitsCheck = { 'Krashnodar Armor-1-1', 'Krashnodar Armor-1-2', 'Krashnodar Armor-1-3', 'Krashnodar Armor-1-4', 'Krashnodar Armor-1-5', 'Krashnodar Armor-1-6', 'Krashnodar Armor-1-7', 'Krashnodar Armor-1-8', 'Krashnodar Armor-1-9', 'Krashnodar Armor-1-10', 'Krashnodar Armor-1-11', 'Krashnodar Armor-1-12', 'Krashnodar Armor-1-13', 'Krashnodar Armor-1-14', 'Krashnodar Armor-1-15', 'Krashnodar AAA-1-1', 'Krashnodar AAA-1-2', 'Krashnodar AAA-1-3', 'Krashnodar AAA-1-4', 'Krashnodar AAA-1-5', 'Krashnodar AAA-1-6', 'Krashnodar AAA-1-7', 'Krashnodar AAA-1-8', 'Krashnodar AAA-1-9', 'Krashnodar SAMrdr-1-1', 'Krashnodar SAMrdr-1-2', 'Krashnodar SAMrdr-1-3', 'Krashnodar SAMrdr-1-4', 'Krashnodar SAMrdr-1-5', 'Krashnodar SAMrdr-1-6', 'Krashnodar SAMrdr-1-7', 'Krashnodar SAMrdr-1-8', 'Krashnodar Sam-3-1', 'Krashnodar Sam-3-2', 'Krashnodar Sam-3-3', 'Krashnodar Sam-3-4', 'Krashnodar Sam-3-5', } local EventHandl = {} world.addEventHandler(EventHandl) function EventHandl:onEvent(EventData) if EventData.id == world.event.S_EVENT_HIT then trigger.action.outText('General Unit Hit', 2) end if EventData.id == world.event.S_EVENT_HIT and isAnyKrashGndUnit(EventData.target:getName()) then repeat local ACchose = mist.random(0, 2) if ACchose == 0 then if mist.random(0, 100) <= 70 then mist.cloneGroup('Krashnodar Plane-F14-1', true) else ACchose = -1 end end if ACchose == 1 then mist.cloneGroup('Krashnodar Plane-F16-1', true) end if ACchose == 2 then mist.cloneGroup('Krashnodar Plane-F18-1', true) end until ACchose ~= -1 --send alert message trigger.action.outText('Red AI Incoming', 2) end end function isAnyKrashGndUnit(uname) for unitid=1, 37 do if uname == UnitsCheck[unitid] then return true end end return false end -
Attemp to index global 'UNIT' (a nil value)
DarK_FeneR996 replied to DarK_FeneR996's topic in Mission Editor
Aw yea initially it was EventHandl:OnEvent(EventData) then I tried with EventHandl:OnEventHit(EventData) Okay, onEvent seems does't exists. By searching I was sure it is a dcs function. So, how do I run a script and get initiator and target from a event? this world.addEventHandler(EventHandl) should keep those data, right? how can I call onEvent? I'm getting mad Or maybe i'm misunderstanding you -
Attemp to index global 'UNIT' (a nil value)
DarK_FeneR996 replied to DarK_FeneR996's topic in Mission Editor
Now I'm getting the error "attempt to call onevent (a nil value)". Any suggestion? local UnitsCheck = { 'Krashnodar Armor-1-1', 'Krashnodar Armor-1-2', 'Krashnodar Armor-1-3', 'Krashnodar Armor-1-4', 'Krashnodar Armor-1-5', 'Krashnodar Armor-1-6', 'Krashnodar Armor-1-7', 'Krashnodar Armor-1-8', 'Krashnodar Armor-1-9', 'Krashnodar Armor-1-10', 'Krashnodar Armor-1-11', 'Krashnodar Armor-1-12', 'Krashnodar Armor-1-13', 'Krashnodar Armor-1-14', 'Krashnodar Armor-1-15', 'Krashnodar AAA-1-1', 'Krashnodar AAA-1-2', 'Krashnodar AAA-1-3', 'Krashnodar AAA-1-4', 'Krashnodar AAA-1-5', 'Krashnodar AAA-1-6', 'Krashnodar AAA-1-7', 'Krashnodar AAA-1-8', 'Krashnodar AAA-1-9', 'Krashnodar SAMrdr-1-1', 'Krashnodar SAMrdr-1-2', 'Krashnodar SAMrdr-1-3', 'Krashnodar SAMrdr-1-4', 'Krashnodar SAMrdr-1-5', 'Krashnodar SAMrdr-1-6', 'Krashnodar SAMrdr-1-7', 'Krashnodar SAMrdr-1-8', 'Krashnodar Sam-3-1', 'Krashnodar Sam-3-2', 'Krashnodar Sam-3-3', 'Krashnodar Sam-3-4', 'Krashnodar Sam-3-5', } local EventHandl = {} world.addEventHandler(EventHandl) function EventHandl:OnEventHit(EventData) if EventData.id == world.event.S_EVENT_HIT and isAnyKrashGndUnit(EventData.target:getName()) then repeat local ACchose = mist.random(0, 2) if ACchose == 0 then if mist.random(0, 100) <= 70 then mist.cloneGroup('Krashnodar Plane-F14-1', true) else ACchose = -1 end end if ACchose == 1 then mist.cloneGroup('Krashnodar Plane-F16-1', true) end if ACchose == 2 then mist.cloneGroup('Krashnodar Plane-F18-1', true) end until ACchose ~= -1 --send alert message local msg = {} msg.text = 'Red AI Incoming' msg.displayTime = 10 msg.msgFor = {coa = {'all'}} mist.message.add(msg) end end local function isAnyKrashGndUnit(uname) for unitid=1, 37 do if uname == UnitsCheck[unitid] then return true end end return false end -
Attemp to index global 'UNIT' (a nil value)
DarK_FeneR996 replied to DarK_FeneR996's topic in Mission Editor
1. I'm not using MOOSE 2. I though it was a dcs function (I've found it in some examples on a website with UNIT:findByName(). I confirm that was MOOSE website) so yea, I'm switching to Unit.getByName(). Right now I'm getting "Attempt to index global 'EVENTS' (a nil value)" --Line 14 I can see the 'EVENTS' is from MOOSE aswel, I will try to avoid it 3. Aw okay, nice to know, THX Really thank you for everything -
DarK_FeneR996 started following Attemp to index global 'UNIT' (a nil value)
-
local UnitsCheck = { "Krashnodar Armor-1-1", "Krashnodar Armor-1-2", "Krashnodar Armor-1-3", "Krashnodar Armor-1-4", "Krashnodar Armor-1-5", "Krashnodar Armor-1-6", "Krashnodar Armor-1-7", "Krashnodar Armor-1-8", "Krashnodar Armor-1-9", "Krashnodar Armor-1-10", "Krashnodar Armor-1-11", "Krashnodar Armor-1-12", "Krashnodar Armor-1-13", "Krashnodar Armor-1-14", "Krashnodar Armor-1-15", "Krashnodar AAA-1-1", "Krashnodar AAA-1-2", "Krashnodar AAA-1-3", "Krashnodar AAA-1-4", "Krashnodar AAA-1-5", "Krashnodar AAA-1-6", "Krashnodar AAA-1-7", "Krashnodar AAA-1-8", "Krashnodar AAA-1-9", "Krashnodar SAMrdr-1-1", "Krashnodar SAMrdr-1-2", "Krashnodar SAMrdr-1-3", "Krashnodar SAMrdr-1-4", "Krashnodar SAMrdr-1-5", "Krashnodar SAMrdr-1-6", "Krashnodar SAMrdr-1-7", "Krashnodar SAMrdr-1-8", "Krashnodar Sam-3-1", "Krashnodar Sam-3-2", "Krashnodar Sam-3-3", "Krashnodar Sam-3-4", "Krashnodar Sam-3-5", } for unitid = 0, 37 do local UnitName = UNIT:FindByName(UnitsCheck[unitid]) --error here, line 13 UnitName:HandleEvent(EVENTS.Dead) function UnitName:OnEventDead(EventData) repeat local ACchose = mist.random(0, 2) if ACchose == 0 then if mist.random(0, 100) <= 70 then mist.cloneGroup('Krashnodar Plane-F14-1', true) else ACchose = -1 end end if ACchose == 1 then mist.cloneGroup('Krashnodar Plane-F16-1', true) end if ACchose == 2 then mist.cloneGroup('Krashnodar Plane-F18-1', true) end until ACchose ~= -1 end --send alert message local msg = {} msg.text = 'Red AI Incoming' msg.displayTime = 10 msg.msgFor = {coa = {'all'}} mist.message.add(msg) end Hello, I'm new in lua scripting (some knowledge in c#-c++), and I cannot understand why I get this message. The units in the script are already spawned before this script runs... can anybody help me to solve this? THX