self.items is where an entities items are stored.
What you'll want to do is remove the existing (to be upgraded) weapon from the players inventory, and then add the new weapon.
items.qc is where this is handled and item names are defined in defs.qc.
it should be fairly simple to do.
Well
#2462 posted by Qmaster on 2018/03/30 18:48:53
It is a bit more involved than that.
For a custom warhammer/axe/whatever you will need the following... (using JazzAxe for example)
defs.qc::
•Add a line float IT_JAZZAXE = 128; (assuming ID1, otherwise use next available value)
weapons.qc::
•Add a W_FireJazzAxe function that is a duplicate of W_FireAxe with damage you want instead of 20 and any other special effects you might want
•Above W_Attack add a line "void player_jazzaxe1 ();" without quotes
•Inside W_Attack add an if statement that checks to see if (self.weapon == IT_JAZZAXE) that then goes to player_jazzaxe1 ();
player.qc::
•Copy and paste all 4 functions of player_axe1, player_axe2, player_axe3, player_axe4
•Add "jazz" (without quotes ofc) in front of axe1, axe2, axe3, and axe4 in the function names
•Change W_FireAxe inside player_jazzaxe3 function to be W_FireJazzAxe();
item.qc::
•Copy weapon_nailgun function (or any other weapon), paste, and rename to weapon_jazzaxe
•Change inside weapon_jazzaxe self.weapon to be IT_JAZZAXE, self.netname = "ijazz2's bane";
•Inside weapons_touch add an if (self.classname == "weapon_jazzaxe") new =IT_JAZZAXE;
I probably missed something.
QMaster
#2463 posted by ijazz3 on 2018/03/31 09:11:13
You forgot W_SetCurrentAmmo?
Anyway,thanks for helping.You probably should changed your username to QCMaster.
An Unnecessary WIP
#2464 posted by Ijazz3 on 2018/03/31 09:25:45
you shouldnt need to do any ammo checks with melee weapons, unless you're building a melee weapon that uses ammo, which would be pretty cool too.
Sorry For Multi-post
#2466 posted by ijazz3 on 2018/03/31 10:37:52
QMaster,I have a problem.
I'm using the AD Shadaxe model for jazzaxe.
FTEQCCGUI compiled without error,but when I try to select the weapon (after picking up) it just switches to the shotgun.The model appears for a split-second then the shotgun appears.I cant use it.
Then I tried (using an InsideQC tut) to make the weapon switchable by selecting axe twice.
Problem is still there.
Help?
Hrm...
#2467 posted by Qmaster on 2018/03/31 15:27:57
I've ran into that before...might be a conflict with whichever bitflag value you used for IT_JAZZAXE. Can you upload a zip of your qc files? I might be able to take a look at it.
QMaster
#2468 posted by ijazz3 on 2018/04/01 09:28:54
http://www.quaketastic.com/files/QC%20Mistakes/ijazz3_qc_jazzaxe_screwed.zip
This one has a few changes from standard id1,including the code which seems to be wrong for the Jazz Axe and some AD-inspired health model changes (.bsp to .mdl)
Weapons.qc
#2469 posted by Qmaster on 2018/04/01 14:32:46
W_BestWeapon
Add if at the bottom
if (self.items & IT_JAZZAXE) return IT_JAZZAXE; else return IT_AXE;
And just below that in W_CheckNoAmmo:
inside the if (self.weapon == IT_AXE add "|| self.weapon == IT_JAZZAXE")
W_CheckNoAmmo
#2470 posted by ijazz3 on 2018/04/03 17:39:41
Something is not right.
CheckNoAmmo does not have if (self.weapon == IT_AXE) part!
#2471 posted by metlslime on 2018/04/03 19:10:39
i'm out of axe ammo!
? From The Weapons.qc In The Zip You Sent Me...
#2472 posted by Qmaster on 2018/04/03 23:43:08
float() W_CheckNoAmmo =
{
if (self.currentammo > 0)
return TRUE;
if (self.weapon == IT_AXE)
return TRUE;
self.weapon = W_BestWeapon ();
W_SetCurrentAmmo ();
// drop the weapon down
return FALSE;
};
Thanks
#2473 posted by ijazz3 on 2018/04/05 08:57:05
Never mind,found it.FTEQCCGUI has no Atrl+F combo!!! why!!!!!
Wait,wut?
#2474 posted by ijazz3 on 2018/04/05 09:01:47
QMaster,the problem is still there.
I did some checking but I can't find anything wrong.
#2475 posted by R00k on 2018/04/06 02:50:10
in checknoammo shouldint you also add if(self.weapon == IT_JAZZAXE) return; ?
#2476 posted by R00k on 2018/04/06 02:51:10
otherwise it says you have no ammo jump to SG
#2477 posted by R00k on 2018/04/06 02:51:10
otherwise it says you have no ammo jump to SG
TRIPPLE POST FTW
#2478 posted by R00k on 2018/04/06 02:52:51
if ((self.weapon == IT_AXE) || (self.weapon == IT_JAZZAXE))
return TRUE;
.
#2479 posted by ijazz3 on 2018/04/06 13:56:12
@rook
Yes,I added that.It sill switches to SG after showing JAZZAXE for a split second.
#2480 posted by anonymous user on 2018/04/07 04:24:20
hmm what about ‘rankforweapon’ function?
im just thinking off the top of my head been awhile since i did the ol double tap
impuls to switch weapons; i had once made the lg
double as a flame thrower
you might need to add your axe there too
Suggestion
#2481 posted by Preach on 2018/04/07 09:13:59
Have you looked at client.qc?
There's a line
if(time > self.attack_finished && self.currentammo == 0 &&
self.weapon != IT_AXE)
{
self.weapon = W_BestWeapon ();
W_SetCurrentAmmo ();
}
I suspect you need to change that last test to also consider IT_JAZZAXE.
......
#2482 posted by ijazz3 on 2018/04/08 18:32:42
I am sorry.It does not work.Still switching after a second.
I am going to try and hunt down the warpspasm decompiled code I gave someone when I played Quake 2 years ago before going to Half-(my)-Life.
But please,try helping me.I might feature you in my mod.
Just Checking
#2483 posted by Preach on 2018/04/09 21:11:20
What did you change it to? Was it this:
if(time > self.attack_finished && self.currentammo == 0 &&
self.weapon != IT_AXE && self.weapon != IT_JAZZAXE )
Thank You Sir
#2484 posted by ijazz3 on 2018/04/11 19:28:51
You have saved me a complete rewrite.
Now,the world shall remember you as the savior of QuakeC.
Go Preach!
Lol, Preach Is Always The Qc Master
#2485 posted by Qmaster on 2018/04/12 16:24:06
|