ReplaceActor skill property

Moderator: GZDoom Developers

Post Reply
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

ReplaceActor skill property

Post by Gez »

As discussed in the Additions to skill definition thread. This patch adds a new skill property to skill definitions: ReplaceActor.

Example of use:

Code: Select all

skill test
{
	spawnfilter = 4
	name = "Massive upgrade!"
	ReplaceActor = "ZombieMan", "ShotgunGuy"
	ReplaceActor = "ShotgunGuy", "ChaingunGuy"
	ReplaceActor = "Demon", "Spectre"
	ReplaceActor = "Fatso", "BaronOfHell"
	ammofactor = 2
	dropammofactor = 1
}
Skill-based replacements are not transitive: zombies are replaced by sergeants, and sergeants by commandos, but zombies aren't replaced by commandos.

The implementation has the skill replacements applied first, followed by any DECORATE replacement. For example, if the above MAPINFO code is combined with this DECORATE code...

Code: Select all

Actor Imp : DoomImp replaces ChaingunGuy {}
Actor FirstAid : Medikit replaces ShotgunGuy {}
... then in the level the sergeants will be replaced by imps, not with medikits. But the former humans will end up being replaced by medikits.

This implementation only changes the FActorInfo::GetReplacement and GetReplacee functions, instead of altering many other functions. As such it is I think the cleanest it can be.
User avatar
.+:icytux:+.
Posts: 2661
Joined: Thu May 17, 2007 1:53 am
Location: Finland

Re: ReplaceActor skill property

Post by .+:icytux:+. »

i like :D
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: ReplaceActor skill property

Post by Gez »

What, already? Damn that was fast. I revised it to handle erroneous actor definitions more gracefully.
User avatar
ThatOneZDoomer
Posts: 226
Joined: Sun Jun 01, 2008 1:33 am
Preferred Pronouns: She/Her
Location: Where I'm at of course

Re: ReplaceActor skill property

Post by ThatOneZDoomer »

Finally, it's here, a non-hacky way of changing actors based on skill level! No more buggy way of doing it with A_SpawnThingEx that breaks scripts. I know I'll be using this for sure. Just a quick question...

Will this work in combination with your Random Spawner while still keeping scripts functional? In a way, it'll be like a double replacement or something like that. Something like this...

Code: Select all

Actor ImpSpawner : RandomSpawner replaces DoomImp
{
   DropItem "WimpyImp"
   DropItem "RedShirtImp"
}

Actor ImpSpawnerHard : RandomSpawner
{
   DropItem "UberImp"
   DropItem "1337Imp"
}

Code: Select all

skill leet
{
   spawnfilter = 4
   name = "No n00bs allowed!!"
   ReplaceActor = "ImpSpawner", "ImpSpawnerHard"
}
Or would I have to do it this way, if it works at all?

Code: Select all

skill leet
{
   spawnfilter = 4
   name = "No n00bs allowed!!"
   ReplaceActor = "WimpyImp", "UberImp"
   ReplaceActor = "RedShirtImp", "1337Imp"
}
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: ReplaceActor skill property

Post by Gez »

Skill replacements are applied before DECORATE replacement, so in your example what you'll want is this:

Code: Select all

skill leet
{
   spawnfilter = 4
   name = "No n00bs allowed!!"
   ReplaceActor = "DoomImp", "ImpSpawnerHard"
}
User avatar
ThatOneZDoomer
Posts: 226
Joined: Sun Jun 01, 2008 1:33 am
Preferred Pronouns: She/Her
Location: Where I'm at of course

Re: ReplaceActor skill property

Post by ThatOneZDoomer »

I thought to myself "I hope I don't make the mistake of getting the skill and decorate actor defining mixed up" and with just this example alone, I already made that mistake :| . Well, I'm sure the wiki page will make it clear that skill replacements are applied before decorate replacements to avoid threads asking why they couldn't get the feature to work correctly.
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: ReplaceActor skill property

Post by Gez »

Odd, what happened to the newlines? It's not important anyway.
ThatOneZDoomer wrote:I thought to myself "I hope I don't make the mistake of getting the skill and decorate actor defining mixed up" and with just this example alone, I already made that mistake :| . Well, I'm sure the wiki page will make it clear that skill replacements are applied before decorate replacements to avoid threads asking why they couldn't get the feature to work correctly.
You tell me.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”