Pin enemy to a wall //SOLVED//
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!)
Pin enemy to a wall //SOLVED//
PB 3.0 has this effect with the nailgun and i wanted to ask how it's done? i know that the gun needs to shoot a proyectile that gives an item to the monster to check and go to a "pin to the wall" state.
But i don't know how the state would look like, can you help me? or at least tell me how to do it or if there is any flags
But i don't know how the state would look like, can you help me? or at least tell me how to do it or if there is any flags
Last edited by Niphura on Sun Dec 23, 2018 10:13 am, edited 1 time in total.
Re: Pin enemy to a wall ((Help))
Hmm, wouldn't the pin to the wall state just be a few "struggling" frames with no calls to any functions that would move the enemy? As long as you don't mind knockback / disc of repulsion / etc. knocking it loose, anyway.
About flags, would NOTARGETSWITCH + STANDSTILL work? Maybe you can just set the flags and avoid having to add a new state.
Or maybe just stun lock the enemy in the pain state with continuous "damage" (that doesn't actually damage, but causes pain)?
About flags, would NOTARGETSWITCH + STANDSTILL work? Maybe you can just set the flags and avoid having to add a new state.
Or maybe just stun lock the enemy in the pain state with continuous "damage" (that doesn't actually damage, but causes pain)?
Re: Pin enemy to a wall ((Help))
You can just make the projectile/hitscan have a custom damagetype and make a state like this:
Of course replace the CustomDamage with the custom damagetype
Death.CustomDamage:
POSS A 1 A_FaceTarget
POSS A 3 A_CustomMissile("CheckForWall", 1.0, 0, 128)
POSS A 1 A_JumpIfInventory("WallBehind", 1, 1)
Goto Death
TNT1 A 0 A_NoGravity
POSS A -1 A_Stop
Wait
This state shoots a projectile from the back of the monster, which checks if there's a wall:
Actor CheckForWall
{
Speed 30
Projectile
states
{
Spawn:
TNT1 A -1
Stop
Death:
TNT1 A 0 A_GiveToTarget("WallBehind", 1)
Stop
Crash:
XDeath:
TNT1 A 0
Stop
}
}
And finally here's the token item:
Actor WallBehind : Inventory {}
Of course replace the CustomDamage with the custom damagetype
Death.CustomDamage:
POSS A 1 A_FaceTarget
POSS A 3 A_CustomMissile("CheckForWall", 1.0, 0, 128)
POSS A 1 A_JumpIfInventory("WallBehind", 1, 1)
Goto Death
TNT1 A 0 A_NoGravity
POSS A -1 A_Stop
Wait
This state shoots a projectile from the back of the monster, which checks if there's a wall:
Actor CheckForWall
{
Speed 30
Projectile
states
{
Spawn:
TNT1 A -1
Stop
Death:
TNT1 A 0 A_GiveToTarget("WallBehind", 1)
Stop
Crash:
XDeath:
TNT1 A 0
Stop
}
}
And finally here's the token item:
Actor WallBehind : Inventory {}
Re: Pin enemy to a wall ((Help))
Thank you! i will try thisHannah Hivingpitch wrote:You can just make the projectile/hitscan have a custom damagetype and make a state like this:
Of course replace the CustomDamage with the custom damagetype
Death.CustomDamage:
POSS A 1 A_FaceTarget
POSS A 3 A_CustomMissile("CheckForWall", 1.0, 0, 128)
POSS A 1 A_JumpIfInventory("WallBehind", 1, 1)
Goto Death
TNT1 A 0 A_NoGravity
POSS A -1 A_Stop
Wait
This state shoots a projectile from the back of the monster, which checks if there's a wall:
Actor CheckForWall
{
Speed 30
Projectile
states
{
Spawn:
TNT1 A -1
Stop
Death:
TNT1 A 0 A_GiveToTarget("WallBehind", 1)
Stop
Crash:
XDeath:
TNT1 A 0
Stop
}
}
And finally here's the token item:
Actor WallBehind : Inventory {}
- TDRR
- Posts: 815
- Joined: Sun Mar 11, 2018 4:15 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Debian 12/ Manjaro
- Graphics Processor: nVidia with Vulkan support
- Location: Venezuela
Re: Pin enemy to a wall ((Help))
Yeah don't use it as is because i messed up in the Spawn state of the projectile: it should be TNT1 A 2 not TNT1 A -1, if you use it as is the monster will always get stuck because of the projectile's infinite range.Niphura wrote:Thank you! i will try this
You can also change the Death.CustomDamage part that says A_Stop to say: POSS A 1 A_Stop so that no explosion moves the monster out of it's position.
Re: Pin enemy to a wall ((Help))
OkTDRR wrote:Yeah don't use it as is because i messed up in the Spawn state of the projectile: it should be TNT1 A 2 not TNT1 A -1, if you use it as is the monster will always get stuck because of the projectile's infinite range.Niphura wrote:Thank you! i will try this
You can also change the Death.CustomDamage part that says A_Stop to say: POSS A 1 A_Stop so that no explosion moves the monster out of it's position.
Re: Pin enemy to a wall ((Help))
Okay so i made a weapon and a enemy with the things that you said, but there's a problem: when the enemy dies it stays on the air, it doesn't pin on the wall. it detects that is near a wall and go to the state of the damagetype in this case "Empalado" (that means impaled)
here's the files of the enemy and the weapon:
http://www.mediafire.com/file/x1w4u7hss ... r.pk3/file
http://www.mediafire.com/file/19dpe28eh ... w.pk3/file
here's the files of the enemy and the weapon:
http://www.mediafire.com/file/x1w4u7hss ... r.pk3/file
http://www.mediafire.com/file/19dpe28eh ... w.pk3/file
Re: Pin enemy to a wall ((Help))
Another way that i can think of is doing a projectile that push the enemy until the projectile crashes on a wall, any ideas on how to do that kind of projectile?
- TDRR
- Posts: 815
- Joined: Sun Mar 11, 2018 4:15 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Debian 12/ Manjaro
- Graphics Processor: nVidia with Vulkan support
- Location: Venezuela
Re: Pin enemy to a wall ((Help))
Do you want your mod/TC compatible with Zandronum or not?Niphura wrote:Another way that i can think of is doing a projectile that push the enemy until the projectile crashes on a wall, any ideas on how to do that kind of projectile?
Re: Pin enemy to a wall ((Help))
nopeTDRR wrote:Do you want your mod/TC compatible with Zandronum or not?Niphura wrote:Another way that i can think of is doing a projectile that push the enemy until the projectile crashes on a wall, any ideas on how to do that kind of projectile?
- TDRR
- Posts: 815
- Joined: Sun Mar 11, 2018 4:15 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Debian 12/ Manjaro
- Graphics Processor: nVidia with Vulkan support
- Location: Venezuela
Re: Pin enemy to a wall ((Help))
Take this ZScript solution:Niphura wrote:nope
Code: Select all
class Harpooned : Inventory
{
default
{
Inventory.MaxAmount 1;
}
}
class CrossbowBolt : Actor
{
Actor victim;
double victimHeight;
bool attachSelf;
Vector3 posOffset;
default
{
Radius 5;
Height 5;
Speed 50;
Damage 10;
Projectile;
}
override void PostBeginPlay()
{
super.PostBeginPlay();
pitch = target.pitch;
}
override int SpecialMissileHit(Actor victim)
{
if (!self.victim && victim != target)
{
let a = victim.angle;
let r = victim.radius;
victim.A_DamageSelf(damage);
self.victim = victim;
victimHeight = victim.height;
A_PlaySound("harpoon/hit", CHAN_AUTO);
// stuff
if (victim.CountInv("Harpooned") || victim.health > 0)
{
Destroy();
return 1;
// UNUSED
attachSelf = true;
posOffset = (
pos.x - (victim.pos.x + (cos(a) * r)),
pos.y - (victim.pos.y + (sin(a) * r)),
pos.z - victim.pos.z
);
}
if (victim.health <= 0)
{
victim.bNoGravity = true;
victim.painChance = 0;
victim.painSound = "";
victim.A_GiveInventory("Harpooned");
}
}
return 1;
}
override void Tick()
{
if (victim)
{
if ((victim is "PlayerPawn" || victim.bIsMonster) && !attachSelf)
victim.SetStateLabel("Pain");
if (attachSelf)
{
SetOrigin(victim.Vec3Offset(posOffset.x, posOffset.y, posOffset.z), true);
vel = victim.vel;
}
else
{
let zofs = -victimHeight / 2;
victim.SetOrigin(Vec3Offset(0, 0, zofs), true);
victim.angle = angle + 180;
}
}
if (vel.z == 0)
{
if (pos.z == ceilingz)
SetOrigin(Vec3Offset(0, 0, -height), true);
else if (pos.z == floorz)
SetOrigin(Vec3Offset(0, 0, height), true);
}
super.Tick();
}
states
{
Death:
TNT1 A 0 {
if (victim)
{
victim.A_DamageSelf(victim.health);
if (victim is "PlayerPawn" && !attachSelf)
{
victim.A_TakeInventory("Harpooned");
victim.Destroy();
victim = Spawn("DoomPlayer");
victim.A_GiveInventory("Harpooned");
}
}
else if (attachSelf)
bNoGravity = false;
}
TNT1 A 0 A_PlaySound("harpoon/wall", CHAN_AUTO);
Spawn:
HARP A -1;
stop;
}
}