Author Topic: serverside execution loving up?  (Read 890 times)

mk

so I dug around the bothole files and everything to try to find a callback when a bot dies, or at least the death or ondamage function

came up with this

//Package coreBot
//{
   function holeBotDamage(%this, %obj, %source, %a, %b, %c)
   {
      echo("checkfirst");
      parent::holeBotDamage(%this, %obj, %source, %a, %b, %c);
      echo("check 1");
      if(%obj.hCalledBotDeath)
      {
         echo("check 2");
         echo(%obj);
         echo(%source);
         echo(%this);
      }
   }
//};
//ActivatePackage(coreBot);


don't ask about the commented package

but the first echo never even appears
I swear this worked like ~2 weeks ago, maybe not, any ideas of how to fix it or a different method?
« Last Edit: September 07, 2013, 09:38:19 PM by Vortex »

Do trace(1), kill a bot, trace(0), read through console and find suitable function.

the weirdest thing ive ever seen happen is happening


if i execute the server.cs ingame the function works fine

but when i package it and allow the server to execute the package, the function refuses to work

Sounds to me like its loading the bots after it loads your server.cs, then the function you wrote is being overwritten. Use a forceRequiredAddon or whatever its called to make sure that the bots are being loaded first.

I was trying to solve the same thing. I never found a solution and gave up.

For a bot death callback, here is my solution: https://bitbucket.org/Greek2me/slayer/src/908bcfae9c70170654e8440be43aca14fbdd36b6/Dependencies/Bots.cs?at=dev#cl-253

To fix your problem with the order of execution, call forceRequiredAddOn("Bot_Hole"); at the beginning of your add-on.