Jump to content

Recommended Posts

Posted

Hi everyone. I would like to ask you experts: once I design a small mission, will ME generate a corresponding lua file somewhere?

For example a simple mission as shown in the screen

screen.jpg

Posted

Yes and no. Open the .miz with an archiving utility (it’s a zip file) and inside you’ll find a file called mission, which is basically a lua script. It won’t do much for you, because it ties deeply into the core binary, so you won’t learn a lot from studying the code except how to create units and define zones. 
 

So it rather depends on why you are looking for that mission file, and what you want to achieve or learn from it.

in any event, it’s worth a look.

Posted

Thanks for the reply.
Yes, I was already aware of the miz file, and I've also looked at the files inside it, but actually, it's not much help.
I wanted to understand more about very simple things, and to be able to do something independently. The various scripts "" MIST - MOOSE - CTLD- and many others "" are too complex for me and are used to do many things that for now I do not need.

Posted (edited)

Indeed, that file isn't helpful. Perhaps another approach may be more helpful - outline a simple task that you want to achieve in Lua, and I'm sure that we can come up with some demo code for you to explore and expand upon. After all, that's what every Lua scripter has to go through eventually 🙂 

IMHO, a good starting point is creating a simple skeleton 'shell' of a mission Lua script that does two things:

Finally, you start that script by invoking update once, and you are good to go. Once that shell works, you can start intercepting the world events that interest you, or test if something specific happened in update().

Something like this:

skel = {}

function skel:onEvent(event)
	if event.id == 31 then -- landing_after_eject
		-- handle this event if you are interested in it
	end
end

function skel.update()
	-- schedule next update invocation
	timer.scheduleFunction(skel.update, {}, timer.getTime() + 1)
	-- check states and act accordingly
	-- do something cool
end

function skel.start()
	world.addEventHandler(skel)
	update()
end

-- let's go!
skel.start()

Paste above in a START trigger as DOSCRIPT, and that's all.

(WARNING: typed freehand, may contain some errors).

Edited by cfrag
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...