Adding a Boss/custom Enemy

Place to get help with not working mods / modding interface.
Factorimon
Burner Inserter
Burner Inserter
Posts: 6
Joined: Sat Feb 25, 2017 8:06 pm
Contact:

Adding a Boss/custom Enemy

Post by Factorimon »

Hi,

I'd like to write a mod that introduces a new type of enemy. It should be like a boss with lots of HP, spawn at random position, constantly moving in random directions, slowing down when attacked and destroying anything in its path. It's supposed to be the only enemy unit (biters turned off completely) and force the player/s to flee, leaving his main base and rebuild somewhere else.


I have a lot of coding and some factorio modding experience.

I don't know how to create a new type of enemy, if it's even possible or if there any mods out there i can take a look at.

Any help is appreciated, perhaps somebody has seen a mod that creates new types of enemies or knows of a work-around
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Adding a Boss/custom Enemy

Post by eradicator »

Just search for "warfare" or "enemies" on the mod portal. There should be a number of mods that introduce new enemies (mostly recolored/rescaled biters). Hopefully you have a good 3D model for your new boss :P
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Factorimon
Burner Inserter
Burner Inserter
Posts: 6
Joined: Sat Feb 25, 2017 8:06 pm
Contact:

Re: Adding a Boss/custom Enemy

Post by Factorimon »

I did that and it turns out ppl are just modifying the biter parameters. I need to make changes to their behaviour and damage handler, that's where i'm stuck.

Maybe it just isn't possible..
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Adding a Boss/custom Enemy

Post by eradicator »

Going purely by the description i remember that https://mods.factorio.com/mods/Veden/Rampant supposedly introduces some new behavior. But you'll probably require heavy scripting for that (if it's really only just one enemy that shouldn't be a performance problem though).

Not sure what you mean with "damage handler".
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Factorimon
Burner Inserter
Burner Inserter
Posts: 6
Joined: Sat Feb 25, 2017 8:06 pm
Contact:

Re: Adding a Boss/custom Enemy

Post by Factorimon »

Lol, Rampant was one mod i was looking for but forgot the name. Thanks!

I had success modifying a biter in lua and then use the set_command() function on the entity to make it go to a position i specify even ignoring any damage sources. Hope to release the mod in the near future.
Factorimon
Burner Inserter
Burner Inserter
Posts: 6
Joined: Sat Feb 25, 2017 8:06 pm
Contact:

Re: Adding a Boss/custom Enemy

Post by Factorimon »

Is there any way to slow down an enemy via lua on run-time? I want my boss to slow down while he takes damage..
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Adding a Boss/custom Enemy

Post by darkfrei »

Factorimon wrote:Is there any way to slow down an enemy via lua on run-time? I want my boss to slow down while he takes damage..
Fast replace with another prototype. Factorio-style!

But here is no events.on_damage and you must check in by yourself.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Adding a Boss/custom Enemy

Post by eradicator »

Some "damage" types, like i.e the Slowdown capsule have the effect of...slowing down(!) the enemy :P. So as you'll already have to be hooked into on_tick anyway, just spawn some invisible slowdown capsules onto the boss.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Factorimon
Burner Inserter
Burner Inserter
Posts: 6
Joined: Sat Feb 25, 2017 8:06 pm
Contact:

Re: Adding a Boss/custom Enemy

Post by Factorimon »

Both excellent ideas. Unfortunately, i need the movement speed to decrease linear with the boss' HP.

Slowdown capsule effects don't stack, and i would need at LEAST 10 prototypes with different movement_speed to get the desired behaviour. Still, if there's no other way the latter seems to be the best option so far.

Is it possible to change the prototype on a unit or do i have to respawn the unit with a new prototype at the former position?

EDIT: is it possible to equip my boss-unit wih a power armor and exoskeletons? ^^
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Adding a Boss/custom Enemy

Post by eradicator »

Adding some prototypes isn't really a problem. You'd have to respawn the boss with current position/rotation/orientation/health etc, yes. And the respawning would interrupt the current animation obviously. I'm not sure if the slowdown effect strength can be defined on capsules (it probably can) in which case you could still use 10 different types of invisible slowdown capsules if the animation interruption looks too ugly.

I'm not sure if there's any prototype that has both an armor inventory/grid and a behavior. https://mods.factorio.com/mods/kyranzor/robotarmy has some things that look like vehicles, you might want to check what prototype they are internally.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Post Reply

Return to “Modding help”