[DECORATE] Weapon.PreferredSkin with same weapon but different classes?

Discuss all aspects related to modding Zandronum here.
Post Reply
User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

[DECORATE] Weapon.PreferredSkin with same weapon but different classes?

#1

Post by FranckyFox2468 » Thu Sep 15, 2016 4:28 pm

It's a quite simple question, is it possible to use Weapon.PreferredSkin with the same weapon but on different player classes?

Like, two characters have an entirely different appearence but they are both able to pickup the same type of weapon.

User avatar
Ænima
Addicted to Zandronum
Posts: 3523
Joined: Tue Jun 05, 2012 6:12 pm

[DECORATE] Re: Weapon.PreferredSkin with same weapon but different classes?

#2

Post by Ænima » Thu Sep 15, 2016 4:40 pm

I think you're gonna need two copies of each weapon.

No biggie, just use inheritance.
­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­
Doom64: Unabsolved: New weapons, monsters, and gameplay features for coop !


ZandroSkins
: a pack made by our community

User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

[DECORATE] Re: Weapon.PreferredSkin with same weapon but different classes?

#3

Post by FranckyFox2468 » Thu Sep 15, 2016 4:43 pm

Ænima wrote:I think you're gonna need two copies of each weapon.

No biggie, just use inheritance.
Uh, that's gon be a bit complicated when it comes to picking up a weapon an enemy player dropped while playing a different classes....

^^Because that is mainly my problem. Otherwise i'd just do variant for each characters.

User avatar
Ænima
Addicted to Zandronum
Posts: 3523
Joined: Tue Jun 05, 2012 6:12 pm

[DECORATE] Re: Weapon.PreferredSkin with same weapon but different classes?

#4

Post by Ænima » Thu Sep 15, 2016 4:57 pm

FranckyFox2468 wrote:
Ænima wrote:I think you're gonna need two copies of each weapon.

No biggie, just use inheritance.
Uh, that's gon be a bit complicated when it comes to picking up a weapon an enemy player dropped while playing a different classes....

^^Because that is mainly my problem. Otherwise i'd just do variant for each characters.
CustomInventory with jumps in the pickup state based on "checker" items given to different classes. Make the weapon itself spawn this item in its Spawn state before instantly disappearing. This item should look like the weapon and have the same pickup message, except when it gets picked up it will give a different version of the weapon based on what class "token" item you have. It's a bit of a workaround but it's really the only way to do what you want unless you wanna put tons of jumps in every state of your playerclass to go to different frames for different weapons (like I did in Super Skulltag), but that will require "checker" items for every single weapon, and is generally very messy.

I'd write an example code but I'm on my phone right now.
­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­
Doom64: Unabsolved: New weapons, monsters, and gameplay features for coop !


ZandroSkins
: a pack made by our community

User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

[DECORATE] Re: Weapon.PreferredSkin with same weapon but different classes?

#5

Post by FranckyFox2468 » Thu Sep 15, 2016 5:40 pm

Think i already tried the item drop during the "spawn" state and it didn't work quite well. But i might have been doing it wrong. Gon' wait and see what is your code about. Thanks a lot in advance :D

User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

[DECORATE] Re: Weapon.PreferredSkin with same weapon but different classes?

#6

Post by FranckyFox2468 » Fri Sep 16, 2016 4:53 pm

Uh, you weren't you going to write a code or something? If not its fine but i was just curious to see what you came up with.

User avatar
Ænima
Addicted to Zandronum
Posts: 3523
Joined: Tue Jun 05, 2012 6:12 pm

[DECORATE] Re: Weapon.PreferredSkin with same weapon but different classes?

#7

Post by Ænima » Fri Sep 16, 2016 11:41 pm

FranckyFox2468 wrote:Uh, you weren't you going to write a code or something? If not its fine but i was just curious to see what you came up with.
I'm sorry. I've just been very busy lately outside of Doom.

Anyways, here's what my code would look like:

Code: Select all

actor ak47giver : custominventory
{
  Inventory.PickupMessage "You got the AK47!"
  Inventory.PickupSound "pickup/AK"
  states
  {
  Spawn:
    AKGN A -1
    Stop
  Pickup:
    TNT1 A 0
    TNT1 A 0 A_JumpIfInventory("CopAK47",1,"AmmoCheck")
    TNT1 A 0 A_JumpIfInventory("RobberAK47",1,"AmmoCheck") //just gives ammo if you already have the gun
    Goto ClassCheck

  ClassCheck:
    TNT1 A 1 A_JumpIfInventory("IsCop",1,"GetCopAK") 
    TNT1 A 1 A_JumpIfInventory("IsRobber",1,"GetRobberAK") //check for the "token" items that classes start with to identify themselves
    Goto PickupFail
  GetCopAK:
    TNT1 A 0 A_GiveInventory("CopAK47",1)
    stop
  GetRobberAK:
    TNT1 A 0 A_GiveInventory("RobberAK47",1)
    stop
    
  AmmoCheck: // like a "real" weapon pickup, you won't pick it up if you already have it and your ammo is full
    TNT1 A 0 A_JumpIfInventory("BackPack",1,"AmmoCheckBackpack")
    TNT1 A 0 A_JumpIfInventory("7.62Round",100,"PickupFail")
    Goto AmmoPickupSucceed
  AmmoCheckBackpack: // otherwise, backpacked players would still be limited to the non-backpack amount
    TNT1 A 0 A_JumpIfInventory("7.62Round",200,"PickupFail")
    Goto AmmoPickupSucceed
  AmmoPickupSucceed:
    TNT1 A 0 A_GiveInventory("7.62Round",16)
    Stop
  PickupFail:
    TNT1 A 1 BRIGHT
    fail
  }
}
And the cool part about having a different version of the weapon for each class is that, if you wanted to, you could make different colored gloves or a different weapon skin based on that class.
­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­
Doom64: Unabsolved: New weapons, monsters, and gameplay features for coop !


ZandroSkins
: a pack made by our community

User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

[DECORATE] Re: Weapon.PreferredSkin with same weapon but different classes?

#8

Post by FranckyFox2468 » Sat Sep 17, 2016 6:12 pm

Aww man, thanks a lot! Ima be sure to give you a special thanks in the credits of any mod i use this :D

By the way, one last question. How do i handle the weapon itself's spawn state. Do i just use a a_spawnitem or a_spawnitemex or is there something else specific i should know?

User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

[DECORATE] Re: Weapon.PreferredSkin with same weapon but different classes?

#9

Post by FranckyFox2468 » Sat Feb 25, 2017 5:51 pm

sorry to necro but i actually got around this part of the weapon and im not sure how to make the weapon "spawn" state spawn the weapon giver properly.

I tried to make something using "spawnitem ex" but it drops at the player's spawn location rather than the player' current location.

Post Reply