I am curious if there is a way to disable players from firing weapons, but also knowing if they tried to fire a weapon?
Not sure if this would be a Mutator, inventory item, etc?
I don't want the user's selected weapon to disappear however, if possible.
Ideas?
Possible to enable / disable weapon firing but know if player tries firing?
-
- Skilled
- Posts: 198
- Joined: Thu Apr 16, 2020 3:23 pm
- Personal rank: GameDev
- EvilGrins
- Godlike
- Posts: 9803
- Joined: Thu Jun 30, 2011 8:12 pm
- Personal rank: God of Fudge
- Location: Palo Alto, CA
- Contact:
Re: Possible to enable / disable weapon firing but know if player tries firing?
Sounds like a mutator thing, though it would have to be something that replaced all weapons with no firing weapons.
There's a good mutator out there for a frying pan.
There's a good mutator out there for a frying pan.
http://unreal-games.livejournal.com/
Smilies · viewtopic.php?f=8&t=13758medor wrote:Replace Skaarj with EvilGrins
Re: Possible to enable / disable weapon firing but know if player tries firing?
I'm at work atm so I can't look into it but check out the udamage code. Iirc, weapon notifies inventory when someone fires which is how udamage plays the extra firing sound, but I can't remember if inventory has the ability to teturn abort firing to weapon.
I'll look into it properly after work.
I'll look into it properly after work.
Signature goes here.
-
- Skilled
- Posts: 198
- Joined: Thu Apr 16, 2020 3:23 pm
- Personal rank: GameDev
Re: Possible to enable / disable weapon firing but know if player tries firing?
Thanks, I much appreciate you taking the timeExpEM wrote: ↑Wed Apr 21, 2021 10:59 pm I'm at work atm so I can't look into it but check out the udamage code. Iirc, weapon notifies inventory when someone fires which is how udamage plays the extra firing sound, but I can't remember if inventory has the ability to teturn abort firing to weapon.
I'll look into it properly after work.
Re: Possible to enable / disable weapon firing but know if player tries firing?
See Wiki: How UT Weapons Work for a first approach.
UT weapons (not Unreal) call function FireEffect() on fire. That function is defined in class TournamentPickup so that inventory items like UDamage can use it.
In general I know only the polling method via timer() or tick() and checking Pawn.bFire and/or Pawn.bAltFire there to detect firing.
UT weapons (not Unreal) call function FireEffect() on fire. That function is defined in class TournamentPickup so that inventory items like UDamage can use it.
In general I know only the polling method via timer() or tick() and checking Pawn.bFire and/or Pawn.bAltFire there to detect firing.
"If Origin not in center it be not in center." --Buggie
Re: Possible to enable / disable weapon firing but know if player tries firing?
Barbie is correct here, unfortunately there dosen't seem to be anything we can hook into short of either forcing a custom PlayerPawn and/or custom weapons. Which is entirely doable but very likely not worth the effort for whatever it is your trying to do.Barbie wrote: ↑Thu Apr 22, 2021 1:20 am See Wiki: How UT Weapons Work for a first approach.
UT weapons (not Unreal) call function FireEffect() on fire. That function is defined in class TournamentPickup so that inventory items like UDamage can use it.
In general I know only the polling method via timer() or tick() and checking Pawn.bFire and/or Pawn.bAltFire there to detect firing.
I would choose the weapon route, subclass TournamentWeapon with your added hook, then subclass that with each weapon, you should be able to use more or less unmodified code for the weapons as long as you change the class names with a prefix.
The downside being that it wouldn't be compatible with other weapon mutators.
I'm not sure about the feasibly of custom PlayerPawns without using a custom gametype to force them (upak and jailbreak both use that method).
Using ModifyLogin In a mutator could do it.
Either way, like the weapon method you would have to make subclass's of your modified PlayerPawn of each player class.
Signature goes here.
-
- Skilled
- Posts: 198
- Joined: Thu Apr 16, 2020 3:23 pm
- Personal rank: GameDev
Re: Possible to enable / disable weapon firing but know if player tries firing?
Hmm.... why do I need to subclass EVERY weapon?ExpEM wrote: ↑Thu Apr 22, 2021 3:38 amBarbie is correct here, unfortunately there dosen't seem to be anything we can hook into short of either forcing a custom PlayerPawn and/or custom weapons. Which is entirely doable but very likely not worth the effort for whatever it is your trying to do.Barbie wrote: ↑Thu Apr 22, 2021 1:20 am See Wiki: How UT Weapons Work for a first approach.
UT weapons (not Unreal) call function FireEffect() on fire. That function is defined in class TournamentPickup so that inventory items like UDamage can use it.
In general I know only the polling method via timer() or tick() and checking Pawn.bFire and/or Pawn.bAltFire there to detect firing.
I would choose the weapon route, subclass TournamentWeapon with your added hook, then subclass that with each weapon, you should be able to use more or less unmodified code for the weapons as long as you change the class names with a prefix.
The downside being that it wouldn't be compatible with other weapon mutators.
I'm not sure about the feasibly of custom PlayerPawns without using a custom gametype to force them (upak and jailbreak both use that method).
Using ModifyLogin In a mutator could do it.
Either way, like the weapon method you would have to make subclass's of your modified PlayerPawn of each player class.
I'm thinking i could create a TournamentWeapon class, and then store an instance of a selected weapon, and just pass through function calls to the weapon instance stored, and then set my "custom wepaon" as the pawn's selected weapon.
EG: a TournamentWeapon that's merely a "shim" to ANY other TournamentWeapon subclass, but can interrrupt / modify the weapon parameters and fire method calls...
Then if I want this to be "seamless" i set the current properties to that of the instance weapon, including model, state, etc and just pass along function calls appropriately when my "shim" isn't doing anything at that moment.
Only issue is that it'd fail checks for "Selectedweapon.class == 'Enforcer'" or etc, as my weapon won't be, and I can't shim or mock that check.
Ideas?
I also looked at UDamage, and it relies on TournamentWeapon.affector being supported, and it "shims" itself there. Interesting idea nonetheless.
Re: Possible to enable / disable weapon firing but know if player tries firing?
Sorry it took so long to get back here, no home internet atm.
A shim weapon could work but it would make as many problems as it solves, special case weapons could be tricky, the eightball lock on ability and double enforcers for example would both need special treatment.
Emulating animations would be a right PITA too.
Don't let me put you off the idea though, if you can pull off a universal shim weapon then you would be opening up a whole new world of weapon modability to the community.
A shim weapon could work but it would make as many problems as it solves, special case weapons could be tricky, the eightball lock on ability and double enforcers for example would both need special treatment.
Emulating animations would be a right PITA too.
Don't let me put you off the idea though, if you can pull off a universal shim weapon then you would be opening up a whole new world of weapon modability to the community.
Signature goes here.
-
- Skilled
- Posts: 198
- Joined: Thu Apr 16, 2020 3:23 pm
- Personal rank: GameDev
Re: Possible to enable / disable weapon firing but know if player tries firing?
Honestly, I gave up on the shim idea.
I realized that weapons can have custom state for base TournamentWeapon class properties and it's too tough to keep them in sync (as I can't just use something like a c# accessor to fetch from the shimmed weapon instance).
I chose to instead make my own weapon, with no mesh / sounds, and store the previous selected weapon, and just put down / bring up my weapon via script.
Then just made it impossible to switch, drop, replace, etc my weapon when it's selected by a pawn.
There are logged warnings of no mesh, sounds or animation when bringing up / putting down by the pawn class. Had to copy this code into a helper class to emulate the base game process when selecting a new weapon to ensure any weapon callbacks are handled properly though (eg: from Pawn.SelectBestWeapon).
I realized that weapons can have custom state for base TournamentWeapon class properties and it's too tough to keep them in sync (as I can't just use something like a c# accessor to fetch from the shimmed weapon instance).
I chose to instead make my own weapon, with no mesh / sounds, and store the previous selected weapon, and just put down / bring up my weapon via script.
Then just made it impossible to switch, drop, replace, etc my weapon when it's selected by a pawn.
There are logged warnings of no mesh, sounds or animation when bringing up / putting down by the pawn class. Had to copy this code into a helper class to emulate the base game process when selecting a new weapon to ensure any weapon callbacks are handled properly though (eg: from Pawn.SelectBestWeapon).
- PrinceOfFunky
- Godlike
- Posts: 1202
- Joined: Mon Aug 31, 2015 10:31 pm
Re: Possible to enable / disable weapon firing but know if player tries firing?
There are two standard ways of doing this of which I'll tell just one and a custom one:
Standard: In Mutator.CheckReplacement if the actor is a projectile check the instigator and if that player shouldn't be enabled to fire then destroy the projectile.
Custom: I made AdvancedMutator, it can check if someone is trying to fire. (There's no tutorial on how to use it, there are just example mutators that use it)
Standard: In Mutator.CheckReplacement if the actor is a projectile check the instigator and if that player shouldn't be enabled to fire then destroy the projectile.
Custom: I made AdvancedMutator, it can check if someone is trying to fire. (There's no tutorial on how to use it, there are just example mutators that use it)
Some of the stuff I created:
Mods: VisualStreamPlayer, TeamColorOverlay, FunkyMoves, CommandSystem, FunkyPointer, AdvancedMutator, CommandEvent, ParticleSystem, LifeSucks
Gametypes: UTRoyale, UnrealRace
Hacks : Create/Write files with UScript, Read files with UScript, Running files with UScript
Maps: CTF-(POF)-Escher_Fix, CTF-(NotYet)HyperBlast, DM-(NotYet)Condemned, CTF-StalwartXS, UR-Hyperblast, DM-3072-ItalyKinda, DOM-NRMC-Cathode, CTF-TAMC-UnderPressure
Concepts: RabbitHole, Builder gun, HeatMap, Playable arcade cabinet, Stalwartception, Non Conventional Weapons, MainFrame
Memes: Meme#1, Meme#2
Mods: VisualStreamPlayer, TeamColorOverlay, FunkyMoves, CommandSystem, FunkyPointer, AdvancedMutator, CommandEvent, ParticleSystem, LifeSucks
Gametypes: UTRoyale, UnrealRace
Hacks : Create/Write files with UScript, Read files with UScript, Running files with UScript
Maps: CTF-(POF)-Escher_Fix, CTF-(NotYet)HyperBlast, DM-(NotYet)Condemned, CTF-StalwartXS, UR-Hyperblast, DM-3072-ItalyKinda, DOM-NRMC-Cathode, CTF-TAMC-UnderPressure
Concepts: RabbitHole, Builder gun, HeatMap, Playable arcade cabinet, Stalwartception, Non Conventional Weapons, MainFrame
Memes: Meme#1, Meme#2