Enemy last stand states?
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.
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.
Enemy last stand states?
So back in 2014 I made some terrorist sprite that have a last stand sprites. I've seen this before and was wondering what the code would look like for something like this?
Heres what I mean:
Heres what I mean:
Re: Enemy last stand states?
Code: Select all
Death:
AAHH A 2 A_Jump(127, "LStand")
AAHH B 3
AAHH C -1
Stop
LIdle:
NZAH D 2 A_JumpIfTargetInLOS("LStand")
Loop
LDeath:
NZAH JKL 2
NZAH M -1
Stop
LStand:
NZAH EFG 2
NZAH H 2 A_FirePistol
NZAH I 2 A_Jump(127, "LDeath", "LStand")
Goto LIdle
Overview:
In Death, there's a 50% chance of it going to the LStand state.
In LStand state, it fires a pistol at the player. Then has a 50% chance of firing again or dying.
In LDeath, the actor dies in its last stand state (LStand).
In LIdle, it checks if the target in its line of sight before engaging. I have never used A_JumpIfTargetInLOS, but I assume this is how you use it.
Last edited by Voros on Mon Aug 14, 2017 11:06 pm, edited 1 time in total.
Re: Enemy last stand states?
Shouldn't the ending states be -1 duration?
Re: Enemy last stand states?
Yeah, I believe so. I dont have rotations for the last stand sprites.
Re: Enemy last stand states?
Btw is there a way to randomize it?
Re: Enemy last stand states?
It's only an example. Just trying to give a good enough example for Graaicko.
But still, which ending state should be -1?
But still, which ending state should be -1?
- DoomRater
- Posts: 8265
- Joined: Wed Jul 28, 2004 8:21 am
- Preferred Pronouns: He/Him
- Location: WATR HQ
- Contact:
Re: Enemy last stand states?
LDeath. It needs to have a frame with -1 duration instead of a Stop command.
Re: Enemy last stand states?
Alright set everything up, tried testing it but it gave this: (Script error, "SE5.wad:DECORATE" line 1112:
Invalid parameter 'a_firepistol').
Invalid parameter 'a_firepistol').
Re: Enemy last stand states?
You didn't actually use my code did you? You'll need to work on it more. What I posted is a proof of concept.
Re: Enemy last stand states?
Well I replaced it with A_CustomBulletAttack and fixed some of the states, but he doesnt wait to shoot and dies imediately after firing a few shots. he dies too quick. also when hes in his last stand, hes not shootable, and was wondering if there is a way to change the 'chance' value that he will go into last stand mode? 50 out 50 seems too much.
Re: Enemy last stand states?
256 is 100%. Change the value between 1-256 get different results.
Increase the number of frames via repeating the same frames 5 times then the frames related to jumping states come in.
Increase the number of tics. The ones I gave are very low.
Obviously you'll have to experiment a bit. And consider using dummy inventory items.
Increase the number of frames via repeating the same frames 5 times then the frames related to jumping states come in.
Increase the number of tics. The ones I gave are very low.
Obviously you'll have to experiment a bit. And consider using dummy inventory items.
Re: Enemy last stand states?
Okay, many thanks. Bit of an odd thing for a probability system.
- DoomRater
- Posts: 8265
- Joined: Wed Jul 28, 2004 8:21 am
- Preferred Pronouns: He/Him
- Location: WATR HQ
- Contact:
Re: Enemy last stand states?
For making the target shootable, it might be best to rework the entire monster using Wound states instead.
Wound states typically are entered when a monster reaches 6 health but you can override this to exactly the amount of health you set. Basically, using wound states you can make it so monsters can be overkilled so they can never enter this state, but if they reach this state on their own and they're supposed to just die instead of lying there trying to shoot you with a pistol, you can use actor commands to kill them. At that point, they'll lie there and just be ready to shoot the player, all wounded.
viewtopic.php?f=3&t=30642 Over here has an example of what wound states do to a player. Finally, using the example coded in this thread...
What I would do is add however much extra health a character should have in this wounded state to their base health and set that amount of wound health to the "Woundhealth" property.
Wound states typically are entered when a monster reaches 6 health but you can override this to exactly the amount of health you set. Basically, using wound states you can make it so monsters can be overkilled so they can never enter this state, but if they reach this state on their own and they're supposed to just die instead of lying there trying to shoot you with a pistol, you can use actor commands to kill them. At that point, they'll lie there and just be ready to shoot the player, all wounded.
viewtopic.php?f=3&t=30642 Over here has an example of what wound states do to a player. Finally, using the example coded in this thread...
Code: Select all
Wound:
AAHH A 2 A_Jump(127,2)
AAHH A 1 A_Die
Goto Death
LIdle:
NZAH D 2 A_JumpIfTargetInLOS("LStand")
Loop
LDeath:
NZAH JKL 2
NZAH M -1
Stop
LStand:
NZAH EFG 2
NZAH H 2 A_FirePistol
NZAH I 2
Goto Wound
Re: Enemy last stand states?
Sent you a pm Rater.
- DoomRater
- Posts: 8265
- Joined: Wed Jul 28, 2004 8:21 am
- Preferred Pronouns: He/Him
- Location: WATR HQ
- Contact:
Re: Enemy last stand states?
Although I got it, I haven't had a free moment to debug anything. I'll report back when I do!