Author Topic: Axem's Script & Lua SEXP Collection  (Read 3400 times)

0 Members and 1 Guest are viewing this topic.

Offline Axem

  • Administrator
  • 211
Re: Axem's Script & Lua SEXP Collection
Dunno what's up with that early targeting. I can't reproduce it and the script says it should be unstealthed when its warping in. For a third of a second I don't think it's worth it too much to dive into since it doesn't look like anything super obvious.

So I've committed some new lua sexps as well as updates to a few other scripts.

New:
Misc Functions: A variety of misc lua sexps that can aid a FREDder to do some neat stuff. Like forcing a target for the player, getting the player's target, reversing waypoints and other fun stuff.
Scroll Write: Add cheesy one character at a time subtitle reveals, complete with sound effects!
Waypoint Assist: A system to help guide the player through waypoints with a pointer object. FREDder can keep track of which waypoint the player is at or if waypoints are completed.

Updated:
Cloak: Forcing the cloak now works properly
In Mission Jump: For the AI, play dead orders now cleared after jumping, the ship-maneuver lasts shorter, which in conjunction with a now 2 second minimum transit time, allows the AI ship to slow down to zero before jumping back in without any odd orientation errors when the ship is pointing up on the y-axis. The player is not bound by these restrictions. (I hope this solves your issues with fighters jumping, Nightmare!)
Loading Screen: Added a scale zoom option so backgrounds will be intelligently scaled for the resolution being used. Intelligently scaled means no stretching or skewed aspect ratio. Portions of the background may be clipped to fit.
Prompt Box: When using repeating events, stuff can get screwed up because the last answer to a reference is always kept. So 'lua-clear-prompt' was added to clear the reference can be cleared.

 
Re: Axem's Script & Lua SEXP Collection
Quote
In Mission Jump: For the AI, play dead orders now cleared after jumping, the ship-maneuver lasts shorter, which in conjunction with a now 2 second minimum transit time, allows the AI ship to slow down to zero before jumping back in without any odd orientation errors when the ship is pointing up on the y-axis. The player is not bound by these restrictions. (I hope this solves your issues with fighters jumping, Nightmare!)

That works now, thanks! :nod:
However... there are some things that work (different):
-most importantly, when I have a ship jumping out with the player following a couple seconds later into subspace, the game now throws out a debug warning:
Code: [Select]
LUA ERROR: [string "imjump-sct.tbm - On Game Init"]:81: attempt to index local 'entry' (a nil value)

------------------------------------------------------------------
ADE Debug:
------------------------------------------------------------------
------------------------------------------------------------------


------------------------------------------------------------------

stack traceback:
[C]: ?
[string "imjump-sct.tbm - On Game Init"]:81: in function 'Monitor'
[string "imjump-sct.tbm - On Frame"]:265: in main chunk
------------------------------------------------------------------

------------------------------------------------------------------

Aside the debug warning, it does not seem to have any other negative side effects. I compared it with the old script; the error only occurs with the new version. To make sure it isn't the result of some other broken script in my mod I tested it with WoD - it worked fine with the original, but again errors with the new one.

-Probably a minor thing: since the player won't move anymore inside of the subspace tunnel, the warp just forms in front of the player without moving towards it.
-Just an idea: maybe run the set-motion-debris-override SEXP when the player is inside the tunnel?


Regarding the Scroll Write script: it's a super neat thing, but could you add some documentation (and a sample) for showing the fiction files with lua-scroll-write-file? In my cluelessness I tried to feed it with the next best fiction file I had and it crashed immediatly... :(

 

Offline Axem

  • Administrator
  • 211
Re: Axem's Script & Lua SEXP Collection
Kay, I think I fixed the issues.

Not sure why that entry is nil error started popping up. It might have to do with how the player and AIs now will be forced to do things a little differently. I just did a simple check to see if the entry is valid or not. 99% of the time that solves the issue, but if it looks like something weird is happening let me know. I also made the player continue on the ship-maneuver thing for longer so you should hit the warp portal.

The scroll write file thing I also fixed (and added an example mission and fiction file). There is no special syntax or format. Just any text file will work. I hadn't actually tested it recently. I wrote the script over a year ago and it worked then, but since then the file handling with lua has gotten stricter and the script did not keep up. My bad on that one. :blah: (I did test it so it's all good now!)

 
Re: Axem's Script & Lua SEXP Collection
Beautiful work you did there! :) :yes:

 

Offline Axem

  • Administrator
  • 211
Re: Axem's Script & Lua SEXP Collection
Posted some updates, bug fixes for some, and some new stuff.

There's a "GetClosest' script which will find you the closest ship from a given team from a given origin. That ship is put into a sexp string variable. Use that for mines or something.

Misc-functions got an update with some stuff that BtA was using. If you want a quick way to make stuff untargetable or lock keys for cutscenes, check that out. There's also some other misc BtA scripts that I just added a LuaSEXP passthrough basically.

I also made a new version of the turret hotkey script. It's pretty much a straight rewrite of the one that MadProf made in 2011. There are now better ways to call it and better hooks to make things reliable. But it's still very low key. tcrayford's Critical Subsystem Script is much more flashy and neato so really, use that one. :cool:

The next big script I'm slowly working on is an update to the save-load script. I never used it because it seemed like a giant pain, and I preferred to be softer with checkpoints, not really wanting to doom the player to 4% hull left after a checkpoint if they are that unlucky. Then mjn showed me what his missions look like with it and I was like "there must be a better way".

The plan for the script is you call "lua-save-state" and it saves everything. You call "lua-load-state" and it loads the saved data to what it can that is present. Ships that aren't present will get their data preloaded where possible, so all the FREDder will need to do is make sure they arrive and everything is taken care of. There will be some flags and options if you just want to load only position, orientation and whatnot.