View Issue Details

IDProjectCategoryView StatusLast Update
0004166The Dark ModDef / Setuppublic05.10.2017 17:46
Reportersotha_sil Assigned Tograyman  
PrioritynormalSeveritynormalReproducibilityalways
Status resolvedResolutionfixed 
Product VersionTDM 2.03 
Target VersionTDM 2.06Fixed in VersionTDM 2.06 
Summary0004166: Food does not give health
DescriptionEditor claims food should give 1 hp health back. It doesn't.

http://forums.thedarkmod.com/topic/17210-possible-to-make-food-give-you-more-health/?p=373243

In a test, eating 25 applies does not change the health bar at all.

Steps To ReproduceTest map is provided in attachment. Let the AI hurt you a bit, then kill him or use "killmonsters" to remove him.

Eating apples does not change the health bar.
TagsNo tags attached.

Relationships

related to 0001882 closedSpringheel Edible food needs updating 

Activities

sotha_sil

sotha_sil

20.06.2015 16:00

reporter  

food.map (9,811 bytes)
SteveL

SteveL

20.06.2015 17:28

reporter   ~0007586

Hmm fixing the bug is straightforward enough but it might need a redesign instead. The script that controls eating tries to do something clever with food, to make it work like potions but without providing a separate definition for the healing effect. Healing potions and breath potions give back gradual healing according to settings held in a heal_def (defined in file tdm_healing.def), that specifies the total amount of healing, the amount per pulse, and the time intervals between heals. The food script tries to pass the name of the food item as the heal_def, and adds the spawnargs used by real heal_defs to the food itself (such as heal_amount), the idea being that the game will get its healing settings from the food item's spawnargs.

The problem is that the healing code in game dll isn't looking for an individual entity identified by name. It looks for a class_name. So when given the name of an individual food item, it finds nothing. I tweaked the script so it passes the classname of the food instead of the name of the individual apple, and now the healing works.

The problem with that fix is that if a mapper changes the "heal_amount" spawnarg on an individual apple, it'll be ignored because the game will get its settings from the inherited spawnargs, not from the mapper's tweaked settings on that one apple. That's not the way people expect spawnargs to behave.

A better fix would be to make a 1-point heal_def in tdm_healing.def, and have the script apply that heal_def after picking up the "heal_amount" spawnarg from the individual apple and using it to multiply the effect of the 1-point heal-def.
SteveL

SteveL

20.06.2015 17:40

reporter   ~0007587

That works. "heal_amount" now does what people will expect. No other spawnargs from the heal_defs are in use on food (and they wouldn't have worked anyway) so it's safe to change the way it works.

defs/tdm_healing.def (added a new "heal_food" def)
script/tdm_equip_actions.script

rev 14323
SteveL

SteveL

20.06.2015 17:48

reporter   ~0007588

There doesn't seem to be a wiki article. The heal_amount spawnarg needs no explanation, but if there had been a wiki I'd have removed references to other heal_def spawnargs (such as healing over time).
SteveL

SteveL

25.04.2016 20:55

reporter   ~0008119

Re-opened for further tweaks in 2.05.

Extra info from Goldwell re missing spawnargs or inheritances in certain food defs:
• The fish is actually missing the "equip_action_script" / "eat_it" spawnarg/value which is why when I frob it nothing happens.. again something I can add but probably worth mentioning.
• the bread only needed the "heal_amount" spawn arg whereas the fish needed the "heal_amount" and the "equip_action_script" spawnarg
grayman

grayman

18.09.2017 15:05

viewer   ~0009291

Started discussion thread:

http://forums.thedarkmod.com/topic/19103-edible-foods-and-giving-health/#entry411989
grayman

grayman

19.09.2017 19:06

viewer   ~0009304

Corrected healing amounts for healthy foods.

1 - apple
1 - carrot
1 - pear
2 - turnip
4 - bread
3 - cake
2 - cheese wedge
12 - cheese wheel
1 - muffin
6 - mackeral
4 - bluefish

Rev. 14934:

tdm_healing.def
tdm_moveable_food.def
grayman

grayman

19.09.2017 19:07

viewer   ~0009305

Those HP are given at the rate of 1 per second. You can't go over the player's allowed max health.
grayman

grayman

24.09.2017 18:19

viewer   ~0009346

Updated new edible food HP gain.

1 - apple
1 - carrot
1 - pear
1 - turnip
1 - muffin
3 - bread
3 - cake
3 - cheese wedge
6 - cheese wheel
6 - mackeral
3 - bluefish

Issue History

Date Modified Username Field Change
20.06.2015 16:00 sotha_sil New Issue
20.06.2015 16:00 sotha_sil File Added: food.map
20.06.2015 17:28 SteveL Note Added: 0007586
20.06.2015 17:28 SteveL Assigned To => SteveL
20.06.2015 17:28 SteveL Status new => assigned
20.06.2015 17:40 SteveL Note Added: 0007587
20.06.2015 17:48 SteveL Note Added: 0007588
20.06.2015 17:48 SteveL Status assigned => resolved
20.06.2015 17:48 SteveL Fixed in Version => TDM 2.04
20.06.2015 17:48 SteveL Resolution open => fixed
04.01.2016 18:45 grayman Fixed in Version TDM 2.04 => TDM 2.05
04.01.2016 18:45 grayman Target Version => TDM 2.05
25.04.2016 20:55 SteveL Note Added: 0008119
25.04.2016 20:55 SteveL Status resolved => assigned
12.08.2016 21:18 grayman Resolution fixed => open
12.08.2016 21:18 grayman Fixed in Version TDM 2.05 =>
25.11.2016 13:57 grayman Target Version TDM 2.05 => TDM 2.06
15.02.2017 04:34 grayman Assigned To SteveL =>
15.02.2017 04:34 grayman Status assigned => new
18.09.2017 15:04 grayman Assigned To => grayman
18.09.2017 15:04 grayman Status new => assigned
18.09.2017 15:05 grayman Note Added: 0009291
19.09.2017 19:06 grayman Note Added: 0009304
19.09.2017 19:06 grayman Status assigned => resolved
19.09.2017 19:06 grayman Resolution open => fixed
19.09.2017 19:06 grayman Fixed in Version => TDM 2.06
19.09.2017 19:07 grayman Note Added: 0009305
24.09.2017 18:19 grayman Note Added: 0009346
05.10.2017 17:46 nbohr1more Relationship added related to 0001882