Please help
by Jared Kidd · in Technical Issues · 07/23/2008 (12:12 pm) · 7 replies
I am making a healthkit for my game and i am having trouble making it a item. Everytime i look for my healthkit in the folders its always in the static shapes and o want it to be in the items folder and tryed this code for it.
datablock ItemData(healthkit)
{
category = "Items";
shapeFile = "~/data/shapes/healthkit/healthkit.dts";
mass = 1;
friction = 1;
elasticity = 0.3;
// Dynamic properties defined by the scripts
pickupName = "a health kit";
repairAmount = 50;
};
function HealthKit::onCollision(%this,%obj,%col)
{
// Apply some health to whoever uses it, the health kit is only
// used if the user is currently damaged.
if (%col.healthkit)
applyRepair(%this, repairAmount);
}
};
datablock ItemData(healthkit)
{
category = "Items";
shapeFile = "~/data/shapes/healthkit/healthkit.dts";
mass = 1;
friction = 1;
elasticity = 0.3;
// Dynamic properties defined by the scripts
pickupName = "a health kit";
repairAmount = 50;
};
function HealthKit::onCollision(%this,%obj,%col)
{
// Apply some health to whoever uses it, the health kit is only
// used if the user is currently damaged.
if (%col.healthkit)
applyRepair(%this, repairAmount);
}
};
About the author
i'm 16 and i really enjoy making games and testing them. i started making games when i was 11 using game maker, but then i started using torque when i was about 13 and now i fell in love with game designing and look forward to making a career out of it.
#2
07/23/2008 (2:14 pm)
Yes i want the healthkit in the Shapes/items and i will try to look for the errors.
#3
07/23/2008 (5:12 pm)
I have tryed alot but can't seem to get it to be an item any more advice.
#4
07/24/2008 (11:49 am)
Did you properly do exec("healthkit.cs"); (or whatever the script file's name is) during initialization?
#5
07/24/2008 (12:50 pm)
I got it to finally work but another problem is making it rotate and give me health and respawn in the script.
#6
Items also have a rotate property you can set. Just say rotate = true; when you create the item.
07/24/2008 (1:11 pm)
Items have a respawn function defined in script if you look in item.cs. You can call it in your pickup function (as well as increment your health). Items also have a rotate property you can set. Just say rotate = true; when you create the item.
#7
07/26/2008 (11:44 am)
How do make it collidable
Torque Owner Robert Potter
When it works it'll be in Shapes/Items in the World Editor Creator