Increasing all damage in the game
Moderator: GZDoom Developers
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Increasing all damage in the game
I want to increase damage for everything temporarily for testing purposes, so instead of editing the damage of actors, I think I should go with event handlers, right? I want everything to either deal max damage (better) or just double damage (worse, only if the first objective is too difficult to achieve). Is there a way to do it? I found on the forum that WorldThingDamaged is read-only.
I suppose for "double damage" I could just go with WorldThingSpawned and halve the health of everything spawned. But I still would like to try going for maxing the random damage. And besides, in case of the player halving the health does not take care of the health items, which in this case would give him "double" health.
I suppose for "double damage" I could just go with WorldThingSpawned and halve the health of everything spawned. But I still would like to try going for maxing the random damage. And besides, in case of the player halving the health does not take care of the health items, which in this case would give him "double" health.
Re: Increasing all damage in the game
WorldThingDamaged "readonlynes" mean that you cant cancel damage, because its called after actor was damaged. In fact it returns amount of damage after taking into account all damage factors, armor, and etc. You still can damage actor from it.
Re: Increasing all damage in the game
Hm, I tried:
but I get the error
And I tried changing the scope to "play", like you advised in the other topic, but then I get
Code: Select all
Class PlugDamageHandler : EventHandler
{
override void WorldThingDamaged(Worldevent event)
{
if (event.thing);
{
event.damage *= 2;
Console.Printf("damage is %d",event.damage);
}
}
}
Code: Select all
Expression must be a modifiable value
Code: Select all
zscript.zsc, line 3: Can't change class scope in class PlugDamageHandler
Re: Increasing all damage in the game
Okay, I got around it by
But that still only deals double damage. In the absence of anything better that will do, but I still would like to have max damage out of any random damage. For that, I suppose I still would need to somehow change every "Thing" in WorldThingSpawned, but for now I don't have any idea how.
Code: Select all
Class PlugDamageHandler : EventHandler
{
override void WorldThingDamaged(Worldevent event)
{
if (event.thing);
{
// event.damage *= 2;
event.thing.Health -= event.damage;
Console.Printf("damage is %d",event.damage);
}
}
}
Re: Increasing all damage in the game
Another way that the damage doubling could have been done would have been to define a custom skill level in MAPINFO ( https://zdoom.org/wiki/MAPINFO/Skill_definition ).
For the de-randomisation you would need something more cunning though.
For the de-randomisation you would need something more cunning though.
Re: Increasing all damage in the game
It seems this way would be better for double damage at least, because I noticed that with the code above monsters become undying if their health is decreased below 0 as the result of setting Health directly.
But for some reason I don't see the new skill in the skill selection menu:
[/s]
Scratch that, I don't know what was the matter, but now I see it.
But for some reason I don't see the new skill in the skill selection menu:
Code: Select all
skill test
{
MonsterHealth = 0.5
DamageFactor = 2.0
FastMonsters
EasyKey
SpawnFilter = Nightmare
DefaultSkill
Name = "Test"
}
Scratch that, I don't know what was the matter, but now I see it.
Re: Increasing all damage in the game
If you're only doing it temporarily, CVars might be perfect for your use case.
sv_damagefactorplayer is multiplied on all players
sv_damagefactorfriendly is multiplied on all other +FRIENDLY actors
sv_damagefactormobj is multiplied on all remaining actors, including monsters and barrels
The CVars in question describe the victims of the damage, not the inflictors, so sv_damagefactorplayer 0 is equivalent to god mode.
Or if you want to see what it would be like if the monsters activated god mode for a change instead of you, you can do sv_damagefactormobj 0
sv_damagefactorplayer is multiplied on all players
sv_damagefactorfriendly is multiplied on all other +FRIENDLY actors
sv_damagefactormobj is multiplied on all remaining actors, including monsters and barrels
The CVars in question describe the victims of the damage, not the inflictors, so sv_damagefactorplayer 0 is equivalent to god mode.
Or if you want to see what it would be like if the monsters activated god mode for a change instead of you, you can do sv_damagefactormobj 0

Re: Increasing all damage in the game
Oh, I think I'm gonna go with thatRachael wrote:sv_damagefactorplayer is multiplied on all players
sv_damagefactorfriendly is multiplied on all other +FRIENDLY actors
sv_damagefactormobj is multiplied on all remaining actors, including monsters and barrels

Code: Select all
Class PlugDamageHandler : EventHandler
{
override void WorldThingSpawned(Worldevent event)
{
if (event.thing && event.thing.Speed > 0 && !event.thing.player);
{
event.thing.Speed *= 2;
event.thing.vel *= 2;
Console.Printf("Speed is %F",event.thing.Speed);
}
}
}
Re: Increasing all damage in the game
You just want to increase speed of monsters and projectiles, right?
Then how about trying something like this:
Then how about trying something like this:
Code: Select all
If(e.Thing.bIsMonster == true || e.Thing.bMissile == true)
{
e.Thing.Speed *= 2;
e.Thing.vel *= 2;
Console.Printf("Speed is %F",e.thing.Speed);
}
Re: Increasing all damage in the game
Oh, I haven't thought about that
Thanks!

-
- Posts: 5046
- Joined: Sun Nov 14, 2010 12:59 am
Re: Increasing all damage in the game
Remove that semicolon at the end of the line.Kzer-Za wrote:Code: Select all
if (event.thing && event.thing.Speed > 0 && !event.thing.player);
Re: Increasing all damage in the game
(Facepalm) Right! Thanks!