[Solved] Possible to prevent a friendly marine from ...

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
malon3
Posts: 103
Joined: Fri Dec 26, 2008 4:41 pm

[Solved] Possible to prevent a friendly marine from ...

Post by malon3 »

I made a very powerful friendly marine. Except he often times accidentally kills me. Any way to avoid this?

I added the line:

Code: Select all

DamageFactor "DoomPlayer", 0.0
to my decorate actor, but it didn't help. I've never dealt with custom damage types, and I'm not 100% sure what I'm doing. Any help would be greatly appreciated.


Here is the full actor definition:

Code: Select all

actor MyMarine : MarineChaingun
{
  Speed 16
  +ALWAYSFAST
  +INVULNERABLE
  +FRIENDLY
  -SOLID
  +FLOAT
  +NOGRAVITY
  +MISSILEEVENMORE
  +MISSILEMORE
  +LOOKALLAROUND
  +QUICKTORETALIATE
  +DROPOFF
  
  DamageFactor "DoomPlayer", 0.0
  
  States
  {
    Spawn:
    PLAY A 1 A_MarineLook
    Loop
  Idle:
    PLAY A 1 A_MarineLook
    Loop
  See:
    PLAY ABCD 1 A_MarineChase
    Loop
	
  Missile:
	Missile.Chaingun:
    PLAY FF 0 Bright A_CustomBulletAttack(0, 0, 1, 5000, "BulletPuff", 8192)
    Goto See
  }
}
Last edited by Anonymous on Thu Dec 12, 2013 6:57 pm, edited 1 time in total.
User avatar
TheMightyHeracross
Posts: 2100
Joined: Sun Aug 18, 2013 9:41 am
Location: Philadelphia, PA

Re: Possible to prevent a friendly marine from hurting a pla

Post by TheMightyHeracross »

Add:

Code: Select all

DamageType "whatever_the_hell_you_want_to_call_it"
To the marine, and:

Code: Select all

DamageFactor "whatever_you_called_the_other_one"
to a new player class inheriting from DoomPlayer. Don't forget to define the new player!
malon3
Posts: 103
Joined: Fri Dec 26, 2008 4:41 pm

Re: Possible to prevent a friendly marine from hurting a pla

Post by malon3 »

It makes perfect sense, but I've done something wrong I think.

Decorate code:

Code: Select all

actor MyMarine : MarineChaingun
{
  Speed 16
  +ALWAYSFAST
  +INVULNERABLE
  +FRIENDLY
  -SOLID
  +FLOAT
  +NOGRAVITY
  +MISSILEEVENMORE
  +MISSILEMORE
  +LOOKALLAROUND
  +QUICKTORETALIATE
  +DROPOFF
  
  DamageType "MarineFire"
  
  States
  {
    Spawn:
    PLAY A 1 A_MarineLook
    Loop
  Idle:
    PLAY A 1 A_MarineLook
    Loop
  See:
    PLAY ABCD 1 A_MarineChase
    Loop
	
  Missile:
	Missile.Chaingun:
    PLAY FF 0 Bright A_CustomBulletAttack(0, 0, 1, 5000, "BulletPuff", 8192)
    Goto See
  }
}

actor MyPlayer : DoomPlayer
{
  DamageFactor "MarineFire", 0.0
}
MAPINFO Lump:

Code: Select all

GameInfo
{
	PlayerClasses = "MyPlayer"
}
User avatar
TheMightyHeracross
Posts: 2100
Joined: Sun Aug 18, 2013 9:41 am
Location: Philadelphia, PA

Re: Possible to prevent a friendly marine from hurting a pla

Post by TheMightyHeracross »

What happens? Your code is fine to me.
User avatar
Ed the Bat
Posts: 3060
Joined: Thu May 03, 2012 1:18 pm
Graphics Processor: nVidia with Vulkan support
Location: Maryland, US
Contact:

Re: Possible to prevent a friendly marine from hurting a pla

Post by Ed the Bat »

That damagetype probably ought to go on the puff he's shooting, not the actor himself.
malon3
Posts: 103
Joined: Fri Dec 26, 2008 4:41 pm

Re: Possible to prevent a friendly marine from hurting a pla

Post by malon3 »

TheMightyHeracross wrote:What happens? Your code is fine to me.
I get killed in the crossfire. The death message is "MALON DIED" because I haven't yet set a custom obit message. But I'm definitely getting killed by my friendly AI dude, because after death, my camera follows him as he walks around.
malon3
Posts: 103
Joined: Fri Dec 26, 2008 4:41 pm

Re: Possible to prevent a friendly marine from hurting a pla

Post by malon3 »

Ed the Bat wrote:That damagetype probably ought to go on the puff he's shooting, not the actor himself.
I also tried this without success. Here is my current code:

Code: Select all

actor MyMarine : MarineChaingun
{
  Speed 16
  +ALWAYSFAST
  +INVULNERABLE
  +FRIENDLY
  -SOLID
  +FLOAT
  +NOGRAVITY
  +MISSILEEVENMORE
  +MISSILEMORE
  +LOOKALLAROUND
  +QUICKTORETALIATE
  +DROPOFF
  
  States
  {
    Spawn:
    PLAY A 1 A_MarineLook
    Loop
  Idle:
    PLAY A 1 A_MarineLook
    Loop
  See:
    PLAY ABCD 1 A_MarineChase
    Loop
	
  Missile:
	Missile.Chaingun:
    PLAY FF 0 Bright A_CustomBulletAttack(0, 0, 1, 5000, "MarinePuff", 8192)
    Goto See
  }
}

actor MarinePuff : BulletPuff
{
	DamageType "MarineFire"
}

actor MyPlayer : DoomPlayer
{
  DamageFactor "MarineFire", 0.0
}
User avatar
Ed the Bat
Posts: 3060
Joined: Thu May 03, 2012 1:18 pm
Graphics Processor: nVidia with Vulkan support
Location: Maryland, US
Contact:

Re: Possible to prevent a friendly marine from hurting a pla

Post by Ed the Bat »

I can't reproduce the issue. His shots make me bleed, but deal no damage.

Of course, this is only when putting the damagetype on the puff, as you did in the most recent example. Before that, the marine would still kill the player because the damagetype was on his body, not his puff.
malon3
Posts: 103
Joined: Fri Dec 26, 2008 4:41 pm

Re: Possible to prevent a friendly marine from hurting a pla

Post by malon3 »

Ed the Bat wrote:I can't reproduce the issue. His shots make me bleed, but deal no damage.
I think I have the problem figured out, and it's mostly my fault I think. I've been testing in Zandronum. Indeed, it works fine in zdoom but in zandronum, it does not work.

custom damage types must not be supported. Sorry for wasting everyone's time!

Here is the wad I was trying to compile, in case anyone's interested:
http://www.sendspace.com/file/sm7fcp
User avatar
Ed the Bat
Posts: 3060
Joined: Thu May 03, 2012 1:18 pm
Graphics Processor: nVidia with Vulkan support
Location: Maryland, US
Contact:

Re: Possible to prevent a friendly marine from hurting a pla

Post by Ed the Bat »

I may be incorrect on this, but the way I remember, Zandronum is too out-of-date to support adding player classes in MAPINFO. You may have to use the old, broken method in KEYCONF.
malon3
Posts: 103
Joined: Fri Dec 26, 2008 4:41 pm

Re: Possible to prevent a friendly marine from hurting a pla

Post by malon3 »

Ed the Bat wrote:I may be incorrect on this, but the way I remember, Zandronum is too out-of-date to support adding player classes in MAPINFO. You may have to use the old, broken method in KEYCONF.
Yes! It worked! Thank you!
Locked

Return to “Editing (Archive)”