Help with SXF_TRANSFERPOINTERS

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.
User avatar
hfc2x
Posts: 646
Joined: Mon Aug 17, 2009 11:37 am
Location: Chule

Help with SXF_TRANSFERPOINTERS

Post by hfc2x »

Hi everyone!

Well, I'm having a hard time trying this out... the SXF_TRANSFERPOINTERS flag in A_SpawnItemEx.
I'm trying to make something for my Quake 2 BFG10K that acts like the original, but I'm not getting what am I doing wrong :|

I'll explain how it works:
The BFG10K shot every 2 tics spawns a friendly monster, which faces the opponents and fires, and then disappears... but instead of the firing player getting a frag, the dying player gets a frag substracted. It wasn't big deal till yesterday, when I got tired of that xD
I'm using SXF_TRANSFERPOINTERS to pass the target, the master and the tracers from the BFG ball to the "BFG blaster" (monster which actually fires).

Also I included an obituary for the BFG blaster, but if the foe dies by its shot, it just displays "[foe] died."

Here are the DECORATEs for all the stuff:

Code: Select all

ACTOR BFGShot : BFGBall // I will omit all the obvious particle spawning stuff...
{
	Decal BFGScorch
	Decal BFGLightning
	Speed 15
	Damage (200)
	+FORCERADIUSDMG
	+RANDOMIZE
	RenderStyle Add
	Alpha 0.37
	DeathSound "bfg10k/die"
	Obituary "%o was deintegrated by %k's BFG10k."
	States
	{
	Spawn:
		B10K A 1 Bright A_SpawnItemEx("BFGblaster",0,0,0,0,0,0,0,SXF_SETMASTER|SXF_TRANSFERPOINTERS)
		B10K A 1 Bright A_PlaySoundEx("bfg10k/fly",SoundSlot7,1)
		B10K A 2 Bright A_SpawnItemEx("BFGblaster",0,0,0,0,0,0,0,SXF_SETMASTER|SXF_TRANSFERPOINTERS)
		B10K B 2 Bright A_SpawnItemEx("BFGblaster",0,0,0,0,0,0,0,SXF_SETMASTER|SXF_TRANSFERPOINTERS)
		B10K B 2 Bright A_SpawnItemEx("BFGblaster",0,0,0,0,0,0,0,SXF_SETMASTER|SXF_TRANSFERPOINTERS)
		Loop
	Death:
		B10K C 0 A_Explode(70,128,1)
		B10K C 3 Bright A_Explode(70,128,0) // Double explosion, for the user taking just half damage
		B10K D 3 Bright A_BFGSpray
		B10K EFGH 3 Bright
		Stop
	}
}

ACTOR BFGblaster
{  
	+FRIENDLY
	Monster
	-COUNTKILL
	Radius 1
	Height 1
	Obituary "%o just couldn't run away from %k's BFG."
	Speed 0
	MaxTargetRange 256
	+NOGRAVITY
	+LOOKALLAROUND
	MinMissileChance 1
	+MISSILEMORE
	+MISSILEEVENMORE
	RenderStyle Translucent
	Alpha 0.2			// To make them disappear if they don't attack
	+NOCLIP
	+QUICKTORETALIATE
	+NOBLOCKMAP
	States
	{
	Spawn:
		TNT1 A 1 A_Look
		TNT1 A 0 A_FadeOut(0.1)
		Loop
	See:
		TNT1 A 1 A_Chase
		TNT1 A 0 A_FadeOut(0.1)
		Loop
	Missile:
		TNT1 A 0 A_FaceTarget
		TNT1 A 1 A_CustomMissile("BFGBeam")
		Goto Death
	Death:
		TNT1 A 0
		Stop
	}
}

ACTOR BFGBeam
{
	Radius 8
	Height 8
	Speed 50
	Damage (2*(random(1,6)))
	Projectile
	RenderStyle Add
	-ACTIVATEPCROSS
	Obituary "%o just couldn't run away from %k's BFG."
	+BLOODSPLATTER
	+RANDOMIZE
	Alpha 0.35
	States
	{
	Spawn:
		APLS AB 3 Bright Light ("ARACHPLAS")
		Loop
	Death:
		TNT1 A 1
		Stop
	}
}
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Help with SXF_TRANSFERPOINTERS

Post by NeuralStunner »

Carry over A_SpawnItemEx to BFGBlaster to spawn those beams too, in the same manner as the blaster is spawned.

Monster attack codepointers do not honor missile ownership, but they credit the "world" for the kills they make. That's why it's deducting points from the targets. That make sense?
User avatar
hfc2x
Posts: 646
Joined: Mon Aug 17, 2009 11:37 am
Location: Chule

Re: Help with SXF_TRANSFERPOINTERS

Post by hfc2x »

NeuralStunner wrote:Monster attack codepointers do not honor missile ownership, but they credit the "world" for the kills they make. That's why it's deducting points from the targets. That make sense?
Completely :wink:
User avatar
hfc2x
Posts: 646
Joined: Mon Aug 17, 2009 11:37 am
Location: Chule

Re: Help with SXF_TRANSFERPOINTERS

Post by hfc2x »

Okay, I changed it to create its projectiles with A_SpawnItemEx, but now I got another problem. The projectiles now pass through the enemies (monsters and players) as if they were non-solid.

Here is the new attack definition:

Code: Select all

Missile:
		TNT1 A 0 A_FaceTarget
		TNT1 A 1 A_SpawnItemEx("BFGBeam",0,0,0,50,0,0,0,SXF_TRANSFERPITCH|SXF_TRANSFERPOINTERS)
		Goto Death
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Help with SXF_TRANSFERPOINTERS

Post by NeuralStunner »

hfc2x wrote:

Code: Select all

   Radius 1
   Height 1
This is bad! Use 2 at the least... such small objects just don't work with the collision code.

It's okay, I'm cool. I just need a paper bag to breathe into... :P
User avatar
hfc2x
Posts: 646
Joined: Mon Aug 17, 2009 11:37 am
Location: Chule

Re: Help with SXF_TRANSFERPOINTERS

Post by hfc2x »

lawl...
well the problem is with the projectiles actually xD they have a radius of 8 and height of 8, and is the blaster that has radius/height of 1. I changed the blaster's radius and height just in case, but the projectiles just continue to pass through solid actors :?
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Help with SXF_TRANSFERPOINTERS

Post by NeuralStunner »

Huh. Projectiles generally just pass through their owning actor (which they need to do, as they spawn at the actor's center).

Maybe the speed is too high to collide right? You can try inheriting them from FastProjectile... I don't know what else it could be doing wrong. :?
User avatar
hfc2x
Posts: 646
Joined: Mon Aug 17, 2009 11:37 am
Location: Chule

Re: Help with SXF_TRANSFERPOINTERS

Post by hfc2x »

NeuralStunner wrote:Huh. Projectiles generally just pass through their owning actor (which they need to do, as they spawn at the actor's center).

Maybe the speed is too high to collide right? You can try inheriting them from FastProjectile... I don't know what else it could be doing wrong. :?
I don't think so, because FastProjectile is for speeds over 60 and the speed of these is 50... also when they were fired (with A_CustomMissile) they where colliding correctly, but the "owner" of the blaster was not being passed as the owner...
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: Help with SXF_TRANSFERPOINTERS

Post by Gez »

hfc2x wrote:FastProjectile is for speeds over 60
There's no actual set limit. It depends on the radius of the actor. The larger it is, the faster it can go without issues. So it's not possible to say "speed 60, use normal, speed 61, use fast, in 100% of all cases whateverwise".
User avatar
hfc2x
Posts: 646
Joined: Mon Aug 17, 2009 11:37 am
Location: Chule

Re: Help with SXF_TRANSFERPOINTERS

Post by hfc2x »

Anyways, inheriting it from FastProjectile or not doesn't seem to make any change... looks like A_CustomMissile is the only way for projectiles spawned this way to work correctly. :?
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Help with SXF_TRANSFERPOINTERS

Post by NeuralStunner »

I've had no issue with Weapon -> Projectile -> Projectile. :?

Can you post the current incarnation of your code?
User avatar
hfc2x
Posts: 646
Joined: Mon Aug 17, 2009 11:37 am
Location: Chule

Re: Help with SXF_TRANSFERPOINTERS

Post by hfc2x »

Well, actually there's just one minor error that must be fixed, as testing showed that in a deathmatch game, the Blaster's target (the actor that it actually faces and shoots) would be set as its master (explaining why the lasers pass through the actual foes), and I (shooter), would be put as the target, but at the same time, master. Sounds a bit complicated, but for simplifying things:

I shoot a BFG ball, the ball summons an invisible monster (blaster) that looks for my enemies to blast them. When it starts shooting at them, for whatever reason I don't get, those projectiles are set as the victim's so they pass through it, but not me, as they can kill me if I get on the way and credit a frag for my foe (or the supposed victim), giving this message "[me] just couldn't run away from [my foe]'s BFG."

Here are the definitions for all at this point:

Code: Select all

ACTOR BFGShot : BFGBall // I will omit all the obvious particle spawning stuff...
{
   Decal BFGScorch
   Decal BFGLightning
   Speed 15
   Damage (200)
   +FORCERADIUSDMG
   +RANDOMIZE
   RenderStyle Add
   Alpha 0.37
   DeathSound "bfg10k/die"
   Obituary "%o was deintegrated by %k's BFG10k."
   States
   {
   Spawn:
      B10K A 1 Bright A_SpawnItemEx("BFGblaster",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS)
      B10K A 1 Bright A_PlaySoundEx("bfg10k/fly",SoundSlot7,1)
      B10K A 2 Bright A_SpawnItemEx("BFGblaster",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS)
      B10K B 2 Bright A_SpawnItemEx("BFGblaster",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS)
      B10K B 2 Bright A_SpawnItemEx("BFGblaster",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS)
      Loop
   Death:
      B10K C 0 A_Explode(70,128,1)
      B10K C 3 Bright A_Explode(70,128,0) // Double explosion, for the user taking just half damage
      B10K D 3 Bright A_BFGSpray
      B10K EFGH 3 Bright
      Stop
   }
}

ACTOR BFGblaster
{
	Monster
	-COUNTKILL
	Radius 2
	Height 2
	Obituary "%o just couldn't run away from %k's BFG."
	Speed 0
	MaxTargetRange 256
	+NOGRAVITY
	+LOOKALLAROUND
	MinMissileChance 1
	+MISSILEMORE
	+MISSILEEVENMORE
	RenderStyle Translucent
	Alpha 0.2
	+ALWAYSFAST
	+QUICKTORETALIATE
	+NOCLIP
	+NOBLOCKMAP
	+STANDSTILL
	States
	{
	Spawn:
		TNT1 A 1 A_Look
		TNT1 A 0 A_FadeOut(0.1)
		Loop
	See:
		TNT1 A 1 A_Chase
		TNT1 A 0 A_FadeOut(0.1)
		Loop
	Missile:
		TNT1 A 0 A_FaceTarget
		TNT1 A 1 A_SpawnItemEx("BFGBeam",0,0,0,cos(pitch)*50,0,sin(pitch)*50,0,SXF_TRANSFERPITCH|SXF_TRANSFERPOINTERS)
		Goto Death
	Death:
		TNT1 A 0
		Stop
	}
}

ACTOR BFGBeam
{
	Radius 8
	Height 8
	Speed 50
	Damage (2*(random(1,6)))
	Projectile
	RenderStyle Add
	-ACTIVATEPCROSS
	Obituary "%o just couldn't run away from %k's BFG."
	+BLOODSPLATTER
	+RANDOMIZE
	Alpha 0.35
	States
	{
	Spawn:
		APLS AB 3 Bright Light ("ARACHPLAS")
		Loop
	Death:
		TNT1 A 1
		Stop
	}
}
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Help with SXF_TRANSFERPOINTERS

Post by NeuralStunner »

hfc2x wrote:When it starts shooting at them, for whatever reason I don't get, those projectiles are set as the victim's so they pass through it, but not me
Oh DUH! :oops:

A Missile's "Target" is its "Master". (An odd DooM behavior.) The blaster is targeting enemies, then transfers them as Target to the projectiles. Thus, the targets "own" the missiles that are fired at them. :trippy:

So what can we do?

You can try removing BFGBlaster altogether, and fire the BFGBeams directly from the first projectile. Then you can turn the BFGBeams into [wiki=Actor_flags#SEEKERMISSILE]SEEKERMISSILE[/wiki]s. Might want to add +SCREENSEEKER to those, too. Using [wiki]A_SeekerMissile[/wiki] with 90 to both angles would probably be your best bet. Fire in several directions at once for the most chance of actually getting targets (Tracers) for the beams.
User avatar
hfc2x
Posts: 646
Joined: Mon Aug 17, 2009 11:37 am
Location: Chule

Re: Help with SXF_TRANSFERPOINTERS

Post by hfc2x »

Well, I tried with A_SeekerMissile, but to make it as closest as possible to the Quake 2 BFG, I had to set the chance of homing to 256, which made it always target myself, and it was not possible to adjust the distance from where it should shoot at the targets (making infinite distance instead of 256 map units), so I will have to revert to the old behavior of substracting frags of the foes LOL

Anyways, thanks for your help :)
User avatar
Major Cooke
Posts: 8212
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: GZBoomer Town
Contact:

Re: Help with SXF_TRANSFERPOINTERS

Post by Major Cooke »

If you want to avoid being shot by your own BFG, put +FRIENDLY in there for starters...

Let me give you a good example out of AEoD's book.

Note, while it'll actually attack enemies, if it shoots at a monster which is behind you with a rail, you will take damage. I think that's the behavior of the Q2 version as well.

If you want to use a projectile instead of a rail attack, just switch it and don't add the SMF_LOOK flag for your seeker missile in question. The projectile will take care of the targeting for you with its seekers.

Code: Select all

ACTOR D3BFGBall1
{
PROJECTILE
+ForceRadiusDMG
Speed 9
Height 16
Radius 8
Damage 25
SeeSound "reilsss/weapons/bfg9kfire"
DeathSound "q2weapon/bfgballexplo"
RenderStyle Add
Alpha 0.9
Scale 0.5
States
{
Spawn:
	TNT1 A 0
	X018 ABCDEFGHIJKLMNOPQRSTUVWXY 2 BRIGHT A_SpawnItemEx("BFGTurn2",0,0,0,0,0,0,0,32,0)
	LOOP
Death:
	TNT1 AAAAAAAAAAA 0 A_SpawnItemEx("BFGBallSmoke",0,0,0,random(3,-3)/(2*1.05),random(3,-3)/(2*1.05),random(3,-3)/(2*1.05),0,32)
	TNT1 a 0 A_SetTranslucent(0.99,1)
	BPLO A 1 BRIGHT A_SpawnItemEx("D3ShockWave", 0, 0, 8, 0, 0, 0, 0, 128)
	NULL A 0 A_BFGSpray("BFGExtra",15)
	NULL A 0 BRIGHT A_Explode(128, 100, 1)
	BPLO BCDEFGHIJKLM 2 BRIGHT
	Stop
}
}

ACTOR BFGTurn2
{
Projectile
+FRIENDLY
+LOOKALLAROUND
+MISSILEMORE
+MISSILEEVENMORE
+NOINTERACTION
+EXTREMEDEATH
+NOTARGET
Radius 1
Height 1
Speed 0
MinMissileChance 0
RenderStyle None
ReactionTime 3
States
{
Spawn:
	NULL A 0
	NULL A 0 A_CountDown
	NULL A 1 A_Look
	loop
See:
	NULL A 0 A_Chase
Missile:
	NULL A 0 A_FaceTarget
	NULL A 0 A_CustomRailgun(random(10,40),0,none,"Green",1,1,0)
	NULL A 1
	Goto Death
Death:
	NULL A 40
	Stop
}
}
Locked

Return to “Editing (Archive)”