health drain

Place to get help with not working mods / modding interface.
User avatar
ZombieMooose
Filter Inserter
Filter Inserter
Posts: 289
Joined: Mon Feb 09, 2015 7:23 am
Contact:

health drain

Post by ZombieMooose »

I have an idea for a mod, and I'm having trouble figuring it out. I want a slow, constant health drain on the player (multiplayer friendly) that takes about an hour to fully drain your health. Or possibly override the automatic health gain after taking damage. Or better yet both.

I looked at the mod called Stamina, and I can't figure it out. I'm such a newb.

Anyway any help would be great, I have an idea for a small mod based on this mechanic.

Thanks for any help you can give.
"men will literally learn everything about ancient Rome instead of going to therapy"
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: health drain

Post by Adil »

I believe you can even put negative regeneration in prototype definition.
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.
User avatar
ZombieMooose
Filter Inserter
Filter Inserter
Posts: 289
Joined: Mon Feb 09, 2015 7:23 am
Contact:

Re: health drain

Post by ZombieMooose »

Adil wrote:I believe you can even put negative regeneration in prototype definition.
I found a lua/entityprototype called healing_per_tick that does it, but it requires you to take damage first. How do I set this up to start automatically at game start? maybe add an activation item that damages you for 1 health?

To be honest this seems easier than I thought lol
"men will literally learn everything about ancient Rome instead of going to therapy"
User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: health drain

Post by prg »

You can cause damage to an entity with entity.damage().
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
User avatar
ZombieMooose
Filter Inserter
Filter Inserter
Posts: 289
Joined: Mon Feb 09, 2015 7:23 am
Contact:

Re: health drain

Post by ZombieMooose »

prg wrote:You can cause damage to an entity with entity.damage().
so would I create some event that started whenever the players health was full and then cause a health drain?

how would I do that?
"men will literally learn everything about ancient Rome instead of going to therapy"
User avatar
ZombieMooose
Filter Inserter
Filter Inserter
Posts: 289
Joined: Mon Feb 09, 2015 7:23 am
Contact:

Re: health drain

Post by ZombieMooose »

okay I found the on tick thing, which should work for what I'm doing - just set a number of ticks and such but as I said I'm new to coding so where would I go to find out how this looks?
"men will literally learn everything about ancient Rome instead of going to therapy"
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: health drain

Post by Adil »

diongham wrote:okay I found the on tick thing, which should work for what I'm doing - just set a number of ticks and such but as I said I'm new to coding so where would I go to find out how this looks?
How what looks?
I would giuess my signatures and modding guides. Would be a nice place to start. Also Klonan does some simple mods which are great learning exmples.
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.
Post Reply

Return to “Modding help”