Game Mode Settings

Post Reply
Andorf
Posts: 7
Joined: Mon Apr 20, 2020 11:34 am

Game Mode Settings

Post by Andorf » Mon Apr 20, 2020 8:38 pm

This is the continuation of a post under "Need Help", moved here for clarity.

I am making a new game logic based on deathmatch, for now I want it to be the same as deathmatch but with only one weapon available.
To do this, I created my new Kit_GMB_MyMode (a duplicate of the Deathmatch one with minor adjustments to avoid duplicating classes).

Since I would like to set the player's gun to slot 2 only as soon as he is spawned, I implemented some code in the ovveridden method OnLocalPlayerSpawned() in my Kit_GMB_MyMode.
Now I can set the player's gun to my preferred choice as he spawns (I'll have to do the same for bots later). However, all other weapons still remain in his inventory and he can still switch to them.

Where exactly (codewise) is the each weapon instantiated onto the player prefab? That does not seem to be in the Kit_GMB_MyMode script.

Cheers

Andorf
Posts: 7
Joined: Mon Apr 20, 2020 11:34 am

Re: Game Mode Settings

Post by Andorf » Mon Apr 20, 2020 8:43 pm

Ok I think you actually do this under the overridden method DoCustomSpawn() in the Kit_GMD_GunGame. It seems like you setup the player's loadout in there, which is actually what I am looking for.

User avatar
themars2011
Site Admin
Posts: 65
Joined: Mon Dec 02, 2019 8:59 pm
Location: Germany
Contact:
themars2011’s avatar
Loading…

Re: Game Mode Settings

Post by themars2011 » Mon Apr 20, 2020 9:11 pm

Andorf wrote:
Mon Apr 20, 2020 8:43 pm
Ok I think you actually do this under the overridden method DoCustomSpawn() in the Kit_GMD_GunGame. It seems like you setup the player's loadout in there, which is actually what I am looking for.
Yes there you can give the player a custom loadout. Theres also a function for it named

Code: Select all

 public override bool UsesCustomSpawn()
that has to return true in order for this to work!
Asset links posted by me may be affiliate links using the Unity Affiliate Program and yield a small amount of share at no additional cost for the buyer should a purchase be made.

Andorf
Posts: 7
Joined: Mon Apr 20, 2020 11:34 am

Re: Game Mode Settings

Post by Andorf » Tue Apr 21, 2020 9:01 am

Great, thanks man

Post Reply