Melee/Collision/Damage
by Edward · in Torque Game Engine · 02/09/2007 (8:51 am) · 6 replies
I am currently working on my project, and i am at a small snafu. I want to have a AI player that needs to attack aplayer. However, the issue is i want any collision with the AI player to cause damage tothe player. THink for example a rolling ball, any impact on a player, there isnt a single mounting point for weapons (which would be easy) but i want the entire Collision box of the AI to damage the player. so if it were to fall on a player or the player were to get too close.
Any ideas on the best way to do this. btw there is a animation that needs to play while each contact is made.
I have looked in several of the melee, andalmost all of them require a mount point and a melee weapon. just to clearify, what if a player wanted to ram a object with a vehicle ala collision detection to infict damage.
Any ideas on the best way to do this. btw there is a animation that needs to play while each contact is made.
I have looked in several of the melee, andalmost all of them require a mount point and a melee weapon. just to clearify, what if a player wanted to ram a object with a vehicle ala collision detection to infict damage.
About the author
I am working on my first large Game with a team of programmers and artists. I am a avid gamer and am the lead producer and director of Fantasci Hidden War. I have my first published game credit with Chariots as a Level Designer and Interior Artist.
#2
02/09/2007 (9:22 am)
Yes, that is what i am thinking, but modifying the ::onCollision for those functions are a bit beyond my skill, expecially when i want to play animations. They really need to update the melee sections.
#3
02/09/2007 (9:36 am)
Sorry, I know nothing of the 'melee sections' nor why they're relevant to collision-based damage calculations..
#4
In the script containing your AI objects and definitions:
02/09/2007 (10:10 am)
Unless I'm totally missing your point, Sam provided you with you best solution, which actually doesn't require much skill to useIn the script containing your AI objects and definitions:
function AIPlayer::onCollision(%this, %obj, %col)
{
if(%col.getClassName() $= "Player") [b]// Check to see if we are colliding with player[/b]
{
%this.playThread(0, "damageAnim"); [b]// Animate AI unit[/b]
%col.applyDamage(20); [b]// Hurt the player[/b]
}
}
#5
function MonsterA::onCollision(this,%obj,%col)
{
%objectVelocity = %obj.getVelocity();
directDamage = 20;
areaImpulse = 10;
}
so for a non-programmer i was in the right track. Thank you Michael.
02/09/2007 (10:12 am)
Thats what i was lookign for lol i had managed to piece together something similar, its the other jargon that i was missing.function MonsterA::onCollision(this,%obj,%col)
{
%objectVelocity = %obj.getVelocity();
directDamage = 20;
areaImpulse = 10;
}
so for a non-programmer i was in the right track. Thank you Michael.

Torque Owner Sam Redfern