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
cortlong50
Posts: 753
Joined: Mon Jun 24, 2013 7:12 pm
Location: UT-WA

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

Post by cortlong50 »

Kappes Buur wrote:
cortlong50 wrote: So...with the map pack being in .wad format
How would I organize the (let’s use doors as an example) door textures to show in the “doors” folder?
Since a wad file does not have a folder structure per se, you could sort
the textures into headings like this within TX_ headers
Spoiler:
Or preface the textures with an identifier, eg
Spoiler:
thanks kappes! im trying to avoid the engine being anymore mad at me than it already is. so ill try the second one! thanks!
Last edited by Blue Shadow on Mon Nov 06, 2017 1:14 am, edited 1 time in total.
Reason: Enabled BBCode.
User avatar
Clay
Posts: 190
Joined: Fri Sep 22, 2017 9:52 pm
Location: That one secret you always miss.

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

Post by Clay »

What are some methods of implementing missiles like a rocket on angled weapon that make it look like it is coming from the weapon?
ZippeyKeys12
Posts: 111
Joined: Wed Jun 15, 2016 2:49 pm

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

Post by ZippeyKeys12 »

SomeOtherDoomGuy wrote:What are some methods of implementing missiles like a rocket on angled weapon that make it look like it is coming from the weapon?
Fire a hitscan to judge the distance from the player and use trigonometry to find the angle from the weapon sprite. Then spawn the rocket offset from the player angled to hit the cursors target at that distance. Really convulated and annoying to use as a player but I think it's what you asked for.
Nevander
Posts: 2254
Joined: Mon Jan 06, 2014 11:32 pm

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

Post by Nevander »

Or a way without the convolutedness is to use A_FireCustomMissile and set the angle property and horizontal offset to match up with the crosshair.
User avatar
Clay
Posts: 190
Joined: Fri Sep 22, 2017 9:52 pm
Location: That one secret you always miss.

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

Post by Clay »

ZippeyKeys12 wrote: Fire a hitscan to judge the distance from the player and use trigonometry to find the angle from the weapon sprite. Then spawn the rocket offset from the player angled to hit the cursors target at that distance. Really convulated and annoying to use as a player but I think it's what you asked for.
That would be difficult for. Maybe I could get my wife to help with that. Math is her life.

Nevander wrote:Or a way without the convolutedness is to use A_FireCustomMissile and set the angle property and horizontal offset to match up with the crosshair.
That is what I have now. But no matter what you do , it either hits short of the crosshair for go past it. Very annoying.
User avatar
LanHikariDS
Posts: 179
Joined: Tue Aug 04, 2015 11:30 pm
Location: Playing in the snow

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

Post by LanHikariDS »

So, I managed to screw up so bad, ZDoom has a "Very Fatal Error" when I run my code. Long story short, I'm trying to have an actor spawn a different powerup based on a currently set CVAR, and here's what I tried:

Code: Select all

ACTOR PowerupSpawn
{
  Radius 1
  Height 1
  States
  {
  Spawn:
    PICO N 0
    Goto CVARSrch
  CVARSrch:
	TNT1 A 0 A_JumpIf(GetCVar(Slot1) == Soulsphere, "Soulsphere")
	TNT1 A 0 A_JumpIf(GetCVar(Slot1) == Megasphere, "Megasphere")
	Stop
  Soulsphere:
	TNT1 A 0 A_SpawnItemEx ("Soulsphere")
	Stop
  Megasphere:
	TNT1 A 0 A_SpawnItemEx ("Megasphere")
	Stop
   }
}
And here's what ZDoom says before throwing up a ZDoom Very Fatal Error
Script error, "DoakEngine.pk3:decorate" line 23:
Call to unknown function 'GetCVar'
Does anyone know how to do what I'm trying to do? I feel it's worth noting that my project is intended for Zandronum, so a such-compatible solution would be perferred.
User avatar
Apeirogon
Posts: 1603
Joined: Mon Jun 12, 2017 12:57 am

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

Post by Apeirogon »

You add string CVAR in cvarinfo?
ZippeyKeys12
Posts: 111
Joined: Wed Jun 15, 2016 2:49 pm

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

Post by ZippeyKeys12 »

Are Soulphere and Megasphere variables? Because otherwise they should be in quotes. And like Apeirogon said if they're supposed to be strings.
User avatar
worldendDominator
Posts: 283
Joined: Sun May 17, 2015 9:39 am

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

Post by worldendDominator »

I think the error if that the engine doesn't know that function in the first place.
Are you running it in Zandronum? If you are, then does the same happen in fresh GZDoom?
User avatar
LanHikariDS
Posts: 179
Joined: Tue Aug 04, 2015 11:30 pm
Location: Playing in the snow

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

Post by LanHikariDS »

Apeirogon wrote:You add string CVAR in cvarinfo?
Yes, all the CVARs are defined properly

Code: Select all

server noarchive string Slot1 = Soulsphere;
worldendDominator wrote:I think the error if that the engine doesn't know that function in the first place.
Are you running it in Zandronum? If you are, then does the same happen in fresh GZDoom?
I actually tested it in ZDoom 2.8.1, to make sure the code is right, before seeing if it's Zan-compatible
However, running it in the newest nightly of GZ did produce new results, and I think I see the issue there, but that doesn't help for my situation...
gzdoom-g3.3pre-64-g0e706bf wrote:Script error, "DoakEngine.pk3:decorate" line 23:
Invalid global identifier 'Soulsphere'

Script error, "DoakEngine.pk3:decorate" line 24:
Invalid global identifier 'Megasphere'
-----------------------------------------------------------------------------------------------------------------------------------------
New engine, new problems

Code: Select all

ACTOR PowerupSpawn
{
  Radius 1
  Height 1
  States
  {
  Spawn:
    PICO N 0
    Goto CVARSrch
  CVARSrch:
	TNT1 A 0 A_JumpIf(GetCVar(Slot1) == "Soulsphere", "Soulsphere")
	TNT1 A 0 A_JumpIf(GetCVar(Slot1) == "Megasphere", "Megasphere")
	Stop
  Soulsphere:
	TNT1 A 0 A_SpawnItemEx ("Soulsphere")
	Stop
  Megasphere:
	TNT1 A 0 A_SpawnItemEx ("Megasphere")
	Stop
   }
}
Now produces
gzdoom-g3.3pre-64-g0e706bf wrote:Script error, "DoakEngine.pk3:decorate" line 23:
Incompatible operands for == comparison
Script error, "DoakEngine.pk3:decorate" line 24:
Incompatible operands for == comparison
ZippeyKeys12
Posts: 111
Joined: Wed Jun 15, 2016 2:49 pm

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

Post by ZippeyKeys12 »

Perhaps DECORATE doesn't support using the equality operator for strings? If that's true, I'd move to using ZScript as its better for the future and its super easy to convert for simpler actors.
User avatar
Apeirogon
Posts: 1603
Joined: Mon Jun 12, 2017 12:57 am

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

Post by Apeirogon »

Change string CVAR to integer since
Return Value

Returns the server cvar as a float.
and at descrition of function write
float GetCvar(cvar)
which means it can return only fractional numbers.
Spoiler:
User avatar
LanHikariDS
Posts: 179
Joined: Tue Aug 04, 2015 11:30 pm
Location: Playing in the snow

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

Post by LanHikariDS »

As a test, I switched the CVars to int, and made the necessary changes. Everything now works properly in GZDoom, but Zan and ZDoom still cause a Very Fatal Error, so how do I use the ZScript?
ZippeyKeys12
Posts: 111
Joined: Wed Jun 15, 2016 2:49 pm

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

Post by ZippeyKeys12 »

Nice catch Apeirogon

https://zdoom.org/wiki/Converting_DECOR ... to_ZScript
In ZScript for a server cvar you can access it directly, bypassing the GetCVar problem with strings.
User avatar
NeoTerraNova
Posts: 153
Joined: Tue Mar 14, 2017 5:18 pm
Location: Western North Southlandia (East Side)

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

Post by NeoTerraNova »

Hello, again, everyone. Thank you in advance for any help you can offer me. I've got an issue that I can't seem to wrap my head around.

Is it possible to easily (with Decorate or simple ACS) perform the following actions:

-When reloading a magazine-fed weapon, retain a single round (the chambered round), then add the value of one full magazine?
EXAMPLE: A Handgun with a magazine capacity of 20 rounds. Player executes a mid-mag (tactical) reload. Player should have 21 rounds available.
I know that setting the maximum capacity of the weapon's magazine (Inventory.MaxAmount for the designated "magazine" ACTOR) to 21 would allow a potential capacity of 21 (say, if picking up loose pistol ammo, in this case), but is there a way to check and see if the magazine has at least one round in it, and retain that round?

-Also when reloading a magazine-fed weapon, how would one go about checking for the exact amount of remaining ammunition in a magazine, then somehow dumping loose bullet items on the ground?
EXAMPLE: Building from the first, say the Handgun has 14 rounds left. How would one go about dumping 13 of those rounds on the ground, and retaining one, then adding the 20 for the full magazine?

I have managed to create a working handgun, and it does reload both mid-mag, and when the weapon is empty, using the built-in reload function instead of the Action_Reload work-around. I already have loose ammo as an item, as well as specific ammo and magazines for the handgun. I'm comfortable with doing some ACS work if that's necessary - however or whatever method might work best.

Thanks again.

Return to “Editing (Archive)”