Hey thanks TKBS.
Yep I realize that’s only the ‘attach function,’ ty.
I also began level designing. I think level designers, good level designers, are better game makers/designers because we understand the finer nuances of game play which are important to map construction; the look of maps, advantages, disadvantages, heights, flats, sounds, novelties and many points that win a map or kill it for players. ‘Win or Kill’ reflects on the entire game. Adding little novelties into maps, leads us as game designers to adding unique novelties into actual play. I think we LDs are good go-betweens, I mean that I’ve seen that for many coders, textures and arty stuff are beyond them. Then there’s artists who faint at coding. Level designers need to be able to transition, kismet for example - we’re in between an advantageous place to be. I should’ve guessed you as an LD, you didn’t attack me for my bumbling code, but instead you kinda, hmmmed, and looked it over, and giving me space.
Below code should make your bot detect your player when he’s in bot range. Then have your bot strike your player.
//KFZp is my player pawn.
function HitPlayer() // this is code for Bot Pawn
{
FullBodyAnimSlot.PlayCustomAnim('WackAttack', 1.0, 0.2, 0.2, false, TRUE);
KFZp.TakeDamage(10, KFZzyborgController(Controller), Location, vect(0,0,0), class'DamageWack');
}
Next get the bot running to your player to hit(wack) him:
Bot's controller:
What it does:
When the player gets into range the bot runs to the player, and touches him, (and faces player as well!) but atm triggering "Worldinfo.Game.Broadcast(self, "Attacking Player");" (a line in the code below).
What it doesn't do.
bot just follows the player, continually triggering "Worldinfo.Game.Broadcast(self, "Attacking Player")
That's as far as I've got with the code. But it's at the point where the bot can be made to strike (or in my case checkID). You get your bot to hit by your player by calling your bot pawn to HitPlayer(): The bot Pawn code is called from the Bot Controller in this way: var YourBotName YBN; then in the checkID or attack: YBN = YourBotName(Pawn); then, YBN.HitPlayer();
That's how it should go: The bot gets into player range, next into the players' face, and as such, calls bot pawn HitPlayer(). The bot strikes the player using your Axe strike animation.
state CheckingID // obviously call it what you want
{
Begin:
PPawn = KFZzPP(Pawn); //the bot's pawn
PPawn.Acceleration = vect(0,0,1);
CheckIDDistance = 10;
PerceptionDistance = 100;
PPawn.Disable('NotifyBump'); /// does swfa?
settimer(10.0, false, 'EnableBumps');///dit -probably sbe in Pawn?
while (PPawn != none && KFZp.Health > 0 && KFZp !=none)
{
if (ActorReachable(KFZp) && KFZp != none) // KFZp caveats are needed otherwise when players run fast out of bot range the game crashes. btw KFZp is referenced in the same way as YourBotName, YBN.
{
distanceToPlayer = VSize(KFZp.Location - PPawn.Location);
if (distanceToPlayer < CheckIDDistance && KFZp !=none)
{
GotoState('Attack');
break;
}
else
{
MoveToward(KFZp, KFZp, 0.0f);//, 20.0f(default). Is 0.0f DEST offset?)
if(PPawn.ReachedDestination(KFZp) && KFZp !=none)
{
//PPawn.PlaySoundID();
GotoState('Attack');
break;
}
}
}
else
{
MoveTarget = FindPathToward(KFZp,,perceptionDistance + (perceptionDistance/2));
if (MoveTarget != none && KFZp !=none)
{
Worldinfo.Game.Broadcast(self, "Moving towards Player");//HAVEN't seen this yet - (later: seen it once)
distanceToPlayer = VSize(MoveTarget.Location - Pawn.Location);
if (distanceToPlayer < 300)
MoveToward(MoveTarget, KFZp, 0.0f); //20
else
MoveToward(MoveTarget, MoveTarget, 0.0f); //20
}
else
{
Sleep(0.3);
Goto('Begin');
break;
}
}
}
}
state Attack
{
Begin:
Pawn.Acceleration = vect(0,0,0);
CheckIDDistance=10; //presuming UTUnits so that 10 = touching, aka bump -Previously I was using bump (in the bot's Pawn). Bump does work but I haven't found it much use in this process.
while(KFZp.Health > 0)
{
Worldinfo.Game.Broadcast(self, "Attacking Player");
distanceToPlayer = VSize(KFZp.Location - Pawn.Location);
if (distanceToPlayer > CheckIDDistance * 2)
{
Sleep(0.3);
GotoState('CheckingID');
break;
}}
The above should get your bot detecting, chasing and then attacking your player.
You said you also had a problem sound?
There’s two types: AudioComponents and soundCues. AudioComponents can be turned on and off (so an 'C can loop). A soundCue can loop too but it can’t be turned off(unless the player or bot or whatever dies). The soundCue loop is only setup in the browser, and loop is all it can do. ACs are made to be triggered on / off, off/on, indefinitely, soundCue aren’t.
I can tell you how to write code for an AC if you want, just ask if that’s you meant in an above post.
Thanks for the pathnode hints. I don’t quite understand what you mean. I’m hoping you mean I can get my bot to follow the _PathNode_SKELETON? (and also specific nodes for individual monsters). I’m trying to get my bots to patrol, but no luck using my custom pathnodes. I hope your pathnode approach may be able to do that for me.
But that later, for now you should code your bots to attack you with axes