dont let him see you!
« on: September 24, 2012, 11:03:24 PM »
zombie test.3dr
(239.23 KB - downloaded 169 times.)
The 3DRad community can be found at classdev.net.
int ObstacleCount;
void Main()
{
Vector3 pickLocation;
Vector3 closestPickLocation;
float distance;
float minimumDistance;
int closestObject;
if (iInitializing())
{
ObstacleCount = iObjectHandle(-1);
OUT_46 = 1.0f; //set character to permanent move-forward state
}
//check if the terrain or any obstacle object was picked
closestObject = -1;
minimumDistance = 100000000000.0f;
for (int i=2;i<ObstacleCount;i++)
{
distance = iObjectPicked(iObjectHandle(i),pickLocation);
if ((distance >= 0) && (distance < minimumDistance))
{
//this object was picked and the pick location is
//the closest to the camera so far. Record it
minimumDistance = distance;
closestPickLocation = pickLocation;
closestObject = iObjectHandle(i);
}
}
//if the terrain or any obstacle was picked, place the goal (PathFinder object) there
if (closestObject >= 0)
{
closestPickLocation.y += 1.0f;
iObjectLocationSet(OBJ_22,closestPickLocation);
}
}
Really cool and all, but I just can't figure it out. Why did you use this script:Code: [Select]int ObstacleCount;
void Main()
{
Vector3 pickLocation;
Vector3 closestPickLocation;
float distance;
float minimumDistance;
int closestObject;
if (iInitializing())
{
ObstacleCount = iObjectHandle(-1);
OUT_46 = 1.0f; //set character to permanent move-forward state
}
//check if the terrain or any obstacle object was picked
closestObject = -1;
minimumDistance = 100000000000.0f;
for (int i=2;i<ObstacleCount;i++)
{
distance = iObjectPicked(iObjectHandle(i),pickLocation);
if ((distance >= 0) && (distance < minimumDistance))
{
//this object was picked and the pick location is
//the closest to the camera so far. Record it
minimumDistance = distance;
closestPickLocation = pickLocation;
closestObject = iObjectHandle(i);
}
}
//if the terrain or any obstacle was picked, place the goal (PathFinder object) there
if (closestObject >= 0)
{
closestPickLocation.y += 1.0f;
iObjectLocationSet(OBJ_22,closestPickLocation);
}
}
It seems to be in no way relevant with what the project does.
void Main()
{
OUT_2 = 1;
}
...Where OUT_2 is the forward speed.*sign*Thats what is states here:
Who is the one who can script here?
This script searches for object linked to it and it places the pathfinder target at the spot you click on with the mouse.
The pathfinder does work when you delete the script, it's the character object which 'doesn't work'.
You need to set a speed to the character object before it works.
You can also use this script:Code: [Select]void Main()
...Where OUT_2 is the forward speed.
{
OUT_2 = 1;
}
//if the terrain or any obstacle was picked, place the goal (PathFinder object) there
Really cool and all, but I just can't figure it out. Why did you use this script:Code: [Select]int ObstacleCount;
void Main()
{
Vector3 pickLocation;
Vector3 closestPickLocation;
float distance;
float minimumDistance;
int closestObject;
if (iInitializing())
{
ObstacleCount = iObjectHandle(-1);
OUT_46 = 1.0f; //set character to permanent move-forward state
}
//check if the terrain or any obstacle object was picked
closestObject = -1;
minimumDistance = 100000000000.0f;
for (int i=2;i<ObstacleCount;i++)
{
distance = iObjectPicked(iObjectHandle(i),pickLocation);
if ((distance >= 0) && (distance < minimumDistance))
{
//this object was picked and the pick location is
//the closest to the camera so far. Record it
minimumDistance = distance;
closestPickLocation = pickLocation;
closestObject = iObjectHandle(i);
}
}
//if the terrain or any obstacle was picked, place the goal (PathFinder object) there
if (closestObject >= 0)
{
closestPickLocation.y += 1.0f;
iObjectLocationSet(OBJ_22,closestPickLocation);
}
}
It seems to be in no way relevant with what the project does.
noobs vs master... funny!
those kids put scripts here and there with no idea about what it does...
*sign*pwn3d lol
Who is the one who can script here?
This script searches for object linked to it and it places the pathfinder target at the spot you click on with the mouse.
The pathfinder does work when you delete the script, it's the character object which 'doesn't work'.
You need to set a speed to the character object before it works.
You can also use this script:Code: [Select]void Main()
...Where OUT_2 is the forward speed.
{
OUT_2 = 1;
}