Increasing hit points for enemies acording to characters hit points
by Michael Priest · in Game Design and Creative Issues · 01/28/2010 (8:55 pm) · 5 replies
I would like to randomly give my enemies a higher hit point level depending on my characters hit point level could anyone point me in the right direction on how to do that.
#2
Then you can use a switch statement in the spawn function
01/29/2010 (4:49 pm)
An even better way would be to create say three different datablocks.datablock PlayerData(PatrolPlayer1: PlayerBody)
{
maxDamage = 150;
maxForwardSpeed = 10;
maxBackwardSpeed = 8;
maxSideSpeed = 10;
shootingDelay = 100;
};
datablock PlayerData(PatrolPlayer2: PlayerBody)
{
maxDamage = 200;
maxForwardSpeed = 10;
maxBackwardSpeed = 8;
maxSideSpeed = 10;
shootingDelay = 100;
};
datablock PlayerData(PatrolPlayer3: PlayerBody)
{
maxDamage = 250;
maxForwardSpeed = 10;
maxBackwardSpeed = 8;
maxSideSpeed = 10;
shootingDelay = 100;
};Then you can use a switch statement in the spawn function
%value = getRandom(1);
switch(%value)
{
case 0:
// Create the AI player object
%player = new AIPatrol() {
dataBlock = PatrolPlayer1;
marker = %obj;
path = %obj.pathname;
botname = %name;
isbot=true;
{...}
case 1:
// Create the AI player object
%player = new AIPatrol() {
dataBlock = PatrolPlayer2;
marker = %obj;
path = %obj.pathname;
botname = %name;
isbot=true;
{...}
default:
// Create the AI player object
%player = new AIPatrol() {
dataBlock = PatrolPlayer3;
marker = %obj;
path = %obj.pathname;
botname = %name;
isbot=true;
{...}
}
#3
01/31/2010 (12:12 am)
Hi thank you for the reply to my post. I am in my 3rd semester of computer programming and I have taken 3d modeling and this is my first semester in 3D Simulation and this was part of my assignment to post something that I was interested in learning. I think what I would like to understand that lets say I have a game like a character in a D&D game that is a first level character and I have a enemy character that I would like to have grow or decrease in hit point depending on my characters hit point or experience level do you know what would be the best way to do that?
#4
You could also simplify the spawn script a bit:
01/31/2010 (3:02 am)
Quote:Not sure if your enemies are AI or not but you can change their maxDamage randomly during creation.I don't think that'll work - maxDamage is a datablock member, not an object member. Your AIPlayers will run around each with a different maxDamage member, but it won't matter since they will all be using the datablock value.
Quote:An even better way would be to create say three different datablocks.That's the best thing you can do without modifying the source, as far as I know.
You could also simplify the spawn script a bit:
%data = "";
switch(%value)
{
case 0:
%data = Datablock1;
case 1:
%data = Datablock2;
case 2:
%data = DataBlock3;
}
%player = new AIPlayer() {
dataBlock = %data;
//etc.
};
#5
____________________________
Jack Mcmahon
numerology readings book reader
12/07/2010 (4:58 am)
I'll just try this one and let's see if it will work. Thanks for this.____________________________
Jack Mcmahon
numerology readings book reader
Torque Owner Inflight
Default Studio Name
The players datablock is set to 100 by default
datablock PlayerData(DefaultPlayer: PlayerBody) { maxDamage = 100; {...} }So for the AI you could do something like this...
function AIPatrol::spawn(%name, %obj) { // random AI maxdamage // the result can be 101 to 200 %val = getRandom(1,100); %newdmgval = %val + 100; // Create the AI player object %player = new AIPatrol() { dataBlock = PatrolPlayer; marker = %obj; path = %obj.pathname; botname = %name; isbot=true; maxDamage = %newdmgval; {...} }