Problem with registering mission type

Post Reply
clausimu
Posts: 111
Joined: Tue Jan 06, 2015 8:31 pm

Problem with registering mission type

Post by clausimu »

Hello,

Sorry to bombard this forum with lua scripting questions...

I can't create new missions (Mission:New()). According to the wiki I should be able to just come up with any random mission type I want. But that doesn't work. It always complains that "NONE" is not a registered mission type. Even if I use a "normal" mission type like "Delivery" I still get the same error. I don't get that if I create a mission (Mission:New()) interactively in the game - just when loading a script. I then dug into the mission.lua script and figured I have to register the type I want to use before using it. But whenever I try that (i.e. Mission:RegisterType("test", "test", test)) I get the error: "error: [string "[T] @libs/Mission.lua"]:162: typeid: String expected". This happens interactively via the in-game console and in a script.

What am I missing? When I look at other scripts (such as DeliverPackage) I don't see that the mission type had to be registered before creating the mission.

I must be making some stupid mistake. Can anybody help me find it?

Thank you!
impaktor
Posts: 1029
Joined: Fri Dec 20, 2013 9:54 am
Location: Tellus
Contact:

Re: Problem with registering mission type

Post by impaktor »

Some parts of the wiki are slightly outdated on the mission scripting. Perhaps this helps:

L181 DeliverPackage.lua:

Code: Select all

		local mission = {
			type	 = "Delivery",
            ....
		}

		table.insert(missions,Mission.New(mission))
And L590:

Code: Select all

Mission.RegisterType('Delivery',l.DELIVERY,onClick)
I'm looking forward to seeing what you're working on.
Post Reply