Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Damage Formula Application?
Damage Formula Application?
2004-09-21, 11:44 PM #1
I want to set up a system for checking damage effects. The projectile hits the player. A cog checks to see whether it does any damage (there is a factor of armor which can potentially deflect bullets, eliminating damage), if it does, spawn blood, otherwise a spark, then run through a formula and apply appropriate damage. However bullets, seem to do damage irrevelant of cog. Is there a way to control the damage of a projectile through kyle.cog? Or should I try setting the projectile to 0 damage, with a class cog which checks the touched message, to evaluate the damage and effects?
_ _ _____________ _ _
Wolf Moon
Cast Your Spell On Me
Beware
The Woods At Night
The Wolf Has Come
2004-09-21, 11:55 PM #2
You can all handle in the damaged message of kyle.cog. GetSourceRef() returns the projectile (to check for type, etc.), GetParam(0) returns the amount of damage and GetParam(1) the type of damage (explosion, energy, force, etc.).
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2004-09-22, 10:45 AM #3
Will this override the natural damage of the projectile then?
_ _ _____________ _ _
Wolf Moon
Cast Your Spell On Me
Beware
The Woods At Night
The Wolf Has Come
2004-09-22, 10:57 AM #4
ReturnEx() is used under the damaged message to return the damage amount caused. You can play with the value however you like before finally passing it to the engine to be applied.
-El Scorcho

"Its dodgeball time!" -Stormy Waters
2004-09-22, 7:21 PM #5
I think projectiles do damage as defined in their template.
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2004-09-22, 8:39 PM #6
Quote:
Originally posted by Lord_Grismath
I think projectiles do damage as defined in their template.
Yeah, but in the class cog's (for a player, kyle.cog; for an AI, actor_*.cog) damaged message, you can process the damage and apply the result that you want (a constant, such as "ReturnEx(0);", which will result in damaging an amount equat to the constant, in this case zero; or a scaled amount of the damage can be returned, like "ReturnEx(Getparam(0) * 0.75);", which will return 75 percent of the damage (returning 100 percent damage falls under this idea; it would be like "ReturnEx(GetParam(0));" ))
May the mass times acceleration be with you.
2004-09-22, 11:38 PM #7
Yeah, as Slaw already stated, the template damage is just passed to the damaged message of said cog as parameters 0 (amount) and 1 (type). If you catch it there, you can do anything you want with it. The damaged message just has to return a value (with ReturnEx()), which will be the final amount of damage (type free) that the engine then applies.
At least, that's what I think.
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2004-09-23, 7:06 PM #8
If you want to get really into details, list the templates of your projectiles/bullets/rockets/ect in kyle.cog, then when damaged, check for the template of the damage thing, and run your special things from there according to what projectile damaged you. :)
-Hell Raiser

↑ Up to the top!