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.
User avatar
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

Post by ThatOneZDoomer »

Lysander wrote: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?
That should be simple to do. As an example...

Code: Select all

Actor MultiFist : Fist
{
	States
	{
	Fire:
		PUNG A 0 A_Jump(256,"Punch1","Punch2","Punch3","Punch4") //This should give an equal chance of jumping to any of the four states below.
	Punch1:
		PUNG B 4
		PUNG C 4 A_Punch
		PUNG D 5
		PUNG C 4
		PUNG B 5 A_ReFire
		Goto Ready
	Punch2:
		PUNG B 4
		PUNG C 4 A_Punch
		PUNG D 5
		PUNG C 4
		PUNG B 5 A_ReFire
		Goto Ready
	Punch3:
		PUNG B 4
		PUNG C 4 A_Punch
		PUNG D 5
		PUNG C 4
		PUNG B 5 A_ReFire
		Goto Ready
	Punch4:
		PUNG B 4
		PUNG C 4 A_Punch
		PUNG D 5
		PUNG C 4
		PUNG B 5 A_ReFire
		Goto Ready
	}
}
I haven't actually tested that particular example, but it should work, since I did something similar with having a rail gun that randomly fires different colored shots anytime you shoot.
User avatar
Ceeb
Posts: 5125
Joined: Wed Jun 11, 2008 4:07 pm
Location: Castle Wut

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

Post by Ceeb »

I used that method to give my minigun more than one kind of flash.
User avatar
Lysander
Posts: 50
Joined: Mon Apr 27, 2009 8:32 pm

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

Post by Lysander »

Thanks, ZDoomer. One question, though: What does the "256" represent?
User avatar
Captain Ventris
Posts: 4624
Joined: Mon Jul 31, 2006 4:25 pm
Location: San Antonio, TX

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

Post by Captain Ventris »

Lysander wrote:Thanks, ZDoomer. One question, though: What does the "256" represent?
It is the numerical probability that the Jump Command will occur. The maximum number is 256, so a value of 256 means the Jump Command always happens.
User avatar
Ceeb
Posts: 5125
Joined: Wed Jun 11, 2008 4:07 pm
Location: Castle Wut

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

Post by Ceeb »

Lysander wrote:Thanks, ZDoomer. One question, though: What does the "256" represent?
The number is the odds of a jump. 0 is never, 256 is always.
User avatar
Recurracy
Posts: 559
Joined: Fri Dec 19, 2008 12:11 pm

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

Post by Recurracy »

Blade Nightflame wrote: 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.)
2) Well, you can chuck dynamites pretty fast, because you can throw it like a turd and then you don't really need to hold the button.

3) I don't understand you there. I have the ACC compiler, but when I dragged an ACS file onto the compiler, I recieved a .o file, so I put that into my .wad, put in a LOADACS lump, put 'DYNSCRI' in there, but it said 'unknown p-code 347 in script 128'! What am I doing wrong?

Also, how do I convert the compiled ACS script to a script that you can edit? And what do I have to replace with HOLDTIME?
User avatar
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

Post by Ryan Cordell »

XWE allows you to search for the compiler, so you can just click on a SCRIPTS lump and compile it from there. And just a wild guess..

Did you also have #include "zcommon.acs" at the top? :P

@Ceeb: Shouldn't it be 255 more like it though? I don't trust 256 anymore, especially when you consider it's an overflow in the Turbo function (max. is 255) and in the Painchance property (256 becomes -1, as far as the engine is concerned.), might be elsewhere too.
User avatar
Recurracy
Posts: 559
Joined: Fri Dec 19, 2008 12:11 pm

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

Post by Recurracy »

Got the p-script thing to work (I use Skulltag 97e from now), but the strength doesn't work at all. Neither does the bar show up.
Spoiler:
User avatar
Lysander
Posts: 50
Joined: Mon Apr 27, 2009 8:32 pm

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

Post by Lysander »

Ceeb wrote:
Lysander wrote:Thanks, ZDoomer. One question, though: What does the "256" represent?
The number is the odds of a jump. 0 is never, 256 is always.
Seems quite arbitrary. 256? Why not 100 to represent percentage? It would be much simpler (in the case of multi-choice arguments) to do this so you could have, say for four arguments with equal probability, set each one to 25. 256 is confusing as hell and I don't even know if the math would work on that without any preconceived concepts of how it works..
User avatar
Ceeb
Posts: 5125
Joined: Wed Jun 11, 2008 4:07 pm
Location: Castle Wut

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

Post by Ceeb »

Quit your fucking bitching and take it up with randy if you really care THAT much about something so utterly pointless.

And yes, I'm in a foul mood.
User avatar
bagheadspidey
Posts: 1490
Joined: Sat Oct 20, 2007 10:31 pm

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

Post by bagheadspidey »

256 is 2*128, 4*64, 8*32, 16*16. So a quarter of 256 is 64, an eighth is 32. Three quarters is 192 (64*3).

Like 100, 256 is a perfect square... 100 is 10^2, 256 is 16^2. But 256 is also 4^4 and 2^8. It's a perfect 4th power and perfect 8th power as well, making it inherently cooler than 100. Does that help?
User avatar
Lysander
Posts: 50
Joined: Mon Apr 27, 2009 8:32 pm

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

Post by Lysander »

bagheadspidey wrote:256 is 2*128, 4*64, 8*32, 16*16. So a quarter of 256 is 64, an eighth is 32. Three quarters is 192 (64*3).

Like 100, 256 is a perfect square... 100 is 10^2, 256 is 16^2. But 256 is also 4^4 and 2^8. It's a perfect 4th power and perfect 8th power as well, making it inherently cooler than 100. Does that help?
Ah, yes. Thanks.
User avatar
Ceeb
Posts: 5125
Joined: Wed Jun 11, 2008 4:07 pm
Location: Castle Wut

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

Post by Ceeb »

You did that just to spite me. :glare:
User avatar
bagheadspidey
Posts: 1490
Joined: Sat Oct 20, 2007 10:31 pm

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

Post by bagheadspidey »

*hater blockers*
User avatar
Lysander
Posts: 50
Joined: Mon Apr 27, 2009 8:32 pm

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

Post by Lysander »

Sorry, but I have another problem...

I'm working on a HUD.

Image

When I load it up, it does that... clipping thing in the blank area. How do I fix this? I've tried a few things that I know of, but it still does that. :(

Return to “Editing (Archive)”