How to track which agent is doing damage on who
by Imm Dtu · in Torque Game Engine · 04/30/2007 (7:58 am) · 1 replies
Hi.
I am doing some AI on a project and need to be able to track which of my bots are doing damage on other bots or human players. I need this to measure their performance at the end of the game and to find out who is shooting at who in realtime so the bots can react on who is shooting. Unfortunately I do not have a clue where to start - I have tried to search the forum and the resources but have been unsuccessful in finding similar questions. Any help on how to do this is much appreciated.
/Imm
I am doing some AI on a project and need to be able to track which of my bots are doing damage on other bots or human players. I need this to measure their performance at the end of the game and to find out who is shooting at who in realtime so the bots can react on who is shooting. Unfortunately I do not have a clue where to start - I have tried to search the forum and the resources but have been unsuccessful in finding similar questions. Any help on how to do this is much appreciated.
/Imm
About the author
Torque Owner Caleb
Default Studio Name
With most functions, "%this" is the dataBlock, and "%obj" is the object. But in here, %obj is the player who fired the weapon.
You also have a function
In here, "%obj" is the projectile, and "%col" is the object the projectile hit. So lets use this to find who hit who.
You can store who fired each projectile by putting this before the "return %p;" in the "onFire" function:
Then in your "onCollision" function, you can echo who hit who with:
if (%col.getType() & $TypeMasks::PlayerObjectType) echo(%obj.player.getName() @ " Shot " @ %col.getName());I am currently unable to test this, but I believe it should work.
Hope it helps.