Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
DrBDude

How do i give classes specific weapons

Question

Hello, I am new to this site and somewhat new to doom wad editing

 

I am creating a wad with 2 specific player classes and i want each of them to have specific weapons (one uses reskined default weapons and the other one uses new ones)
i want it to be so if you play as a specific character you only get that characters weapons for that slot
(example: shotgun zombieman drops shotgun class 1 gets one item if picked up class 2 gets its own item if picked up)
any help would appreciated!

Thanks

Share this post


Link to post

7 answers to this question

Recommended Posts

  • 1

You can add this to your DECORATE definition:

Inventory.ForbiddenTo Class1

This will prevent the players of class Class1 from picking up the item. You can add a comma to add more classes like this:

Inventory.ForbiddenTo Class1, Class2

Now players of classes Class1 and Class2 will be unable to pick up the item.

You can do this with any item, though it is most often used for weapons, for obvious reasons.

Share this post


Link to post
  • 1
11 minutes ago, Aquila Chrysaetos said:

You can add this to your DECORATE definition:


Inventory.ForbiddenTo Class1

This will prevent the players of class Class1 from picking up the item. You can add a comma to add more classes like this:


Inventory.ForbiddenTo Class1, Class2

Now players of classes Class1 and Class2 will be unable to pick up the item.

You can do this with any item, though it is most often used for weapons, for obvious reasons.

 

From what I gather, OP wants different drops depending on the class; adding Inventory.ForbiddenTo would only prevent pickups for certain weapons, not spawn different ones. A solution would be to use ACS and Decorate.

 

Decorate part:

RandomShotgunner: Shotgunguy replaces Shotgunguy
{
	States:
	{
		Death:
		"####" 0 ACS_NamedExecuteAlways("ItemSpawner",0)
	}
}

 

ACS part:

#include "zcommon.acs"
script "ItemSpawner" (void)
{
      switch(PlayerClass(PlayerNumber()))
      {
            case CLASS_0
                 DropItem(0,"Shotgun1",1,256);
                 break;
            case CLASS_1:
                  DropItem(0,"Shotgun2",1,256);
                 break;
	 }
}

I'm not too good with ACS, but that should do the trick.

Share this post


Link to post
  • 1

You would have to first create a dummy item that spawns in place of the weapon, then when a player picks up said dummy item make it execute a script that checks for classes. Also, if you're going for multiplayer I'm not sure named scripts are possible so you'll have to go with numbers.

 

actor ExampleItem : CustomInventory replaces Shotgun
{
  Inventory.PickupMessage "Add whathever here"
  Inventory.PickupSound "misc/p_pkup"
  +COUNTITEM
  states
  {
  Spawn:
    EXAM A -1
    stop
  Pickup:
    TNT1 A 0 A_ACSExecuteAlways(900,0)
    stop
  }
}
#include "zcommon.acs"
script 900 (void)
{
      switch(PlayerClass(PlayerNumber()))
      {
            case CLASS_0
                 GiveInventory("Shotgun1");
                 break;
            case CLASS_1:
                  GiveInventory("Shotgun2",1);
                 break;
	 }

Again, I'm not the best with ACS, so you might have to do some modifications.

Edited by A.Gamma : Mistake in code

Share this post


Link to post
  • 0

thanks for the answer but i was wondering for example the shotgun zombieman drops the slot 4 weapon (shotgun) and depending on what class picks it will be the slot 4 weapon for that specific class

(i'm trying to have 2 versions of the same weapon but with different sprites for each class)

Edited by DrBDude

Share this post


Link to post
  • 0

 

46 minutes ago, A.Gamma said:

 

From what I gather, OP wants different drops depending on the class; adding Inventory.ForbiddenTo would only prevent pickups for certain weapons, not spawn different ones. A solution would be to use ACS and Decorate.

 

Decorate part:


RandomShotgunner: Shotgunguy replaces Shotgunguy
{
	States:
	{
		Death:
		"####" 0 ACS_NamedExecuteAlways("ItemSpawner",0)
	}
}

 

ACS part:


#include "zcommon.acs"
script "ItemSpawner" (void)
{
      switch(PlayerClass(PlayerNumber()))
      {
            case CLASS_0
                 DropItem(0,"Shotgun1",1,256);
                 break;
            case CLASS_1:
                  DropItem(0,"Shotgun2",1,256);
                 break;
	 }
}

I'm not too good with ACS, but that should do the trick.

Thanks this is almost what i'm looking for but what if i want it to drop a weapon but you get that specific weapon based on picking it up for so like in multiplayer and stuff it would work

Share this post


Link to post
  • 0
57 minutes ago, A.Gamma said:

You would have to first create a dummy item that spawns in place of the weapon, then when a player picks up said dummy item make it execute a script that checks for classes. Also, if you're going for multiplayer I'm not sure named scripts are possible so you'll have to go with numbers.

 


actor ExampleItem : CustomInventory XXXXX
{
  Inventory.PickupMessage "Add whathever here"
  Inventory.PickupSound "misc/p_pkup"
  +COUNTITEM
  states
  {
  Spawn:
    EXAM A -1
    stop
  Pickup:
    TNT1 A 0 A_ACSExecuteAlways(900,0)
    stop
  }
}

#include "zcommon.acs"
script 900 (void)
{
      switch(PlayerClass(PlayerNumber()))
      {
            case CLASS_0
                 GiveInventory("Shotgun1");
                 break;
            case CLASS_1:
                  GiveInventory("Shotgun2",1);
                 break;
	 }

Again, I'm not the best with ACS, so you might have to do some modifications.

i'm new to this and i'm not sure how to do the "case CLASS_0"
my class name is PersonA
should i put it like case CLASS_PERSONA
?

Share this post


Link to post
  • 0

AFAIK class numbers are given by the order that you define them, so if you defined PersonA first and then say, PersonB; PersonA will be CLASS_0, PersonB Class_1 and so forth.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×