Jump to content

Custom Fighters


FeelSoMoon

Recommended Posts

Hey people, I figured how to do the custom fighters finally.

 

Here's my method as I explained it over at Reddit.

 

OK, I'm going to explain how I did this.

 

Installation

 

First you need the Avorion Community Commands Package and install it.

 

We're basically using his "/fighter" command but we need the other files that it relies on.

 

Next you're going to need to swap out part of the code in the file inside your Avorion folder located at

\data\scripts\player\cmd\fighter.lua

 

Just open it up in notepad, Line 28 should start

function addFighter(player ....blah

 

Replace it with

function addFighter(player, weapontype, rarity, material, tech, amount, xmltype)

 

Scroll down to line 54 which starts

local fighter = GenerateFighterTemplate

 

After this line, add the following code

 

fighter.plan = LoadPlanFromFile("data/plans/" .. xmltype .. ".xml")
end

 

Now you can download my fighter plans from my Dropbox or get your own XML files and put them in the correct folder.

 

Put these in the avorion/data/ folder, ensure the files are correctly located in "plans" and not a subfolder.

 

That's it.

 

Usage

 

The way this works, I've added an argument that is passed to the fighter.lua which tells the game which plan to load for the fighter. So boot up your game, in the chat you can use the /fighter command

 

/fighter add <weapons> [rarity] [material] [tech] [qty] [xmltype]

 

For example

/fighter add chaingun uncommon trinium 20 1 BSG_ViperMk2

 

Adds an uncommon trinium Viper Mk2 with chaingun into your hanger. The quantity function doesn't work, not sure why.

 

The valid arguments that can be passed to Avi's script can be found on the link at the top of this post. I only added the xmltype.

 

xmltype is the name of the plan file you want to load without the .xml extension

 

You should be able to see the code and modify it for your own use, go nuts kids!

 

 

Link to comment
Share on other sites

This sounds quite exciting.

 

However, doing it that way, with a script, feels like cheating to me. We do not have to use any of our money, rare minerals, or weapons to craft them... do we?

 

Also, I plan to spend more and more of my Avorion time in multiplayer. And I highly doubt this mod would be considered by servers in it's present state.

 

Any chance that someone could make a version that would allow us to just interact with a station and buy one of a few different fighter styles, perhaps made with rarer and rarer ores the closer we are to the core? That would be super.

 

I'm hoping that Koonschi will eventually allow players to customize their fighters. And I seem to recall reading that this was planned. However, I do not find this on the wiki's list of upcoming features...

Link to comment
Share on other sites

I don't have lines, I have a clump. I'm not sure how to do this right.

Go download and install Notepad++ or any other proper editor that you might prefer.

emacs is also great ;D

 

it'll read formation properly unlike windows notepad

Link to comment
Share on other sites

  • 2 weeks later...

This sounds quite exciting.

 

However, doing it that way, with a script, feels like cheating to me. We do not have to use any of our money, rare minerals, or weapons to craft them... do we?

turretfactory.lua has a code to take credits/goods from the player at turret creation. Maybe that could be used in this mod? Come to think of it, this mod is a kind of fighter factory, minus the factory, so it makes sense to create a fighter factory.

 

Whoa Jebus, Fighter Factory!!! OK, going sideways on this thread but think about it. Found station -> Fighter Factory. Need more fighters? No problem, just tell us the specs, we'll make em for ya, cash or card, please?

 

Otherwise it's a good mod. I might use it when I decide to make a carrier cuz it's just a pain to replenish fighters now.

Link to comment
Share on other sites

Am I missing something?

It's not generating fighters when I use the correct example

(Note: I tested it before the edits and /fighter works okay. As soon as I add the lines though, the command stops working)

 

 

	--function addFighter(player, weapontype, rarity, material, tech, amount)
function addFighter(player, weapontype, rarity, material, tech, amount, xmltype)
	local err
	local ship = Entity(player.craftIndex)

	if not ship:hasComponent(ComponentType.Hangar) then
		return false, "Ship must have a hangar"
	end	

	weapontype, err = getType(weapons, weapontype, 0)
	if not weapontype then 
		return false, err
	end

	rarity, err = getType(rarities, rarity or 0, -1)
	if not rarity then
		return false, err
	end

	material, err = getType(materials, material or 0, 0)
	if not material then
		return false, err
	end

	local tech = math.max(1, tonumber(tech) or 6)
	local dps = Balancing_TechWeaponDPS(tech)

	local fighter = GenerateFighterTemplate(random():createSeed(), weapontype, dps, tech, Rarity(rarity), Material(material))
	fighter.plan = LoadPlanFromFile("data/plans/" .. xmltype .. ".xml")
	end

Link to comment
Share on other sites

Lol...yep, i can

 

Where OP's code says

fighter.plan = LoadPlanFromFile("data/plans/" .. xmltype .. ".xml")
end

 

Do not add the "end" (that basically causes the code to finish what it's doing prematurely.

 

So it should just look like:

		local fighter = GenerateFighterTemplate(random():createSeed(), weapontype, dps, tech, Rarity(rarity), Material(material))
	fighter.plan = LoadPlanFromFile("data/plans/" .. xmltype .. ".xml")

 

I've even had some fun mucking about with the ship design/scale. So basically...you can make your ship in the normal fashion, then copy it to the data/plans folder. Then when you run the \fighter command, use your plan.xml

 

Known Issue: The stats the fighters are created at reset after launching the fighters.

 

?interpolation=lanczos-none&output-format=jpeg&output-quality=95&fit=inside|700:1152&composite-to%3D%2A%2C%2A%7C2048%3A1152&background-color=black

 

Note: The size of the fighter doesn't dictate it's stats, even giant vipers in the home system only had 1-3 hp - This is related to the known issue; when creating the fighter using /fighter, launching the fighters seem to reset the stats to the seed of the current system. I'll have a little play and try jumping. See if that causes the stats to lock into place...at the very least, that'll act as a workaround

 

After testing: Turns out fighter scale did dictate its stats...but jumping didn't lock them. The little ones had 1hp and the big ones had 170

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...