The "How do I..." Thread
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.
-
Ryan Cordell
- Posts: 4349
- Joined: Sun Feb 06, 2005 6:39 am
- Preferred Pronouns: No Preference
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia (Modern GZDoom)
- Location: Capital of Explodistan
Re: The "How do I..." Thread
It does. Check out that gah mod, Attack of the Triad, I think that has some. There was also jDRP's Plasma Gun converted to GZD once.
-
zwouth
- Posts: 72
- Joined: Wed Oct 31, 2007 5:57 pm
Re: The "How do I..." Thread
How do I get the players armor and health above 200% (and the HUD to show it). I'm trying to recreate the behavior of early doom versions (up to v1.2?) where collecting potions and armor pieces you could go over 200%.
-
Killar
- Posts: 240
- Joined: Mon Feb 09, 2009 12:15 pm
- Location: Always one step behind
Re: The "How do I..." Thread
You have to edit the decorate of the armor and health bonuses. Just change inventory.maxamount to something above 200.
Like this:
Like this:
Code: Select all
ACTOR HealthBonus+ : HealthBonus replaces HealthBonus
{
invnetory.maxamount 300
}
ACTOR ArmorBonus+ : ArmorBonus replaces ArmorBonus
{
invnetory.maxamount 300
}-
ThatOneZDoomer
- Posts: 226
- Joined: Sun Jun 01, 2008 1:33 am
- Preferred Pronouns: She/Her
- Location: Where I'm at of course
Re: The "How do I..." Thread
I should have replied sooner since I don't want to make it seem like I just randomly posted this and forgot about it.Osiris Kalev wrote:@ThatOneZDoomer: I believe one way you could go about making this type of enemy is to have a check before going into your missile state to see if the player or target was within a certain x and y distance away. So, you could have it check that the bomber is within 10 units of the target on the x/y plane. The Z plane, you'd only have to make sure the bomber is above the target. I mean, it'd make no sense if the bomber were below you and dropped bombs, right?
Edit: I think though you'd have to do it all with ACS checks. I thought you'd be able to do it with A_JumpIf, but my rusty knowledge kinda failed on me.
Anyway, breaking it down, I think two things needs to be done for this to work correctly. One, the bomber will have to move above it's target, not just toward it, at least when it's close enough. Second, it'll have to check the Z axis of both itself and it's target before attacking.
I think with a combination of ThrustThingZ, A_JumpIfCloser and A_CheckCeiling, it should be possible to make the bomber move above the target only when it's close to it. Hmm... that could make it quite functional, but even if I force it to only attack when it's very close to it's target, it could still try to bomb if it's right in front of the target. Thus, gonna check to make sure it's above the target. For A_JumpIf, I see you can check for x, y, or z. However, what exactly does it check about the planes, the actor's absolute position on the map? There isn't a way to compare the bomber's z plane to it's target's z plane? I'm pretty poor at ACS scripting, so I might need some help on that.
Maybe I could whip up an example Bomber Cacodemon to see if I can't come up with something close, along with proving I'm actually trying something and then get further help.
Edit: Here's a rough example of what I want to do. It seems like the bit of getting it to rise above it's target works well enough (proving there isn't a low ceiling), but there still remains the problem of checking it's Z axis to that of the target's. Basically, I want to make sure it's a certain distance above the target before attacking.
You do not have the required permissions to view the files attached to this post.
-
Osiris Kalev
- Posts: 290
- Joined: Sun Aug 20, 2006 11:06 pm
- Location: Australia, Elsewhere Within
Re: The "How do I..." Thread
I'm thinking the A_JumpIf checks the absolute position on the called plane of the actor. I could test it later on tonight when I'm back from work.
However, the A_JumpIfCloser could be used for checking the x and y values, but I'm not sure if it also takes the z height into account (meaning if it does, then this would not work properly). As for checking the z values, I think it's going to need ACS. I could write up some scripts for you if you want, but I need to figure out how to get both actor's z heights. It's easy to get one, but to get the target's z height, I'm not sure how to do.
Edit: Okay, so I can see you've done just that.
Now all that's needed is the Z height stuff. Which unfortunately, I still am not sure of how to accomplish. Getting the bomber's z height is easy, but getting the target's z height is something I'm not sure how to do.
Edit Edit: I'm going to test something right now, which may or may not work. I'm hoping it does work.
Edit Edit Edit: Okay, what I thought would work did not. It involved using A_JumpIf and trying to use tidtohate and hoping that making that equal to z in it's own equation would get the z height of the current target. How wrong was I.
However, the A_JumpIfCloser could be used for checking the x and y values, but I'm not sure if it also takes the z height into account (meaning if it does, then this would not work properly). As for checking the z values, I think it's going to need ACS. I could write up some scripts for you if you want, but I need to figure out how to get both actor's z heights. It's easy to get one, but to get the target's z height, I'm not sure how to do.
Edit: Okay, so I can see you've done just that.
Now all that's needed is the Z height stuff. Which unfortunately, I still am not sure of how to accomplish. Getting the bomber's z height is easy, but getting the target's z height is something I'm not sure how to do.
Edit Edit: I'm going to test something right now, which may or may not work. I'm hoping it does work.
Edit Edit Edit: Okay, what I thought would work did not. It involved using A_JumpIf and trying to use tidtohate and hoping that making that equal to z in it's own equation would get the z height of the current target. How wrong was I.
-
zwouth
- Posts: 72
- Joined: Wed Oct 31, 2007 5:57 pm
Re: The "How do I..." Thread
Thanks for pointing me in the right direction. Armor ended up being a little different, but it's all good now.Killar wrote:You have to edit the decorate of the armor and health bonuses. Just change inventory.maxamount to something above 200.
Code: Select all
actor HealthBonus+ : HealthBonus replaces HealthBonus
{
inventory.maxamount 9999
}
actor ArmorBonus+ : ArmorBonus replaces ArmorBonus
{
armor.maxsaveamount 9999
}-
Recurracy
- Posts: 559
- Joined: Fri Dec 19, 2008 12:11 pm
Re: The "How do I..." Thread
How do I make the dynamite throwing system like in Blood?
If you don't know what I mean, here's a little video to describe it somehow:
http://www.youtube.com/watch?v=ZoANP04xBVk
Pay attention closely and you'll probably see a little red bar that appears sometimes. That's what I'm trying to recreate. The red bar that shows how far my dymanite flies, and the system to define the speed where the dynamite flies with. I'd like to do this with ACS however, and not having to define thousands of different actors.
If you don't know what I mean, here's a little video to describe it somehow:
http://www.youtube.com/watch?v=ZoANP04xBVk
Pay attention closely and you'll probably see a little red bar that appears sometimes. That's what I'm trying to recreate. The red bar that shows how far my dymanite flies, and the system to define the speed where the dynamite flies with. I'd like to do this with ACS however, and not having to define thousands of different actors.
-
Ryan Cordell
- Posts: 4349
- Joined: Sun Feb 06, 2005 6:39 am
- Preferred Pronouns: No Preference
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia (Modern GZDoom)
- Location: Capital of Explodistan
Re: The "How do I..." Thread
The bar can be done with ACS - a HudMessage function that prints out a bar graphic, said function also tracks the value of an integer/variable, like, STRENGTH.
The dynamite is one single actor (or two, I guess. There's probably a reason you'd need one or more..), who's speed or, preferably, momentum, is a result of the STRENGTH integer value being added to another value which the dynamite is based off. I think Speed would work best, where you could just go something like SetActorProperty(0, APROP_SPEED, strength+SPEED);
For SPEED, you'd have to input the minimum speed that the dynamite actor has. I think that's it, at least.
The dynamite is one single actor (or two, I guess. There's probably a reason you'd need one or more..), who's speed or, preferably, momentum, is a result of the STRENGTH integer value being added to another value which the dynamite is based off. I think Speed would work best, where you could just go something like SetActorProperty(0, APROP_SPEED, strength+SPEED);
For SPEED, you'd have to input the minimum speed that the dynamite actor has. I think that's it, at least.
-
Recurracy
- Posts: 559
- Joined: Fri Dec 19, 2008 12:11 pm
Re: The "How do I..." Thread
How would the code look like? I'm a complete noob with ACS, especially when it comes to this kind of stuff.
Thanks for the reply, though, it helped anyway, even while I don't know how to code it.
Thanks for the reply, though, it helped anyway, even while I don't know how to code it.
-
Ryan Cordell
- Posts: 4349
- Joined: Sun Feb 06, 2005 6:39 am
- Preferred Pronouns: No Preference
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia (Modern GZDoom)
- Location: Capital of Explodistan
Re: The "How do I..." Thread
Because I won't be needing it, this will be a very, very rough example. I'm sure someone else would be able to fix any errors in here, otherwise this would've been perfected had I been using it myself.
DECORATE:
ACS:
Then you would have to take away all of value_strenght (IE, A_TakeInventory("value_strength",999)) when you stop firing the dynamite. Again, I'm not sure said code will work, you'll probably have to muck around with it until it works. I'm sure there are far more efficient and optimized ways of doing so though. 
DECORATE:
Code: Select all
..
Fire:
DYNM A 0 ACS_Execute(128,0)
DYNM A 1 A_GiveInventory("value_strength",X) //Replace X with any number, like 1, 2, 3, etc.)
..
Code: Select all
SCRIPT 128 (void)
{
SetFont("IMAGE"); //I can't remember how exactly it works again, but you replace IMAGE with the graphic that you have stored..
SetHudSize(320, 200, 1);
int buttons = GetPlayerInput(-1, INPUT_OLDBUTTONS);
int strength_value = CheckInventory("value_strength")
HudMessage(d:(strength_value); HUDMSG_PLAIN,13,CR_RED,X,Y,HOLDTIME);
if(buttons & BT_ATTACK) //or BT_ALTATTACK, your choice.
{
SetActorProperty(DynamiteTID, APROP_SPEED, strength_value+SPEED);
}
}
-
Recurracy
- Posts: 559
- Joined: Fri Dec 19, 2008 12:11 pm
Re: The "How do I..." Thread
Why is there Strength_value in the code while there is value_strength in the DECORATE?
Anyway, thanks a lot! I'm gonna try it now and keep fiddling with it until I get the wanted result. Thank you!
What do I have to fill in in DynamiteTID?
Also, it said "unknown script 128", while I copied the script into a SCRIPTS lump.
Anyway, thanks a lot! I'm gonna try it now and keep fiddling with it until I get the wanted result. Thank you!
What do I have to fill in in DynamiteTID?
Also, it said "unknown script 128", while I copied the script into a SCRIPTS lump.
-
Remmirath
- Posts: 2562
- Joined: Sun Dec 23, 2007 3:53 am
- Graphics Processor: nVidia with Vulkan support
- Location: My house
Re: The "How do I..." Thread
Did you compile it?
-
Jimmy
-

- Posts: 4728
- Joined: Mon Apr 10, 2006 1:49 pm
- Preferred Pronouns: He/Him
Re: The "How do I..." Thread
How exactly do I get a third-person camera to stay the same distance from the player based on the direction he's facing?
There's gotta be something glaringly obviously wrong with this code, though no matter what I change it to, I always end up with the EXACT SAME result: the camera stays in the same position relative to the player but doesn't circle around him.
CameraZoom is the distance between the player and the camera.
CameraHeight is the absolute Z height of the camera.
I think the Camera variable is whether the camera is actually being used to home in on the player at the time.
There's gotta be something glaringly obviously wrong with this code, though no matter what I change it to, I always end up with the EXACT SAME result: the camera stays in the same position relative to the player but doesn't circle around him.
Code: Select all
if(!FreeCamera)
{
SetActorAngle(TID_PLAYER,CameraRotate);
SetActorAngle(TID_CAMERA,CameraRotate);
}
else
{
angle = GetActorAngle(TID_PLAYER) << 8;
SetActorAngle(TID_CAMERA,GetActorAngle(TID_PLAYER));
SetActorPosition(TID_CAMERA,
GetActorX(TID_PLAYER) + 0-(CameraZoom * cos(angle)),
GetActorY(TID_PLAYER) + 0-(CameraZoom * sin(angle)),
GetActorZ(TID_PLAYER) + CameraHeight * (Camera == 2),
0);
}
SetActorPitch(TID_PLAYER,0.0);CameraHeight is the absolute Z height of the camera.
I think the Camera variable is whether the camera is actually being used to home in on the player at the time.
-
Ryan Cordell
- Posts: 4349
- Joined: Sun Feb 06, 2005 6:39 am
- Preferred Pronouns: No Preference
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia (Modern GZDoom)
- Location: Capital of Explodistan
Re: The "How do I..." Thread
1) Because I'm afraid the two might clash somehow. Doom has this odd habit of being annoying sometimes..Recurracy wrote:Why is there Strength_value in the code while there is value_strength in the DECORATE?
Anyway, thanks a lot! I'm gonna try it now and keep fiddling with it until I get the wanted result. Thank you!
What do I have to fill in in DynamiteTID?
Also, it said "unknown script 128", while I copied the script into a SCRIPTS lump.
2) DynamiteTID should be the TID of the dynamite, so in the dynamite, put something like Thing_ChangeTID(0,134), and use 134 instead of DynamiteTID. Unless you'll be able to chuck many more dynamites faster, then I think you'll have to use a script that changes each dynamites actors TID separately.
3) Compile it? (You should have a lump above it named whatever you want, and you can also change it's type to 18 - which makes it an ACS lump. SCRIPTS lumps always compile to the lump above. Keep that in mind.)
-
Lysander
- Posts: 50
- Joined: Mon Apr 27, 2009 8:32 pm
Re: The "How do I..." Thread
How do I make a melee weapon that has several different animations and attacks when I press fire? Like, say, if I had four, there would be a 25% chance each would be called, so that when I press fire, it randomly does one of several of these attacks. Anyone?