Movement Of Bots.
by Halleluyah · in Technical Issues · 02/18/2008 (2:19 am) · 7 replies
Currently, I have jpeg and dts of my bot which is the enemy under shapes/enemymush/mush.dts.
I would want to have random movement of the bots/enemies in the mission. In another words, the enemies would be running around at the area. In addition, to also have random respawn of the enemy.
Do i edit and add in codes to my enemymush.cs?
or is there other ways
And what codes to add in.
thank you.
I would want to have random movement of the bots/enemies in the mission. In another words, the enemies would be running around at the area. In addition, to also have random respawn of the enemy.
Do i edit and add in codes to my enemymush.cs?
or is there other ways
And what codes to add in.
thank you.
#2
AIGuard o.o ?
i thought we just have to edit certain codes.
currently this is my enemymush.cs:
datablock ItemData(enemyMush)
{
category = "Mushroom";
shapeFile = "~/data/shapes/mush.dts";
mass = 0.7;
value = 100;
};
function PlaceEnemy()
{
%player=localClientConnection.getControlObject();
for(%i=0; %i<100; %i++)
{
%x = getRandom(1,10);
%y = getRandom(1,10);
%z = getRandom(1,100);
%newpos = %x @ " " @ %y @ " " @ "100";//%z//
new Item(enemyMush@%i)
{
//position="10 10 10";
//scale = "1000 1000 1000";
//position=VectorAdd(%player.position, %newpos);
//position = %player.position;
datablock = "enemyMush";
rotate = "0";
static = "0";
};
}
}
actually i am doing this for my school project. and my teachers are not resourceful enough.
we are using torque game engine btw.
02/18/2008 (7:21 pm)
Yes. I am talking about enemy mushrooms. LOLS.AIGuard o.o ?
i thought we just have to edit certain codes.
currently this is my enemymush.cs:
datablock ItemData(enemyMush)
{
category = "Mushroom";
shapeFile = "~/data/shapes/mush.dts";
mass = 0.7;
value = 100;
};
function PlaceEnemy()
{
%player=localClientConnection.getControlObject();
for(%i=0; %i<100; %i++)
{
%x = getRandom(1,10);
%y = getRandom(1,10);
%z = getRandom(1,100);
%newpos = %x @ " " @ %y @ " " @ "100";//%z//
new Item(enemyMush@%i)
{
//position="10 10 10";
//scale = "1000 1000 1000";
//position=VectorAdd(%player.position, %newpos);
//position = %player.position;
datablock = "enemyMush";
rotate = "0";
static = "0";
};
}
}
actually i am doing this for my school project. and my teachers are not resourceful enough.
we are using torque game engine btw.
#3
02/18/2008 (7:51 pm)
Yep, you will have to edit certain codes. AIGaurd is a Torque resource (search for it) which is an example script, basically, for AI. After you get it working, you can modify it to suit your needs. Check it out.
#4
Then open your mission, open the console (by pressing ' at the top left) and type in
I haven't tried it yet, and I don't have much time so it may not work. You can also do what Lee said, use the AIGuard resource. Here's the link if you want to check it out www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6773
02/18/2008 (10:50 pm)
EnemyMush is just an item, not a player. I don't have much time now to find the problem, but try something like this...datablock PlayerData(enemyMush)
{
category = "Mushroom";
shapeFile = "~/data/shapes/mush.dts";
mass = 0.7;
//value = 100;
};
function PlaceEnemy()
{
%player=localClientConnection.getControlObject();
for(%i=0; %i<100; %i++)
{
%x = getRandom(1,10);
%y = getRandom(1,10);
%z = getRandom(1,100);
%newpos = %x @ " " @ %y @ " " @ "100";//%z//
%mush = new Player(enemyMush@%i)
{
position = %player.getPosition();
datablock = enemyMush;
};
}
}Then open your mission, open the console (by pressing ' at the top left) and type in
PlaceEnemy();
I haven't tried it yet, and I don't have much time so it may not work. You can also do what Lee said, use the AIGuard resource. Here's the link if you want to check it out www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6773
#5
but after i type in PlaceEnemy();
it appears: could not register dust emitter for class: enemyMush
02/18/2008 (11:43 pm)
Oh.but after i type in PlaceEnemy();
it appears: could not register dust emitter for class: enemyMush
#6
but after i type in PlaceEnemy();
it appears: could not register dust emitter for class: enemyMush
02/18/2008 (11:47 pm)
Oh.but after i type in PlaceEnemy();
it appears: could not register dust emitter for class: enemyMush
#7
Try to use the default player for the shapeFile and see how it goes. Also, are you using starter.fps, the demo, or the tutorial base? If you didn't buy Torque you would be using the demo.
02/19/2008 (3:47 pm)
I tried it and it worked for me. I only made a few changes (it's shown in bold) and I indented it.datablock PlayerData(enemyMush)
{
category = "Mushroom";
[b]maxDamage = 1000;[/b]
[b]shapeFile = "~/data/shapes/player/player.dts";[/b]
mass = 0.7;
//value = 100;
};
function PlaceEnemy()
{
%player=localClientConnection.getControlObject();
for(%i=0; %i<100; %i++)
{
%x = getRandom(1,10);
%y = getRandom(1,10);
%z = getRandom(1,100);
%newpos = %x @ " " @ %y @ " " @ "100";//%z//
%mush = new [b]AIPlayer[/b](enemyMush@%i)
{
position = %player.getPosition();
datablock = enemyMush;
};
}
}Try to use the default player for the shapeFile and see how it goes. Also, are you using starter.fps, the demo, or the tutorial base? If you didn't buy Torque you would be using the demo.
Torque Owner Lee Latham
Default Studio Name
Check out the AIGaurd resource. Study it and learn how it works, and you'll be able to modify it to do exactly what you want. It's not too hard once you get used to the environment.
But no, you will do the coding in the scripts that resource provides you.
Get Torsion.