#  ![](https://www.realm667.com/media/kunena/topic_icons/realm667/user/map.png) Making items spawn based on character class

##

- **Ultimate Freedoomer**
- ![Ultimate Freedoomer's Avatar](https://www.realm667.com/media/kunena/core/svg/person.svg) Topic Author
- Wraith
- ![Wraith](https://www.realm667.com/media/kunena/ranks/rank_41_wraith.png)

 Less More- Posts: 18
-
-
-
-

   9 years 10 months ago [\#4758](#4758) by Ultimate Freedoomer  Replied by *Ultimate Freedoomer* on topic *[Making items spawn based on character class](https://www.realm667.com/forum/the-workshop/781-making-items-spawn-based-on-character-class?start=10#4758 "Hi. I am working on a Brutal Doom v20b meta-mod (I'll post the attachment to the thread when I get the chance. It's currently almost 10:00 in my time zone). Everything is done except for 1 thing: the...")*

> MagicWazard wrote: I think I see the problem: the scripts all have a special script type of "Enter", meaning they run as soon as the map starts, and not just when called. They should have the closed type of "(void)", instead, like so:
>
> script "PistolSpawn" (void)
>
> Try changing all the "Enter" to "(void)" and see if that resolves it.

It worked. Now all that's left to do is make it work in multiplayer (the main issue I see here being that you'll have to create an base-actor that AUTOMATICALLY CONVERTS into the appropriate item depending on the player class picking it up, rather than just spawning the appropriate item as in singleplayer).

Please [Log in](https://www.realm667.com/component/users/login?return=aHR0cHM6Ly93d3cucmVhbG02NjcuY29tL2ZvcnVtL3RoZS13b3Jrc2hvcC83ODEtbWFraW5nLWl0ZW1zLXNwYXduLWJhc2VkLW9uLWNoYXJhY3Rlci1jbGFzcz9zdGFydD0xMA==&Itemid=2662) or [Create an account](https://www.realm667.com/component/users/registration?Itemid=2662) to join the conversation.

- **MagicWazard**
- ![MagicWazard's Avatar](https://www.realm667.com/media/kunena/avatars/resized/size144/users/avatar517.png)
- Moderator
- ![Moderator](https://www.realm667.com/media/kunena/ranks/rank_20_barrel.png)

 Less More- Posts: 808
-
-
-
-

   9 years 10 months ago [\#4760](#4760) by MagicWazard  Replied by *MagicWazard* on topic *[Making items spawn based on character class](https://www.realm667.com/forum/the-workshop/781-making-items-spawn-based-on-character-class?start=10#4760 "Hi. I am working on a Brutal Doom v20b meta-mod (I'll post the attachment to the thread when I get the chance. It's currently almost 10:00 in my time zone). Everything is done except for 1 thing: the...")*

> Ultimate Freedoomer wrote: It worked. Now all that's left to do is make it work in multiplayer (the main issue I see here being that you'll have to create an base-actor that AUTOMATICALLY CONVERTS into the appropriate item depending on the player class picking it up, rather than just spawning the appropriate item as in singleplayer).

Pretty much, yes. There is also an [ ACS function](http://zdoom.org/wiki/GameType) that checks whether you're playing single-player or multiplayer, or what type of multiplayer. So you can have your spawn function check to see which game mode is being played before it spawns an item. If single-player, then it spawns the appropriate weapon for the player's class. If multiplayer, it spawns an item which runs a script on pickup to see which player class is picking it up (probably using [ CheckActorClass](http://zdoom.org/wiki/CheckActorClass)) and gives that class the appropriate item (probably using [ GiveInventory](http://zdoom.org/wiki/GiveInventory)). Now, I've never done this before, so I don't have an exact example, but that should be something to work off of.

Please [Log in](https://www.realm667.com/component/users/login?return=aHR0cHM6Ly93d3cucmVhbG02NjcuY29tL2ZvcnVtL3RoZS13b3Jrc2hvcC83ODEtbWFraW5nLWl0ZW1zLXNwYXduLWJhc2VkLW9uLWNoYXJhY3Rlci1jbGFzcz9zdGFydD0xMA==&Itemid=2662) or [Create an account](https://www.realm667.com/component/users/registration?Itemid=2662) to join the conversation.

[Powered by](https://www.realm667.com/forum/credits) [Kunena Forum](https://www.kunena.org)
