Jump to content
  • 0

Thrown Grenade Not Working Appropriately


[name_withheld]

Question

So, I wanted to add some grenades to my project as a weapon / quick throw (via dedicated key,) and was lucky to find something pretty reasonable here. It works great as a quick throw, but I cannot, for the life of me, get it to work as a normal weapon as well.

Currently, it's set to weapon slot 8, but it doesn't allow me to access or scroll across this slot. It also doesn't allow me to even add it via DoomBuilder, even when I add editor numbers (I currently have none set because it was giving me an error message when I do.)

I'm also unsure of how to modify the Z-Script to not give the player grenades at the beginning of play, as this is the first time I've worked with Z-Script specifically. Below I have linked to the file I have modified a little bit. Any help in this matter would be GREATLY appreciated, thanks! :)

Link to My Piss-Poor Scripting

Edited by [name_withheld]
Added link

Share this post


Link to post

7 answers to this question

Recommended Posts

  • 1

Hullo there.

 

I'm a complete noob with ZScript too so I'm learning as well, BUT... I do see a horrendously outdated version of ZScript being called in Zscript.zsc :O If you have the latest version of GZDoom and Slade you should be safe to rename it to 4.10.0

 

As for weapon binding. I couldn't get binding the weapons to work via the actual weapon script. I had to add them in KEYCONF with the phrase 

"Setslot <WeaponSlotNumber> <WeaponClassName>"

 

If it doesn't work then perhaps you need to add a custom player that has -- In the properties block (The first block below <Default>):

 

player.weaponslot "8" "KZ_GrenadeWeapon"

 

Hmm and in the Mapinfo lump I'm not seeing those ed numbers you're speaking of :o (If you don't know they go in there as opposed to Decorate where you add the numbers after the weapon class).

 

And also I don't understand this. It seems you're trying to BOTH have a quick button press to call the grenade throwing function AND add a weapon class that you can select and use as normal :o

If you're trying to bind G to throw the grenade but require the player to first select the weapon, I dunno how you do that. The engine will, as far as I know, always wait for mousebutton presses if you have a weapon selected. So it would need some custom re-writing of the default weapon attack code to attain what you, possible, desire.

Edited by Wo0p

Share this post


Link to post
  • 1

You should definitely add a custom player then. And also now that I think about it, Doom only has 6 slots by default so he's not configured to select slot 8. So yeah, make a new playerpawn that inherits from DoomPlayer:

 

Class MyPawn : DoomPlayer

{

  Default

  {

  player.weaponslot 8 "KZ_GrenadeWeapon";

  }

}

 

EDIT:

 

Forgot to mention you then also need to put in KEYCONF:

 

ClearPlayerClasses

AddPlayerClass MyPawn

 

Not this removes the default player pawn when starting a new game and defaults to the only class left: MyPawn. So if you have more classes to choose from, then remember to add them here :)

 

And of course include an ednum to the new player class in MAPINFO

Edited by Wo0p

Share this post


Link to post
  • 0

Adding "Setslot 8 KZ_GrenadeWeapon" to the KEYCONFIG seems to do the same thing that adding the weapon via "Set.WeaponSlot 8" does and just doesn't allow me to select the slot or scroll past it. :/

Also, trying to add the weapons / ammo via the MAPINFO doesn't seem to work, either.

As far as adding the grenade as both a weapon and quick attack, I want to be able to do both separately from one another (although, you'd still be able to quick throw a grenade while you have it selected as a weapon.)

Share this post


Link to post
  • 0

I tried changing the 8 to a 5 and got the same results, sadly. As far as player classes, I am currently defining a custom player class in a decorate file. Would I be able to inherit from that custom class in the Z-Script even though it's defined in a decorate file? I'm just using it to set the player's start items (removed the pistol, and changed the fist.)

Share this post


Link to post
  • 0

I ended up removing some stuff pertaining to the grenades only showing up in secret sectors as an item that can be picked up, and removed the part in the scripting that gave the player the inventory item at the start of the game so they can quick-throw the grenades. They work now, both as a quick-throw attack, and as a standalone weapon in slot "5." However, the only way to access either of these items now is to IDFA or IDKFA them into the inventory. I have an editor number defined in the MAPINFO, but nothing shows up in DoomBuilder (I'm using the bug fix version, so it should cooperate with the Z-Scripting.)

Updated PK3 Here:
https://drive.google.com/file/d/1A1o8aOSuKVEYU-gc0LthRknrgx3dU4ZN/view?usp=sharing

Edited by [name_withheld]
grammatical error

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...