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 cortlong50 » Mon Nov 06, 2017 1:11 am

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
cortlong50
editing my comments ad nauseam
 
Joined: 24 Jun 2013
Location: UT-WA

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

Postby Clay » Tue Nov 07, 2017 9:23 pm

What are some methods of implementing missiles like a rocket on angled weapon that make it look like it is coming from the weapon?
User avatar
Clay
Join my model specific Dicord! https://discord.gg/hQD9Va
 
Joined: 22 Sep 2017
Location: That one secret you always miss.
Discord: SomeOtherDoomGuy#7217

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

Postby ZippeyKeys12 » Tue Nov 07, 2017 9:50 pm

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.
ZippeyKeys12
 
Joined: 15 Jun 2016

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

Postby Nevander » Tue Nov 07, 2017 10:06 pm

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.
Nevander
Self-Banned User
 
Joined: 06 Jan 2014

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

Postby Clay » Tue Nov 07, 2017 10:11 pm

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
Clay
Join my model specific Dicord! https://discord.gg/hQD9Va
 
Joined: 22 Sep 2017
Location: That one secret you always miss.
Discord: SomeOtherDoomGuy#7217

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

Postby LanHikariDS » Wed Nov 08, 2017 2:44 am

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 allExpand view
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
LanHikariDS
Some people call these demons, I call them bitches.
 
Joined: 05 Aug 2015
Location: Playing in the snow

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

Postby Apeirogon » Wed Nov 08, 2017 6:18 am

You add string CVAR in cvarinfo?
User avatar
Apeirogon
I have a strange sense of humour
 
Joined: 12 Jun 2017

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

Postby ZippeyKeys12 » Wed Nov 08, 2017 11:15 am

Are Soulphere and Megasphere variables? Because otherwise they should be in quotes. And like Apeirogon said if they're supposed to be strings.
ZippeyKeys12
 
Joined: 15 Jun 2016

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

Postby worldendDominator » Wed Nov 08, 2017 11:59 am

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
worldendDominator
 
Joined: 17 May 2015

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

Postby LanHikariDS » Wed Nov 08, 2017 1:31 pm

Apeirogon wrote:You add string CVAR in cvarinfo?

Yes, all the CVARs are defined properly
Code: Select allExpand view
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 allExpand view
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
User avatar
LanHikariDS
Some people call these demons, I call them bitches.
 
Joined: 05 Aug 2015
Location: Playing in the snow

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

Postby ZippeyKeys12 » Wed Nov 08, 2017 2:24 pm

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.
ZippeyKeys12
 
Joined: 15 Jun 2016

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

Postby Apeirogon » Wed Nov 08, 2017 2:30 pm

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
Apeirogon
I have a strange sense of humour
 
Joined: 12 Jun 2017

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

Postby LanHikariDS » Wed Nov 08, 2017 4:58 pm

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?
User avatar
LanHikariDS
Some people call these demons, I call them bitches.
 
Joined: 05 Aug 2015
Location: Playing in the snow

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

Postby ZippeyKeys12 » Wed Nov 08, 2017 6:05 pm

Nice catch Apeirogon

https://zdoom.org/wiki/Converting_DECORATE_code_to_ZScript
In ZScript for a server cvar you can access it directly, bypassing the GetCVar problem with strings.
ZippeyKeys12
 
Joined: 15 Jun 2016

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

Postby NeoTerraNova » Wed Nov 08, 2017 7:24 pm

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.
User avatar
NeoTerraNova
 
Joined: 14 Mar 2017
Location: Western North Southlandia (East Side)

PreviousNext

Return to Editing (Archive)

Who is online

Users browsing this forum: No registered users and 3 guests