Author Topic: Getting the killer of a bot.  (Read 2004 times)

I've tried several ways, and none of them have worked so now i'm here asking you guys for help again.

I've tried:
  • EnemyAI::OnDeath();
    • EnemyAi's the player datablock I made for the bots.
    • It says unkown command on death, Knowing me I've probably raped it somehow.
  • ProjectileData::Damage()
    • Then running a schedule like 100 milliseconds after to check wether you've killed the bot, that works but I couldn't get the killer from it.

Since you defined the bot's client as a scriptobject, ScriptObject::onDeath() would be called. However, I'd make the scriptobject into its own unique class (classname = "AIClient"; when making the scriptobject) then use AIClient::onDeath().

You mean the thing that Trader wrote for me?

Yes.  I believe this is what he's suggesting.

Code: [Select]
%botclient = new ScriptObject()
{
     classname = "AIClient;
};

function AIClient::onDeath(<args>)
{
}


Yes.  I believe this is what he's suggesting.

Code: [Select]
%botclient = new ScriptObject()
{
     classname = "AIClient;
};

function AIClient::onDeath(<args>)
{
}
Yes, that's what I meant.

Will the args be the same as Armor::OnDeath?

I'm also confused by the script object thing, do I put that in the function that creates the bot?

Does Armor::onDeath exist?  I know Armor::onDisabled exists, which may be what you want to use anyway.

Yes.

Thanks. I take back anything bad I've said about you, you've helped me alot.

Np.  I won't apologize for the "no nonsense" method I use for managing my servers, but, overall, I don't think I'm that bad.  :P
« Last Edit: November 08, 2007, 03:49:14 PM by Trader »

AIClient::OnDeath() would take the same arguments as GameConnection::onDeath().
Code: [Select]
function GameConnection::onDeath(%this, %sourceObject, %sourceClient, %damageType, %damLoc)
%this - client
%sourceObject - the player which killed you (may be dead or nonexistant!)
%sourceClient - the client which killed you
%damageType - $DamageType::["Gun"] etc
%damLoc - "Head" all the time I think.

I have a question about script objects, If I were to do
Code: [Select]
%bot.minigame = new scriptObject(){
minigame = $RPG_Mini
}

would that be the same as doing %bot.minigame = $RPG_Mini;?

This is really hard D=.
« Last Edit: November 09, 2007, 12:01:43 PM by MrPickle »

No... Its not hard either its just plain logic.

No... Its not hard either its just plain logic.

Maybe not for you.

I need to find a tutorial on script objects.