Well I am in the midst of creating a project for a UT engine based game, and I realized I was getting stuck on the same issue.
Unreal's "Monsters" all use "Ranged Attacks", therefore never holding a weapon. I need to force my new Bot (a subclass of bot) to have a default weapon that I select via some code. So I tried this:
BTW, "Whomper" is a built in weapon that came with the game, so there is no problems with the weapon itself.
He recieves the weapon, but is unable to fire it! When I kill him, I can pick it up and it does in fact have 999 ammo like I coded it. Is there an easier way to do this? Or am I just doing something completely wrong?
Unreal's "Monsters" all use "Ranged Attacks", therefore never holding a weapon. I need to force my new Bot (a subclass of bot) to have a default weapon that I select via some code. So I tried this:
BTW, "Whomper" is a built in weapon that came with the game, so there is no problems with the weapon itself.
Code:
function PostBeginPlay()
{
EquipPlayer(self);
}
function EquipPlayer( pawn Player )
{
local Whomper s;
if ( Player.FindInventoryType(class'Whomper') == None )
{
//spawn a depositor weapon and attach it to bots inventory
s = Spawn(class'Whomper',,, Location);
if (s != None)
{
s.bHeldItem = true;
s.GiveTo( Player );
s.pickupammocount = 999;
}
}
}
He recieves the weapon, but is unable to fire it! When I kill him, I can pick it up and it does in fact have 999 ammo like I coded it. Is there an easier way to do this? Or am I just doing something completely wrong?
Last edited: