The "How do I..." Thread

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.

Re: The "How do I..." Thread

Postby Ryan Cordell » Thu Jun 25, 2009 6:35 am

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.
User avatar
Ryan Cordell
PDA Man
 
Joined: 06 Feb 2005
Location: Capital of Explodistan
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: nVidia (Modern GZDoom)

Re: The "How do I..." Thread

Postby zwouth » Fri Jun 26, 2009 1:05 am

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%.
User avatar
zwouth
Thread Mortician
 
Joined: 31 Oct 2007

Re: The "How do I..." Thread

Postby Killar » Fri Jun 26, 2009 1:46 am

You have to edit the decorate of the armor and health bonuses. Just change inventory.maxamount to something above 200.
Like this:
Code: Select allExpand view
ACTOR HealthBonus+ : HealthBonus replaces HealthBonus
{
invnetory.maxamount 300
}

ACTOR ArmorBonus+ : ArmorBonus replaces ArmorBonus
{
invnetory.maxamount 300
}
User avatar
Killar
One step behind and in front.
 
Joined: 09 Feb 2009
Location: Always one step behind

Re: The "How do I..." Thread

Postby ThatOneZDoomer » Fri Jun 26, 2009 7:31 am

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? :P

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.


I should have replied sooner since I don't want to make it seem like I just randomly posted this and forgot about it.

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.
User avatar
ThatOneZDoomer
Still too lazy for a new avatar
 
Joined: 01 Jun 2008
Location: Where I'm at of course

Re: The "How do I..." Thread

Postby Osiris Kalev » Fri Jun 26, 2009 8:15 am

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. :P
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.
User avatar
Osiris Kalev
Chaotic....
 
Joined: 21 Aug 2006
Location: Australia, Elsewhere Within

Re: The "How do I..." Thread

Postby zwouth » Fri Jun 26, 2009 1:08 pm

Killar wrote:You have to edit the decorate of the armor and health bonuses. Just change inventory.maxamount to something above 200.
Thanks for pointing me in the right direction. Armor ended up being a little different, but it's all good now. :thumb:
Code: Select allExpand view
actor HealthBonus+ : HealthBonus replaces HealthBonus
{
  inventory.maxamount 9999
}

actor ArmorBonus+ : ArmorBonus replaces ArmorBonus
{
  armor.maxsaveamount 9999
}
User avatar
zwouth
Thread Mortician
 
Joined: 31 Oct 2007

Re: The "How do I..." Thread

Postby Recurracy » Sat Jun 27, 2009 5:54 am

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.
User avatar
Recurracy
Break out the buttah
 
Joined: 19 Dec 2008

Re: The "How do I..." Thread

Postby Ryan Cordell » Sat Jun 27, 2009 6:32 am

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.
User avatar
Ryan Cordell
PDA Man
 
Joined: 06 Feb 2005
Location: Capital of Explodistan
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: nVidia (Modern GZDoom)

Re: The "How do I..." Thread

Postby Recurracy » Sat Jun 27, 2009 10:10 am

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.
User avatar
Recurracy
Break out the buttah
 
Joined: 19 Dec 2008

Re: The "How do I..." Thread

Postby Ryan Cordell » Sat Jun 27, 2009 11:08 am

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:
Code: Select allExpand view
..
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.)
..


ACS:
Code: Select allExpand view
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);
   }
}


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. :(
User avatar
Ryan Cordell
PDA Man
 
Joined: 06 Feb 2005
Location: Capital of Explodistan
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: nVidia (Modern GZDoom)

Re: The "How do I..." Thread

Postby Recurracy » Sat Jun 27, 2009 1:09 pm

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! :D

What do I have to fill in in DynamiteTID?

Also, it said "unknown script 128", while I copied the script into a SCRIPTS lump.
User avatar
Recurracy
Break out the buttah
 
Joined: 19 Dec 2008

Re: The "How do I..." Thread

Postby Remmirath » Sat Jun 27, 2009 1:47 pm

Did you compile it?
User avatar
Remmirath
Slowest mapper on Earth
 
Joined: 23 Dec 2007
Location: My house
Discord: Remmirath#0424
Twitch ID: TheRemmirath
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: nVidia with Vulkan support

Re: The "How do I..." Thread

Postby Jimmy » Sat Jun 27, 2009 2:02 pm

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.

Code: Select allExpand view
   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);


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.
User avatar
Jimmy
 
 
 
Joined: 10 Apr 2006
Discord: Jimmy#4100
Twitch ID: JimmySquared
Operating System: Windows 10/8.1/8/201x 64-bit

Re: The "How do I..." Thread

Postby Ryan Cordell » Sat Jun 27, 2009 4:07 pm

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! :D

What do I have to fill in in DynamiteTID?

Also, it said "unknown script 128", while I copied the script into a SCRIPTS lump.


1) Because I'm afraid the two might clash somehow. Doom has this odd habit of being annoying sometimes.. :P

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.)
User avatar
Ryan Cordell
PDA Man
 
Joined: 06 Feb 2005
Location: Capital of Explodistan
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: nVidia (Modern GZDoom)

Re: The "How do I..." Thread

Postby Lysander » Sat Jun 27, 2009 4:35 pm

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?
User avatar
Lysander
Would you believe it?
 
Joined: 27 Apr 2009

PreviousNext

Return to Editing (Archive)

Who is online

Users browsing this forum: No registered users and 1 guest