Derakon plays around with ideas

A place to discuss mods in development and concepts for new mods.
relanat
Militia Captain
Militia Captain
Posts: 941
Joined: Tue Nov 05, 2013 9:56 am

Excellent. I particularly like the spiral effect in the Mar 20 2:32am post. Also if you wanted to do a forum topic on weapons and effects I'm pretty sure that would be appreciated by new modders (esp. me).

And the Gatling howitzer is great fun! Probably better as omni or swivel on a large heavy ship though, but it makes getting away easy. Ship speed from recoil quickly gets up to maxSpeed for gunships.
And I like the particle turret. Very inventive. It seems to target the system center if there are no enemies around.
Derakon wrote: I'm inferring based on snippets of code I find lying around.
Um, that's modding! :lol: That's all I do until I can't work something out no matter how hard I try. Then start a new topic saying "How does this work" and problem solved.
digdug has an <Events> text that is very useful https://forums.kronosaur.com/viewtopic.php?f=8&t=7324.
The changelog and AE-FunctionHelp are mentioned below.
You can use fncHelp in the debug screen (er, deprecated; it has been replaced by 'help', see the function list for examples).
And the xelerus function explanations are probably the best resource around for modders IMO. shanejfilomena has a rar file of all these. See the Living Minutes Mod Announcement topic for a link to access this.
The wiki is there, the info is excellent and being updated but IMO navigation is too difficult.

To output text there are a number of functions.
I've seen some of these in your mod but listed here for everyone else.
printTo
plyMessage
objSendMessage

If you set the variable 'variableName' to '7' then the following code

Code: Select all

(printTo 'log variableName)
will print the '7' to the debug log so you can see what value 'variableName' has.

Code: Select all

(printTo 'console variableName)
will show the '7' in the debug screen.
Note: this code can either be placed in the mod code or entered into the debug screen.

If you've got a line of code working in the debug screen and want to transfer it to an xml file, wrap the code in double quotes. This is really easy thanks to gc's 'Home' and 'End' key compatibility in the debug screen (ty).

Code: Select all

(printTo 'log "(setq variableName 7)")
This will print '(setq variableName 7)' to the debug log where you can cut and paste it to the xml file. This may not seem very useful but if your line of code is a hundred characters long, it's a godsend. It also eliminates typos from retyping the code into the xml file.

Of particular use is 'plyMessage'. These are the messages that appears at the bottom of the screen and fade after a few seconds.
Example code (not necessarily working or generating errors, just as an example).

Code: Select all

(setq currentNodeListPos (find stationNodeList (sysGetNode)))
(plyMessage gPlayer "Current node pos found")
(setq nextNodeListPos (add currentNodeListPos 1))
(plyMessage gPlayer "Next node pos found")
(setq nextStationNode (@ stationNodeList nextNodeListPos))
(plyMessage gPlayer "Next node found")
(if (eq nextStationNode Nil)
	(block Nil
		(scrEnableAction gScreen 'actionFreight Nil)
		(scrSetActionDesc gScreen 'actionFreight (scrTranslate gScreen "actionFreight:LastStation"))
What will happen on running this code in your mod is hopefully three plyMessages at the bottom of the screen. If you only get one plyMessage then the second lot of code is faulty and that's where the problem is. Handy for finding the errant code if you're not sure what's happening. You can also do this in the options of 'switch' or 'if' code to find out which code is running. See further down for a simplified example.

You can also use 'objSendMessage' to send similar messages from other objects so you know they are responding as you want. So if you shoot at a ship that ship can '(objSendMessage gPlayer theOtherShip "Ship hit")' so you know it is taking damage.

One last one; 'join'
Using this in the form (join list "\n") will give you a vertical list with one entry on every line, rather than the "absolutely horrific wall of text" that is generated by the game. Try it with (typFind 's) then (join (typFind 's) "\n") in the debug screen for an example. Not really necessary for such a simple list but of great assistance with more complex lists This is particularly useful for printing to the debug log so you can cut and paste the list for reference. Note it needs to be in rtf format (so Wordpad) rather than Notepad (txt format) so the \n formatting works.


And AP's mod AE-FunctionHelp on the Multiverse is 'a wee ripper' (this translates as 'really good'). It enables you to get a function list for a particular game version. (Particularly useful if there is some tardiness involved in the forum updating (drums fingers on desk impatiently) :P :lol: ) So use it in 1.8b1 for a list of all the functions available in that version. Or in 1.7 to get available functions for that version. Although I'm not sure about backwards compatibility, there were a couple of game changes affecting the mod recently.
Also digdug maintains a changelog (https://forums.kronosaur.com/viewtopic.php?f=8&t=7316) which is excellent. You can search it for API numbers or function names, etc to work out how to use the functions or find when they were introduced to the game.

Finally, gc also introduced function shortcuts to the debug screen. You don't need to type 'printTo' in it's entirety. Just typ in '(pr' then press the 'Tab' button, then 'T', then 'Tab' again. End result: '(printTo'. This is even better with longer function names and works for variables as well.
Derakon wrote: Also, how do I output text? The dbgOutput function I saw on the wiki doesn't seem to do anything
I'd never used dbgLog and dbgOutput before. I did some quick testing and they appear to work exactly the same as printTo 'log and 'console but (according to the function list) only if the game runs in debug mode. The only thing I can think of is the code wasn't running so you never got any output. Or possibly, did you have the dbgOutput code inside the variables brackets? If so, maybe this was affecting it. Dunno.
Try putting two options for dbgOutput in an 'if' section of code.

Code: Select all

(if (eq 1 1)
	(dbgOutput "Yes, equal")
	(dbgOutput "No, unequal")
)
Run that and see what happens. Then change it to (eq 1 2) and the other should show. An easy way is to put it in a weapon so the code runs as you fire the weapon.
Or, as AP says, use 'printTo'.
Derakon wrote: Also, when are mods loaded? Do I need to restart Transcendence each time I want to tweak my XML? For that matter, do I need to create a new pilot when editing a weapon, or will old pilots that already have an item with the weapon's UNID pick up changes when I make them?
I'd really like some info on this as well. I generate hundreds of new games when modding, and although the '0' Delete & Quit debug option is really helpful here the loading time (esp for Part 2) really chews up time.
Last edited by relanat on Tue Mar 27, 2018 10:45 am, edited 2 times in total.
Stupid code. Do what I want, not what I typed in!
Derakon
Militia Lieutenant
Militia Lieutenant
Posts: 175
Joined: Sat Jan 21, 2017 2:53 am

Wow, thank you! There's some great info in there.

Regarding mod loading, what I've determined is that if you have an existing ship equipped with the weapon you're testing, you don't need to make a new game; the ship will pick up changes to weapon logic/behavior automatically. However it won't pick up if you add new gear to the ship. I would assume that concept holds for other aspects of mods; anything in the mod that controls how stuff is generated needs to be present at the time the game generates the things in question (systems, ships, etc.), while mods that change how things behave once generated can be iterated on without having to regenerate over and over again.

I've seen some modders spawn in new ships/stations using the debug screen, which I guess could be used to test at least some behaviors that kick in at generation time. Anything that controls e.g. the distribution of stations in a system however, you're pretty well stuck just making a new save; I don't think there's a "generate a new level-N system" function, or a "regenerate the current system" function.
Derakon
Militia Lieutenant
Militia Lieutenant
Posts: 175
Joined: Sat Jan 21, 2017 2:53 am

I tried to make a weapon that would, on impact, spawn a new bullet aimed at a nearby target, and so on until everything nearby had been hit. Unfortunately, instead the weapon would, on impact, spawn a new bullet on top of the player, hit the player, spawn a new bullet on top of the player, hit the player, etc....basically, you'd shoot something and you'd die.

So instead I made a swarm of bees. The theory was that they'd knock ships around and intercept bullets, but they seem to be more interested in paralyzing ships. I may tweak their logic a bit so they're more likely to target other ships.
User avatar
DigaRW
Militia Captain
Militia Captain
Posts: 517
Joined: Thu Jul 30, 2015 3:10 pm
Location: The place where I belong
Contact:

Derakon wrote:
Tue Apr 03, 2018 3:50 am
I tried to make a weapon that would, on impact, spawn a new bullet aimed at a nearby target, and so on until everything nearby had been hit. Unfortunately, instead the weapon would, on impact, spawn a new bullet on top of the player, hit the player, spawn a new bullet on top of the player, hit the player, etc....basically, you'd shoot something and you'd die.
It seems like reflective weapon, if you want to want to make something like that, see this thread.
https://forums.kronosaur.com/viewtopic.php?f=8&t=8245

I don't know how to make the new bullet aim at new target like omni weapon does. But if it tracking, it should not have any problem.
Download Transcendence mods from Reinvented Workbench Project!
Click this link!
Derakon
Militia Lieutenant
Militia Lieutenant
Posts: 175
Joined: Sat Jan 21, 2017 2:53 am

I'm giving up on the chain lightning gun for now; too much fiddliness. Instead, I made a repulsor wave consumable. I don't have much of any idea how useful this would be in practice; presumably not as useful as Defense/Sustain (let alone Circle of Wrath / Shatter), but in a purchaseable form you could use it more often. Too bad using consumables has a somewhat clunky UI, even if you assign hotkeys to the item.
PM
Fleet Admiral
Fleet Admiral
Posts: 2570
Joined: Wed Sep 01, 2010 12:54 am

digdug and/or Atarlost made a projectile chain lightning gun in one of the (old) Weapons Extended mods years ago. Perhaps look it up at Xelerus for clues?

I made a hitscan chain lightning gun in my Drake Technologies mod, but it is quite the mess. I mean to update it one day (with less code), if I can get straight continuousBeam effects (as opposed to attacks) to be drawn to any arbitrary distance.
Download and Play in 1.9 beta 1...
Drake Technologies (Alpha): More hardware for combat in parts 1 and 2!
Star Castle Arcade: Play a classic arcade game adventure, with or without more features (like powerups)!
Playership Drones: Buy or restore exotic ships to command!

Other playable mods from 1.8 and 1.7, waiting to be updated...
Godmode v3 (WIP): Dev/cheat tool compatible with D&O parts 1 or 2.
Post Reply