Jump to content
  • 0

Why isn't A_RadiusThrust pushing monsters?


Artinum

Question

I am attempting to set up a custom ZScript monster that, on death, spawns two other monsters and then "explodes" them outwards. The obvious function to use for this is A_RadiusThrust, but no matter what values I give for the thrust, the monsters remain pretty much unaffected. I know the thrust itself is being triggered because large values push the player backwards, but the monsters are entirely unaffected by it.

 

Actually, not *entirely* - if I include a parameter for Z-axis thrust as well, they DO tend to leap a considerable distance into the sky. But they don't move horizontally beyond their own walking pace.

 

Before I found A_RadiusThrust, I was attempting to set the individual spawns with a velocity based on their position relative to the parent monster - this too failed to push them, though it did seem to work when I spawned medikits instead of monsters. So is there something special about monsters that means they ignore horizontal thrust??

Share this post


Link to post

17 answers to this question

Recommended Posts

  • 1

Oh welp, I just re-read the OP -- for the effect you're looking for, A_SpawnItemEx is the tool for the job. It has args that lets you set the spawned actors' velocity directly, so you won't have to mess with pushing them after the fact. Set the `xvel` and `zvel` params, adjust 'em to taste, and adjust the `angle` to spawn 'em outward from the center. Can also toss in some `frandom(x, y)` calls into the various `pos` fields (or `angle`) if you want their initial spawn positions to be randomized.

Share this post


Link to post
  • 0
6 minutes ago, kalensar said:

There's a lack of information needed to properly diagnose the issue.  One issue I can think of is that the Thrust is spawning before the other actors, or that the thrust power is too low.

 

I doubt either of these is the case. I tried boosting the thrust power to about 20000 in one case, which pushes the player clean across the arena - but doesn't do anything to the monsters.

 

I did wonder about the spawning order and ended up moving the push into the same function as the spawning (with self.A_RadiusThrust) - however, this made no difference. It seems to be triggering after spawn at least half the time, as it does shove those test imps into the ceiling quite forcefully!

 

A lack of information is my main problem. If it was doing the wrong thing, I'd have something to investigate; just not doing anything leaves me with no clues.

 

Are you aware of any WADs that use this function that I could try comparing my code against?

Share this post


Link to post
  • 0
10 hours ago, FraggerX said:

Have you tried "thrust_thing"?

 

About the only approach I haven't considered. Setting velocity directly didn't work for me, but thrusting things individually... that might.

I'll need to figure out the angles for it but I did that for the velocity approach. I think I still have that code commented out.

Share this post


Link to post
  • 0
3 minutes ago, Artinum said:

I did wonder about the spawning order and ended up moving the push into the same function as the spawning (with self.A_RadiusThrust) - however, this made no difference. It seems to be triggering after spawn at least half the time, as it does shove those test imps into the ceiling quite forcefully!

 

I'm just guessing here, since you havent pasted the code, that you you have the thrust spawning before the DROPITEM or SPAWNITEMEX that causes the Imp spawns.

 

example

  Death:
    TROO I 8
    TROO J 8 A_Scream
    TROO K 6 
    TROO L 4 A_NoBlocking
    TROO L 1 A_DropItem("DoomIMp")
    TROO L 1 A_DropItem("DoomImp")
    TROO L 1
    TROO M 1 A_RadiusThrust(20000)
    TROO M -1
    Stop

 

All this is doing is giving enough time for the actor spawns to appear, and quickly but not instantaneously, and then setting off the radius thrust. I'm expecting that you might still get the same results that has happened to you, but this will give you a sequential example of where the problem might be lying at by extending out the sequence of events slightly longer. 

Share this post


Link to post
  • 0
3 hours ago, kalensar said:

 

I'm just guessing here, since you havent pasted the code, that you you have the thrust spawning before the DROPITEM or SPAWNITEMEX that causes the Imp spawns.

 

example


  Death:
    TROO I 8
    TROO J 8 A_Scream
    TROO K 6 
    TROO L 4 A_NoBlocking
    TROO L 1 A_DropItem("DoomIMp")
    TROO L 1 A_DropItem("DoomImp")
    TROO L 1
    TROO M 1 A_RadiusThrust(20000)
    TROO M -1
    Stop

 

All this is doing is giving enough time for the actor spawns to appear, and quickly but not instantaneously, and then setting off the radius thrust. I'm expecting that you might still get the same results that has happened to you, but this will give you a sequential example of where the problem might be lying at by extending out the sequence of events slightly longer. 

 

I've not seen A_DropItem before. I was wondering how to spawn more monsters in the state code (I don't think it will help here, however, as I'd like them to spawn in slightly randomised positions rather than in one clump). I've been spawning them inside a custom function:

 

override void Tick()
	{
		super.Tick();
		if (InStateSequence(curstate, ResolveState("Death")) && !HasSpawned)
		{
			vector3 pos = self.pos;
			vector3 Spawn1 = (frandom(-45, 45), frandom(-45, 45), frandom(5, 10));
			vector3 Spawn2 = (frandom(-45, 45), frandom(-45, 45), frandom(5, 10));
			let spawnedActor = Actor.Spawn("DoomImp", pos + Spawn1);
			// double ang1 = self.angleto(spawnedactor);
			// spawnedActor.thrust(10.0, ang1);
			let spawnedActor2 = Actor.Spawn("DoomImp", pos + Spawn2);
			// double ang2 = self.angleto(spawnedactor2);
			// spawnedActor2.thrust(10.0, ang2);
			// spawnedActor2.vel = Spawn2;
			self.A_RadiusThrust(200, -1, RTF_NOTMISSILE | RTF_NOIMPACTDAMAGE | RTF_THRUSTZ, 100, "DoomImp");
			HasSpawned = TRUE;
		}
	}

(You can see I've been trying various different approaches with those commented out bits!)

 

Originally the A_RadiusThrust was applied in the near-last steps of the Death state rather than inside this code, which should trigger at the start of the Death state (the HasSpawned bool is there to prevent it spawning enemies endlessly, which it did in my first iteration of the code). So there should be plenty of time for it to trigger after the spawn is done.

 

The Z-axis thrust sometimes applies, I suspect when the spawned enemies are sufficiently higher than the dead monster. So I think it IS working in that regard. It just doesn't push them across the plane!

Share this post


Link to post
  • 0
2 hours ago, Artinum said:

The Z-axis thrust sometimes applies, I suspect when the spawned enemies are sufficiently higher than the dead monster. So I think it IS working in that regard. It just doesn't push them across the plane!

 

I just ran my own experiment with my variation of the idea and it did the exact same explanation of what you are experiencing. The Function seems to be screwed, and so I have to concur with XASER that A_Blast is the better route to use. 

Share this post


Link to post
  • 0
3 hours ago, Xaser said:

Try A_Blast instead -- it's much more effective.

 

Another new function!

 

Unfortunately, this seems to have the same problem - it pushes the player away without issue, and the imps I'm spawning hop into the air, but they aren't thrown away from the blast as they should be.

Share this post


Link to post
  • 0

Interesting to note that applying a BlastEffect (since the Hexen sprite isn't available in Doom 2, I used "TeleportFog" instead) does seem to suggest the monsters are being identified by the blast. They just aren't being pushed.

Share this post


Link to post
  • 0

Quick function test for me if you are able.

take a health potion, modify it to create the blast and see if the blast generated from the item works.

My theory is that the push from the monsters is only affecting the player because the creature spawning the effect is hostile to you.


Failing every thing else, maybe "A_SpawnItemEx" with some random x and y values for momentum would work for the effect you are aiming for

Edited by Desfar

Share this post


Link to post
  • 0
6 hours ago, Artinum said:

 

Another new function!

 

Unfortunately, this seems to have the same problem - it pushes the player away without issue, and the imps I'm spawning hop into the air, but they aren't thrown away from the blast as they should be.

 

Are the imps hitting a line with the "Block Monsters" flag, by chance? That will stop 'em dead in their tracks.

Share this post


Link to post
  • 0
9 hours ago, Xaser said:

 

Are the imps hitting a line with the "Block Monsters" flag, by chance? That will stop 'em dead in their tracks.

 

The only such lines are the ones around the edge of the map. It's basically an open arena.

Share this post


Link to post
  • 0
10 hours ago, Desfar said:

Quick function test for me if you are able.
take a health potion, modify it to create the blast and see if the blast generated from the item works.
My theory is that the push from the monsters is only affecting the player because the creature spawning the effect is hostile to you.
 

 

Inconclusive. Health bonuses don't have death states, so it isn't triggering on collection (and they only have spawn states, so it would trigger on map start if I used that). I'm not sure what else I could use to trigger it.

 

However, the blast IS affecting monsters. Just only in the Z axis.

The player is fully affected.

 

Share this post


Link to post
  • 0
11 hours ago, Xaser said:

Oh welp, I just re-read the OP -- for the effect you're looking for, A_SpawnItemEx is the tool for the job. It has args that lets you set the spawned actors' velocity directly, so you won't have to mess with pushing them after the fact. Set the `xvel` and `zvel` params, adjust 'em to taste, and adjust the `angle` to spawn 'em outward from the center. Can also toss in some `frandom(x, y)` calls into the various `pos` fields (or `angle`) if you want their initial spawn positions to be randomized. 

 

Ooh, nice - I'll have to try that. Setting the velocity directly after spawning them didn't work, but this might.

 

However, I've had some progress with A_ThrustRadius - someone on Discord has provided me with some code that produces the desired effect... with imps. Still doesn't work for my custom enemies. Messing around with other monster types has been interesting; demons are pushed about quite happily, while Hell Knights are... sometimes pushed. Sometimes they just ignore it.

 

Lost Souls go flying most dramatically. Cacodemons don't move at all.

 

One theory here is that the enemy hitboxes are getting tangled up with each other and/or the corpse of the monster pushing them (?) and this could explain the erratic outcomes. More testing is required.

Share this post


Link to post
  • 0
On 5/18/2024 at 10:33 PM, Xaser said:

Oh welp, I just re-read the OP -- for the effect you're looking for, A_SpawnItemEx is the tool for the job. It has args that lets you set the spawned actors' velocity directly, so you won't have to mess with pushing them after the fact. Set the `xvel` and `zvel` params, adjust 'em to taste, and adjust the `angle` to spawn 'em outward from the center. Can also toss in some `frandom(x, y)` calls into the various `pos` fields (or `angle`) if you want their initial spawn positions to be randomized.

 

Just wanted to follow up. This is working PERFECTLY. Getting the angles right took me a while (the wiki didn't explain the scale - eventually figured out that 0.25 is a ninety degree turn, and 0.75 is ninety degrees the other way) and the velocity took a bit of getting used to as well. But it works!

 

Thanks so much for this - my crazy map idea is now taking shape...

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...