Animation and shape loading
by Student-GameDevelopment · in Torque Game Engine · 07/25/2009 (8:42 pm) · 2 replies
Hello, i recently downloaded the dungeon pack from this site. It offers a lot of premade models with animations, but i cant figure out 2 things.
1: How to attach the rest of the model parts to the base shape. The goblins have a baseshape and then shoulder pads, weapon, and so on. I can load in a goblin as the main player, but the warrior i used is suppsed to have armor? I see other .dts files in there that are not being called. So, how to i load in the base shape with its armor and weapon?
2: How do i load this in as a monster/enemey for the player to fight? I added it as a shape in the world creator, but it doesnt move. I put an exec for the script in the folder of the goblin to put into the game world, but he just stands there. I assume there needs to be path functions?
Also, where can i get a good modeling program for free that works with torque?
thank you.
1: How to attach the rest of the model parts to the base shape. The goblins have a baseshape and then shoulder pads, weapon, and so on. I can load in a goblin as the main player, but the warrior i used is suppsed to have armor? I see other .dts files in there that are not being called. So, how to i load in the base shape with its armor and weapon?
2: How do i load this in as a monster/enemey for the player to fight? I added it as a shape in the world creator, but it doesnt move. I put an exec for the script in the folder of the goblin to put into the game world, but he just stands there. I assume there needs to be path functions?
Also, where can i get a good modeling program for free that works with torque?
thank you.
About the author
#2
Programattically creating a trigger (I am using T3D, but I think it should work with TGEA). %location is the center point and %parent is the object that I use to respond to the trigger event (i.e. orc attack)
And here is how to deal with the trigger
I hope this gets you going, its not perfectly thought out code, just some examples.
info: As to the shooting, well first you need to mount the image, the give it ammo (not sure if your using melee), then tell it to fire.
08/07/2009 (8:56 am)
Hmm look at killer kork and aiguard. These are some good examples. Basically you need to determine the method you wish to 'sense' the presence of the other player. You can use a trigger, every x milliseconds the trigger can call a function to evaluate if a player is close. Programattically creating a trigger (I am using T3D, but I think it should work with TGEA). %location is the center point and %parent is the object that I use to respond to the trigger event (i.e. orc attack)
function aiModel::AITrigger(%location, %parent)
{
//error("TriggerBegun");
%scale = "80 80 80";
%position = %location;
%position.x -= 40;
%position.y += 40;
%position.z -= 40;
%trigger = new Trigger()
{
dataBlock = "DefaultTrigger";
polyhedron = "0 0 0 1 0 0 0 -1 0 0 0 1";
position = %position;
scale = %scale;
};
//I create a relationship between the parent and trigger so it can
//be updated upon bot death, or reset to the bots location.
%trigger.setfieldvalue(tParent, %parent.getid());
%parent.setfieldvalue(pTrigger, %trigger.getid());
return %trigger;
}And here is how to deal with the trigger
function DefaultTrigger::onEnterTrigger(%this, %trigger, %intruder)
{
//error(%trigger @ " has been triggered by " @ %intruder);
if (%trigger.getfieldvalue(tParent) == %intruder)
{
return;
}
if (%intruder.getfieldvalue(bot) == 1 && $botkillsbot == 0)
{
//error("bots dont kill other bots"); //debug
return;
}
if (%trigger.getfieldvalue(tParent) != %intruder)
{
aiModel::attack(%trigger.getfieldvalue(tParent),%intruder);
%trigger.getfieldvalue(tParent).setfieldvalue(engaged,1);
return;
}
}I hope this gets you going, its not perfectly thought out code, just some examples.
info: As to the shooting, well first you need to mount the image, the give it ammo (not sure if your using melee), then tell it to fire.
%this.mountImage(%data @ Image,0,0);
%this.setInventory(%data,1);
%this.setInventory(%data @ Ammo,1000);
%this.mountImage(%data @ Image,0,1);
Torque Owner Student-GameDevelopment
However, now when i click on the goblin, who is standing there wiggling with his lance, shield and helmet on, the game disconnects. Telling me something about not having the correct version of the starter kit to play on this server.. Only happens when i am in the world creator and i click on the goblin. Just wanted to move it from in the air to standing on the ground..
But i sill dont understand how to make this goblin respond to the player's presence and attack. I am at a loss on how to create battle here. Anyone know a good resource or tutorial on this?
thank you