Altfire to change weapon
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Altfire to change weapon
How do I make this pistol's altfire change it into a different custom weapon?
- Attachments
-
- pistol.txt
- (1.89 KiB) Downloaded 19 times
Re: Altfire to change weapon
Use A_SelectWeapon for that:
Code: Select all
Altfire:
TNT1 A 0 A_SelectWeapon("Pistol2")
Goto Ready //Required to go to the ready state (or call A_WeaponReady) to switch weapons Re: Altfire to change weapon
Would tapping altfire again switch it back?
Re: Altfire to change weapon
Not unless you defined it to do so in the other weapon.
Re: Altfire to change weapon
How would I do that?
Re: Altfire to change weapon
No, wait. I just got what you meant
Re: Altfire to change weapon
How would I make it switch to the weapon I want without owning it?
The weapon I want the pistol to change to is a lighter, for clarification
The weapon I want the pistol to change to is a lighter, for clarification
Re: Altfire to change weapon
The player has to own the item.
Give it to them in the Altfire using A_GiveInventory.
Beware as that might give the player ammo, otherwise make them start with both weapons.
Give it to them in the Altfire using A_GiveInventory.
Beware as that might give the player ammo, otherwise make them start with both weapons.
Re: Altfire to change weapon
Well, how could I stop the lighter from being switched to by normal means and stop other weapons from being switched to by normal means when I have the lighter in-hand?
Re: Altfire to change weapon
If you don't assign a slot to the lighter, the player shouldn't be able to switch to it manually.
As for making the lighter unswitchable, you can try this:
Untested.
As for making the lighter unswitchable, you can try this:
Code: Select all
Ready:
LIGH A 1 A_WeaponReady(WRF_NOSWITCH) //Make the lighter unswitchable
Loop
Altfire:
TNT1 A 0 A_SelectWeapon("Pistol") //Queue the pistol to switch to
Goto Ready2 //Go to the special Ready state
Ready2:
LIGH A 1 A_WeaponReady //Allow switching again
LoopRe: Altfire to change weapon
Yeah, it doesn't seem to work
Re: Altfire to change weapon
What exactly doesn't seem to work?
I tried it now and it seems to work fine for me.
Can you show your code?
Does the player have both weapons?
Is the correct weapon selected?
Replacing starting the pistol isn't as simple as "Weapon replaces Pistol", the entire player class has to be replaced to give different starting items.
For example:
Then you have to add a MAPINFO file and add this to it:
I tried it now and it seems to work fine for me.
Can you show your code?
Does the player have both weapons?
Is the correct weapon selected?
Replacing starting the pistol isn't as simple as "Weapon replaces Pistol", the entire player class has to be replaced to give different starting items.
For example:
Code: Select all
ACTOR DoomPlayer2 : DoomPlayer
{
Player.StartItem "ModdedPistol" //Replace with your pistol
Player.StartItem "Lighter" //Replace with your lighter
Player.StartItem "Fist"
Player.StartItem "Clip", 50
} Code: Select all
GameInfo
{
PlayerClasses = "DoomPlayer2"
} Re: Altfire to change weapon
http://www.mediafire.com/file/7ww74fcd4 ... n.pk3/file
This is the whole pk3. I have made a new player class for it all
This is the whole pk3. I have made a new player class for it all
Re: Altfire to change weapon
The sprites in the Ready state of the lighter don't exist, so the lighter isn't even given to the player.
The Ready state uses LIGH sprites (which is what I wrote in the example, but I hoped you'd change them to the correct ones), while the rest of the lighter uses ZIPO sprites.
The altfire of the lighter also selects the vanilla Doom pistol weapon (again, as I wrote) instead of selecting your modded NewPistol weapon.
The lighter also has a SlotNumber defined, so it can be selected manually.
And the first StartItem of the player is the lighter, so they will start with the lighter selected by default.
The Ready state uses LIGH sprites (which is what I wrote in the example, but I hoped you'd change them to the correct ones), while the rest of the lighter uses ZIPO sprites.
The altfire of the lighter also selects the vanilla Doom pistol weapon (again, as I wrote) instead of selecting your modded NewPistol weapon.
The lighter also has a SlotNumber defined, so it can be selected manually.
And the first StartItem of the player is the lighter, so they will start with the lighter selected by default.
Re: Altfire to change weapon
So I fixed everything, but now kicking with the lighter stops me from being able to switch
Updated file: http://www.mediafire.com/file/v4pd1c5e5 ... n.pk3/file
Updated file: http://www.mediafire.com/file/v4pd1c5e5 ... n.pk3/file
