[Need Help] Adding Shields
[Need Help] Adding Shields
Hello, I was wondering how you would go about adding Shields to modded buildings and entities so they can have better protection.
Re: [Need Help] Adding Shields
Well, you should consider what are "entities" you want to add shields to.
A simple answer is: "you can only add shields as items to equipment grid, that is only vehicles and player-characters can have those".
Of course you can always invoke the power of lua and try to implement some equivalent to shield mechanics using scripts. Or to make your desired entities into vehicles\characters and implementing whatever other functionality you wanted from them.
A simple answer is: "you can only add shields as items to equipment grid, that is only vehicles and player-characters can have those".
Of course you can always invoke the power of lua and try to implement some equivalent to shield mechanics using scripts. Or to make your desired entities into vehicles\characters and implementing whatever other functionality you wanted from them.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
I also update mods, some of them even work.
Recently I did a mod tutorial.
Re: [Need Help] Adding Shields
Or invisible walls by this entities.
-
- Long Handed Inserter
- Posts: 92
- Joined: Sun Jun 18, 2017 2:21 pm
- Contact:
Re: [Need Help] Adding Shields
this is a cool idea. maybe making a invisible entity that gets created on top of the one built just with a slightly bigger hitbox, then when dmged the entity will create explosion with an animation that will simulate force-field like reaction to dmg....
edit- can you even overlap hitboxes like that?
edit- can you even overlap hitboxes like that?
Re: [Need Help] Adding Shields
You can use scripts to spawn entities which collision_box'es overlap. But the game lacks the concept "of on top". Unless you make your entities way smaller than force field range, biters will still be able to target the entity itself, and spiters will always be able to hit under the shield. That is, if they want to hit that. Only shotgun pellets would be reliably affected by the trick like that.
And another issue is the repair bots, which will try to fix your entities. You can set something as not reparable, but this is probably not something you want.
You could try to do things other way around, so that the main entity (a turret e.g) IS a shield which has the health = shield_health + core_health, and the dummy entity acts as a core health that is protected from damage. Then there is still the problem of the entity health synchronization: should the core health decrease because the biter has hit the shield or should the shield health go up since the core is being repaired?
And another issue is the repair bots, which will try to fix your entities. You can set something as not reparable, but this is probably not something you want.
You could try to do things other way around, so that the main entity (a turret e.g) IS a shield which has the health = shield_health + core_health, and the dummy entity acts as a core health that is protected from damage. Then there is still the problem of the entity health synchronization: should the core health decrease because the biter has hit the shield or should the shield health go up since the core is being repaired?
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
I also update mods, some of them even work.
Recently I did a mod tutorial.
-
- Long Handed Inserter
- Posts: 92
- Joined: Sun Jun 18, 2017 2:21 pm
- Contact:
Re: [Need Help] Adding Shields
is there a method that checks for "mouseover"?
if so you could check for the item under pointer and then replace the entity with a force-field version when the force-field item is placed on it (seems that's how you can upgrade entities in vanilla)
then when the force-field version of the entity dies you can replace it with the stock one (the force field was destroyed)
this would require bunch of new force-field entities with more hp, that regenerate and cost ton of power... but then again you can make the force-field exclusive to only few important entities, after-all who would put a force-field on a small ele-pole
if so you could check for the item under pointer and then replace the entity with a force-field version when the force-field item is placed on it (seems that's how you can upgrade entities in vanilla)
then when the force-field version of the entity dies you can replace it with the stock one (the force field was destroyed)
this would require bunch of new force-field entities with more hp, that regenerate and cost ton of power... but then again you can make the force-field exclusive to only few important entities, after-all who would put a force-field on a small ele-pole