Knifing Key

Discuss all aspects related to modding Zandronum here.
Post Reply
Hece
Forum Regular
Posts: 114
Joined: Wed Jun 06, 2012 6:26 am
Location: Phobos

Knifing Key

#1

Post by Hece » Wed Jun 20, 2012 5:23 am

How to make quick knifing when you press, for example, Q or grenade throw form G?
I tried to look this up form WAD scripts but didn't get it.

And is there actor flag/property if I want to make weapon silent, so the monsters wont hear it?
Last edited by Hece on Wed Jun 20, 2012 6:22 am, edited 1 time in total.

Sergeant_Mark_IV
 
Posts: 82
Joined: Tue Jun 05, 2012 4:17 am
Location: Brazil

RE: Knifing Key

#2

Post by Sergeant_Mark_IV » Wed Jun 20, 2012 6:31 am

Well, its a bit complicated. You will need to know about DECORATE, KEYCONF, and ACS to do it.




First of all, you need to make a custom inventory DECORATE item


Actor UseKnife : Inventory
{
inventory.maxamount 1
}




Now you need to make the following ACS script
(I'm suggesting the script number 600. But you can use any number you want)

script 600 (void)
{
GiveInventory("UseKnife", 1);
}


Use Slade 3 ACS compiler to compile your script. If you don't know how to properly implement scripts in a wad or pk3 (they use different ways to read scripts) Read the Zdoom WIki for more info.



Now in your KEYCONF lump, you must bind a key to give the UseKnife inventory


addkeysection "New Actions" NewActions

addmenukey "Knife" knifeattack
alias knifeattack "puke 600"
defaultbind Q knifeattack


This will make the game start the script 600 whenever you press Q.
PS: If you want to make another script to make a throwable grenade, you don't need to write the "addkeysection "New Actions" NewActions " again. You only need to write this line once.


Now, in all your weapon Ready states, you need to make it jump to another state which uses the knife to attack.

Something like this:


Ready:
PISG A 1 A_WeaponReady
PISG A 0 A_JumpIfInventory("UseKnife", 1, "KnifeAttack")
Loop


This will make the weapon always jump to a state called KnifeAttack if you have the custom inventory item.

KnifeAttack:
KNIF A 2 asoihfoasfh do your stuff
// // // // // // //
// // // // // // //
TNT1 A 0 A_TakeInventory("UseKnife", 1)
Goto Ready


This take inventory line is important to make the DECORATE know that you already performed the knife attack, and prevent it from looping the animation.

Ijon Tichy
Frequent Poster Miles card holder
Posts: 901
Joined: Mon Jun 04, 2012 5:07 am

RE: Knifing Key

#3

Post by Ijon Tichy » Wed Jun 20, 2012 8:14 am

+NOALERT for all your not-alerting-monster needs
use A_AlertMonsters to explicitly alert

Shoggy
 
Posts: 65
Joined: Tue Jun 05, 2012 11:42 pm
Location: Tokyo, JPN
Contact:

RE: Knifing Key

#4

Post by Shoggy » Wed Jun 20, 2012 3:47 pm

would be cool if someone can make a mod so ppl can knife like counterstrike

Hece
Forum Regular
Posts: 114
Joined: Wed Jun 06, 2012 6:26 am
Location: Phobos

RE: Knifing Key

#5

Post by Hece » Thu Jun 21, 2012 6:44 am

Shoggy wrote: would be cool if someone can make a mod so ppl can knife like counterstrike
Do you mean that it knifes differently in AltFire?

Shoggy
 
Posts: 65
Joined: Tue Jun 05, 2012 11:42 pm
Location: Tokyo, JPN
Contact:

RE: Knifing Key

#6

Post by Shoggy » Mon Jun 25, 2012 4:31 pm

Hece wrote:
Shoggy wrote: would be cool if someone can make a mod so ppl can knife like counterstrike
Do you mean that it knifes differently in AltFire?
In the game counsterstrike, i believe slashes (primary fire) do about 20-25% damage
and stabs (alt fire) do about 45-50% damage

Example of counterstrike knifing
phpBB [video]
The [video] tag is deprecated, please use the [media] tag

Post Reply