Author Topic: [Solved] Getting Zombie distracted by a Pipe Bomb weapon  (Read 794 times)

Keep in mind that if you use a function like that instead of a saved group it will probably lag. It will search through every bot and every player within 5000 tu and run that check. It's unnecessary. You should only run the radius search once and save all the bots objectids and just disabled them later because if you have 100 bots and 30 players then every pipebomb explosion will lag the game for around 50-100 ms

Both solutions work but one is significantly slower depending on the number of player objects
« Last Edit: February 05, 2019, 05:45:54 PM by PhantOS »

I did lag a bit, and my solution doesn't work with minigames anyways.

So drop some announce(); functions into each part of the code. Put random letters in there. When in-game it should chat message those parts. Use that to check how far into the code you get before it breaks

like this

while(something) {
    announce("check 1");
    if(otherthing) {
       announce("check 2");
       if(anotherthing) {
             announce("check 3");

in game it should print like this:
check 1
check 2
check 3

but if there's an error, at say, the first if conditional, then it'll only say
check 1
and then you'll know where the issue lies. or maybe its the second one and it'll say
check 1
check 2

the reason for doing this is to pinpoint exactly where your routine is breaking out so you know what's wrong. my guess is that its the second if conditional for your code. but it can only be verified if you test it yourself
« Last Edit: February 05, 2019, 08:08:31 PM by PhantOS »

Alright, thanks for providing the help. I'll do what I can to add in the code.

Okay, I solved the problem now by just adding in the radius search in Bot_Zombie and everything works as intended.

Locking the thread, thanks for the help everyone.
Code: [Select]
function ZombieHoleBot::onBotLoop(%this,%obj)

  %radius = 10000;
      %searchMasks = $TypeMasks::ProjectileObjectType;
      InitContainerRadiusSearch(%pos, %radius, %searchMasks);
      while ((%targetid = containerSearchNext()) != 0 )
  if(%targetid.dataBlock.getID() == sPipeBombProjectile.getID())
« Last Edit: February 06, 2019, 09:56:44 PM by Spartan224 »