DocsMegalithObjects and the world
Damage
set_damage_from(category, 0 or 1)- Whether damage of a category reaches the object.
set_damage_team(team),set_damage_team(team, 0)- Only that team's players' damage reaches it;
no_team: anyone's. With 0, that team's alone doesn't. set_damage_player(player),set_damage_player(player, 0)- Only that player's damage reaches it;
no_player: anyone's. With 0, that player's alone doesn't:current_player.biped.set_damage_player(current_player, 0)spares a player their own rockets while friendly fire stays on. set_damage_multiplier(category, percent or none)- Its share of that category's damage, 0% to 1000%;
nonegives all of it again.current_object.set_damage_multiplier(damage.plasma, 200)makes plasma hit it twice as hard. apply_damage(percent, category, player)- Takes that much of its shields, then of its health, in percent of its own, as damage of that category by that player would; the player is optional. What its rules refuse or scale is refused or scaled, and an object left with no health is killed. It's the script's own damage: no kill is credited, and
on object damageddoesn't run for it.
A hit an object's rules refuse never reaches it: no damage, and no side effect, where melee would otherwise kill an unaware body outright. The script still hears it in on object damaged, with damage_incoming and damage_inflicted both 0. Rules last the round; scripted and forced kills (kill) always go through.
Damage categories, as damage.NAME: none, falling (collisions too), bullet, grenade, high_explosive, sniper, melee, flame, mounted_weapon, vehicle, plasma, needle and shotgun. A category's number is its place in that list. The map's damage effects decide: on the stock maps the Sniper Rifles' and the Shotgun's rounds are bullet, and a fusion coil's blast is grenade.
on object damaged: do
if current_object.has_forge_label("target") and damage_category == damage.bullet then
current_player.score += 1
current_object.delete()
end
end
The event also gives damage_source_object, the attacker's body or vehicle, and damage_incoming and damage_inflicted, the damage as it came and as the rules left it, in tenths of a point. A source may also have handlers for one label or one category, such as on object damaged with label "target".
