How to discover the player type
-
I ran into a situation where i needed to setup a units weapon differently for AI than a Human player. Simply put, the AI isnt capable of changing a weapons modes so I'm presetting a mode that will be of the most use to it.
Example:
OnCreate = function(self,builder,layer) AWalkingLandUnit.OnCreate(self) -- Creating Globals self.Artillery = self:GetWeaponByLabel('Artillery') self.Cannon = self:GetWeaponByLabel('Cannon') self.WpnMode = nil -- Set the weapon based on the player type if self.Brain.BrainType == 'Human' then if myDebug then WARN(' Human player, Cannon enabled') end self.Cannon:SetEnabled(true) self.Artillery:SetEnabled(false) self.WpnMode = 'Cannon' else if myDebug then WARN(' AI player, Artillery enabled') end self.MyCannon:SetEnabled(false) self.Artillery:SetEnabled(true) self.WpnMode = 'Artillery' end end,
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login