Mission Scripting Question/Problem/Issue/blah

I want my 15 rapid-fire quantum torpedo launchers Uber-Defiant now! - Get help from modders. Share your work. Discuss modifications.
1, 2
posted on January 17th, 2012, 2:32 pm
I've been working on a set of FO tutorials to walk people through the basic differences between FO and stock and I've come across an issue. For some reason these monitors will not well "monitor":

Code: Select all
   function AntaresDone( monitor, arg )
      return EntityFinder( function(e)
                        return e.odf == "fed_antares_yardY.odf" and
                              e.player.number == 1
                        end ):findOne() ~= nil
   end

   function PlatformDone( monitor, arg )
      return EntityFinder( function(e)
                        return e.odf == "fed_platformY.odf" and
                              e.player.number == 1
                        end ):findOne() ~= nil
   end
   
   function completeObjective( monitor, hook )
      Objectives.objectives[hook.argument].state = true
      Objectives.visible = true
      monitor:stop()
   end

   Monitor( "AntaresDone", false, nil, AntaresDone, nil ):hook( "completeObjective", MonitorHook.Type.OnTrue, nil, completeObjective, 1 )   
   Monitor( "PlatformDone", false, nil, PlatformDone, nil ):hook( "completeObjective", MonitorHook.Type.OnTrue, nil, completeObjective, 2 )   


I know its something obvious but my brain can't see it. I've attached the whole .lua, this is actually spliced in from a second .lua but it does not work there either. Help is greatly appreciated thank you  :crybaby:

Attachments

Intro.txt
(6.7 KiB) Downloaded 269 times
posted on January 17th, 2012, 5:25 pm
Hi - not at home at the minute so can't validate your script properly, but I will in about 1 to 2 hours or so and get back to you.
posted on January 18th, 2012, 6:44 pm
I've attached all relevant material. The second set of objectives never trigger. right now you can jump to that part by doing the last objective of the first set and skipping the cinematic.

Attachments

Tutorial1.rar
(10.07 KiB) Downloaded 277 times
posted on January 18th, 2012, 6:48 pm
Thanks, will have a look now.
posted on January 19th, 2012, 12:55 am
Have had a look, the problem is that the odf property comes out in lowercase but the one you compare it against has uppercase characters.

Change these bits in the entity finder in the monitor functions:

Code: Select all
e.odf == "fed_antares_yardY.odf" and ...


To this:

Code: Select all
e.odf == string.lower("fed_antares_yardY.odf") and ...


Alternatively you can just use the all lowercase string (fed_antares_yardy.odf).

I'll add a note to the odf property to make it clear that it's lowercase.

The mission is looking good by the way :)
posted on January 19th, 2012, 3:32 pm
Thanks, much appreciated  :woot:, my goal is to make about 7 of them going through each of the current races and the universal changes to FO. Hopefully I can finish and before 3.5+ comes out. I also was wondering if there is a possibility of Co-Op functionality for missions at some point?
posted on January 20th, 2012, 6:14 pm
I'd like to be able to support co-op missions, but I don't really have any way of synchronizing across clients at the moment, unfortunately.
posted on January 22nd, 2012, 8:56 pm
In A1 there was an option for multiplayer called "Map Units" in addition to standard and a couple other options. Is it possible that was controlled by something that could be interfaced with? I know ST Legacy Modders were able to figure something like this out.
posted on January 23rd, 2012, 6:02 pm
Is there currently an easy way to get the vector position of a game object (ship)? I'm not finding a function for it in the hitchhikers guide. or a fadeout/in to white?
posted on January 23rd, 2012, 6:15 pm
For entity positions:
Entity

The position property. If the ship is called fish:

Code: Select all
local pos = fish.position;


Only have fade in/out to black at the moment, in the Cineractive class.
posted on January 23rd, 2012, 7:09 pm
Last edited by remore on January 23rd, 2012, 7:13 pm, edited 1 time in total.
that vector could be added to/modified to create a set of vector points, that could be added to a cinematic path around something, on the fly? thats my big question as there is no way that i can predict the future as to where something is built and have a cinematic shot prepaired for it since humans are the way they are and all.
posted on January 23rd, 2012, 8:44 pm
Last edited by Megadroid on January 23rd, 2012, 9:04 pm, edited 1 time in total.
Yep, can make paths in code.

Code: Select all

local cinematicPath = Path("cinematic_path")
cinematicPath:append( test.position )
cinematicPath:append( test2.position )
cinematicPath:append( test3.position )

--0.1 is speed, will need tweaking
Cineractive:lookFrom( cinematicPath, 0.1 )

posted on January 24th, 2012, 3:42 pm
I went home after you posted that, figured it out after pawing through the ShipDies.lua in the Premonitions pack. I'm also not using the :set( index, point) and :remove ( 1 ) correctly for some reason. I took the idea of a generating a path on the fly in the direction of creating a function to do it more easily. I've attached it as an includable .lua I was wondering if you had any ideas on how to improve it? The Tutorial as it stands now is done except for three things, most obvious are voiceovers, after that there is something I know can be done but my brain was blanking on it last night and it still escapes me today. The third problem is actually an odd bug that crashes the mission whenever I try to upgrade a platform (to phaser, sensor, etc). I don't know why.

Attachments

Tutorial1.zip
(17.63 KiB) Downloaded 295 times
posted on January 24th, 2012, 4:07 pm
Will have a look when I get home. For the crash, you may not be checking if entities are valid - if you store an entity for any period of time you should check the valid property before you use it again - if it is true, then you can use it.

This is due to the way replaceweapons work - it's not actually the same ship; checking valid will make it update the internal reference.
posted on January 24th, 2012, 7:53 pm
I'm so looking forward to that! Thank you so much for putting so much effort into it!
1, 2
Reply

Who is online

Users browsing this forum: No registered users and 5 guests

cron