News UnrealEd Files Mods FragBU Liandri Archives
BeyondUnreal Forums

Go Back   BeyondUnreal Forums > Unreal Development > Mapping

Reply
 
Thread Tools Display Modes
Old 9th May 2006, 05:29 PM   #1
Cybog
Registered User
 
Join Date: May. 9th, 2006
Posts: 17
Player/Monster detection range...pulling my hair out!

Ok, I am fairly noobish to the scripting game, so I appreciate any help I can get.

For the game my team is doing we want to add our custom bots and monsters to the level, but there is just one problem - They detect us from WAAAY too far away. I've played with their sight and hearing and it doesn't seem to matter. Ive adjusted their scripted sequence's "SetAlertness" to all sorts of things, and nothing seems to work. My goal is to have them walk around (pretty mindlessly) and attack me when I get close or attack them.

Can anyone please tell me how to fix their detection radius so that they don't see me from half a map away? This is driving me nuts and I can't add any monsters if they are immediately seeing me from such extreme distances.

Thanks in advance!
Cybog is offline   Reply With Quote
Old 9th May 2006, 05:33 PM   #2
The_Head
JB Mapper
 
The_Head's Avatar
 
Join Date: Jul. 3rd, 2004
Location: UK
Posts: 3,090
Sounds like your probably going to have to make a subclass to the monster and adjust some settings in their, doesnt look like something you can simply do with triggers and the like.
__________________
Quote:
[21:14] <The_Head> i feel dirty
[21:14] <RevBillyG> O_o
[21:14] <The_Head> *shudders at the thought*
[21:14] <RevBillyG> its fine as long as you clean up afterwards
The_Head is offline   Reply With Quote
Old 9th May 2006, 05:56 PM   #3
Cybog
Registered User
 
Join Date: May. 9th, 2006
Posts: 17
Ok, I am using custom monster classes but don't know what to add or what to adjust. I am simply using hybrid / chop-shop scripts to get my basic animations and characters to work.

What part of the script would need to be adjusted in the Monster class then?
Cybog is offline   Reply With Quote
Old 9th May 2006, 08:26 PM   #4
meowcat
i am a rock, i am an island
 
meowcat's Avatar
 
Join Date: Jun. 7th, 2001
Posts: 763
What did you adjust the Monster's SightRadius and HearingThreshold to? (They are set to 12000 and 2800 respectively in unrealpawn.uc and pawn.uc). In my custom pawn class (which is also controled by a heavily modified bot) I turned the sightradius down to about 4,000 and that worked better for my purposes. The hearingthreshold will really get you though, as MakeNoise (which calls Hearnoise in AIControllers and sets the noisemaker to the enemy in most controller scripts) is called quite often (firing weapons, pickups, taking damage, jumping etc.) and should be turned down in order to make your monsters harder of hearing.
__________________
"What do you mean it doesn't exist clientside?"
Meowcat's Mods for UT2K4:
Yet Another Real-life Mod: Class-based play, generic realistic weapons, unoriginal gameplay, w/ cheap COD4 knockoff, parkour player moves
TD Vehicles v125: HMMWV, MI4Hound, Black Hawk & AH-6 Helicopters, Motorcycle, IFAV Jeep, Abrams Tank
Jetpacks for UT2k4!
meowcat is offline   Reply With Quote
Old 9th May 2006, 09:47 PM   #5
Cybog
Registered User
 
Join Date: May. 9th, 2006
Posts: 17
Here is the code I am using for my custom bot:

Code:
Class SalvationMonster extends Monster;

defaultproperties
{
	Alertness=1
	DetectionRadius=1
	HearingThreshold=1
	SightRadius=1
	bForgetful=true
	RequiredEquipment(0)=""
	RequiredEquipment(1)=""
}

var float DetectionRadius;
var bool bForgetful;

function SetMeUp(name SEvent, name STag, int SHealth, name SAITag)
{
	Event = SEvent;
	Tag = STag;

	AIScriptTag = SAITag;

	if (SHealth != 0)
	{
		Health = SHealth;
	}
}

simulated function PlayDirectionalHit(Vector HitLoc)
{
}

function PostBeginPlay()
{
	Super.PostBeginPlay();

	RequiredEquipment[0] = "";
	RequiredEquipment[1] = "";
}

function RunAway()
{
	local PathNode P, Prev;
	local Array<PathNode> Y;

	foreach RadiusActors(class'PathNode', P, 4096)
	{

		if (P != None)
		{
			Y[Y.Length] = P;
	
			P = Y[RandRange(0, Y.Length -1)];
		
			if (P.Location == Location) // Makes sure the monster does actually move.
			{
				return;
			}

			if (P == Prev) // Stops monster from going to previous pathnode.
			{
				return;
			}
		
			else
			{
				Controller.bPreparingMove = true;
				//Acceleration = vect(0,0,0);
				bShotAnim = true;
				Prev = P;
				Controller.Destination = P.Location;
				Controller.GotoState('TacticalMove','WaitForAnim');
			}
	
		}

		else
		{
			MonsterController(Controller).WanderOrCamp(false);
		}

	}
}
Even with this, the bot will sense me almost immediately in the game and start walking towards me. I get no errors when compiling, so I am unsure if there is something wrong with the code. I set all the values to zero and get the same results.

Anyone have any ideas? Someone has to know how to change this
Cybog is offline   Reply With Quote
Old 9th May 2006, 09:53 PM   #6
Cybog
Registered User
 
Join Date: May. 9th, 2006
Posts: 17
Sorry, that is the script for the Monster class.

Here is the script for the actual monster that extends the Monster class:

Code:
Class SalvationMonster_Zombie extends SalvationMonster;

function RangedAttack(Actor A)
{
	if ( VSize(A.Location - Location) < MeleeRange + CollisionRadius + A.CollisionRadius )
	{
		MeleeDamageTarget(5, (15000.0 * Normal(A.Location - Location)));
	}
}

simulated function Tick( float DeltaTime )
{
	if (MonsterController(Controller) != None)
	{

	if ( Level.timeseconds - MonsterController(Controller).ChallengeTime > FMax(3,Rand(6)) )
	{
		MonsterController(Controller).ChallengeTime = Level.timeseconds;
		PlayChallengeSound();
	}

	}
}

simulated function PlayDying(class<DamageType> DamageType, vector HitLoc)
{
	AmbientSound = None;
    bCanTeleport = false; 
    bReplicateMovement = false;
    bTearOff = true;
    bPlayedDeath = true;
		
	HitDamageType = DamageType; // these are replicated to other clients
    TakeHitLocation = HitLoc;
	LifeSpan = RagdollLifeSpan;

    GotoState('Dying');
		
	Velocity += TearOffMomentum;
    BaseEyeHeight = Default.BaseEyeHeight;
    SetPhysics(PHYS_Falling);

	PlayAnim('DeathF',1.2,0.05);	
}

defaultproperties;

{

     bCanDodge=True
     bAlwaysStrafe=True
     ChallengeSound(0)=Sound'SkaarjPack_rc.Skaarj.chalnge1s'
     ChallengeSound(1)=Sound'SkaarjPack_rc.Skaarj.chalnge3s'
     ChallengeSound(2)=Sound'SkaarjPack_rc.Skaarj.roam11s'
     ChallengeSound(3)=Sound'SkaarjPack_rc.Skaarj.roam11s'
     GibCountCalf=2
     GibCountForearm=1
     GibCountHead=1
     GibCountTorso=3
     GibCountUpperArm=2
	bCanJump=false
     RagImpactSounds(0)=Sound'GeneralImpacts.Wet.Breakbone_01'
     RagImpactSounds(1)=Sound'GeneralImpacts.Wet.Breakbone_02'
     RagImpactSounds(2)=Sound'GeneralImpacts.Wet.Breakbone_03'
     RagImpactSounds(3)=Sound'GeneralImpacts.Wet.Breakbone_04'
     bCanFly=False
     MeleeRange=60.000000
     GroundSpeed=170
     Health=140
     bPhysicsAnimUpdate=True
     DrawType=DT_Mesh
     Mesh=VertMesh'CodeBaseMonsters.Male1'
     AmbientSound=Sound'GeneralAmbience.texture38'
     DrawScale=0.95000
     Skins(0)=Texture'SPMonsterTex.monsters.zombie'
     Skins(1)=Texture'SPMonsterTex.monsters.zombie'
	
	//These need to be defined or else it will not animate in net play

	MovementAnims[0]="WalkF"
	MovementAnims[1]="WalkF"
	MovementAnims[2]="WalkF"
	MovementAnims[3]="WalkF"
	WalkAnims[0]="WalkF"
	WalkAnims[1]="WalkF"
	WalkAnims[2]="WalkF"
	WalkAnims[3]="WalkF"
	CrouchAnims[0]="WalkF"
	CrouchAnims[1]="WalkF"
	CrouchAnims[2]="WalkF"
	CrouchAnims[3]="WalkF"
	AirAnims[0]="WalkF"
	AirAnims[1]="WalkF"
	AirAnims[2]="WalkF"
	AirAnims[3]="WalkF"
	SwimAnims[0]="WalkF"
	SwimAnims[1]="WalkF"
	SwimAnims[2]="WalkF"
	SwimAnims[3]="WalkF"
	TurnLeftAnim="WalkF"
	TurnRightAnim="WalkF"
	CrouchTurnLeftAnim="WalkF"
	CrouchTurnRightAnim="WalkF"
	IdleRestAnim="WalkF"
	IdleCrouchAnim="WalkF"
	AirStillAnim="WalkF"
	IdleSwimAnim="WalkF"

    TakeoffAnims[0]="WalkF"
    TakeoffAnims[1]="WalkF"
    TakeoffAnims[2]="WalkF"
    TakeoffAnims[3]="WalkF"
    TakeoffStillAnim="WalkF"

}

Last edited by Cybog; 9th May 2006 at 09:54 PM.
Cybog is offline   Reply With Quote
Old 9th May 2006, 11:05 PM   #7
meowcat
i am a rock, i am an island
 
meowcat's Avatar
 
Join Date: Jun. 7th, 2001
Posts: 763
Hmm... looks correct to me, but iirc there are a lot of funny pawn/controller initiation issues. I would say try adding some log statements (or better yet have the bot send ClientMessages to the local player controller (you) if in "debug" mode telling you what it is doing.) You should probably add the following code to your monster class as well so that you can see the AI variables in game using the 'viewactor' console command followed by 'ShowDebug' (these will show you all kinds of useful info about what your 'bot' is thinking):
Code:
function DisplayDebug(Canvas Canvas, out float YL, out float YPos)
{
	//local string DebugString;
	Super.DisplayDebug(Canvas,YL,YPos);

	Canvas.SetDrawColor(80,140,255);
	Canvas.DrawText("YOUR_PAWN Vision->"@PeripheralVision$", SightRadius->"@SightRadius$", Alertness"@Alertness$", HearingThreshold"@HearingThreshold);
	YPos += YL;
	Canvas.SetPos(4,YPos);
}
now when viewing your bot/monster in game you can see if those AI variables have been reset somehow.
__________________
"What do you mean it doesn't exist clientside?"
Meowcat's Mods for UT2K4:
Yet Another Real-life Mod: Class-based play, generic realistic weapons, unoriginal gameplay, w/ cheap COD4 knockoff, parkour player moves
TD Vehicles v125: HMMWV, MI4Hound, Black Hawk & AH-6 Helicopters, Motorcycle, IFAV Jeep, Abrams Tank
Jetpacks for UT2k4!
meowcat is offline   Reply With Quote
Old 9th May 2006, 11:36 PM   #8
Cybog
Registered User
 
Join Date: May. 9th, 2006
Posts: 17
Here is what my screen looks like after adding this code:






Nothing seems to be changing, even after the level starts and I get attacked (Other than the location coordinates). I am unsure if this is showing the proper things...?
Cybog is offline   Reply With Quote
Old 10th May 2006, 01:19 AM   #9
meowcat
i am a rock, i am an island
 
meowcat's Avatar
 
Join Date: Jun. 7th, 2001
Posts: 763
You have to be viewing a zombie to see the AI info. to do this type "viewclass YourPawnClassName" (without the quotes) in the console where YourPawnClassName is the name of your custom monster (viewclass salvationmonster_zombie). you can check out some other debug console commands here http://udn.epicgames.com/Two/ExecFun...Debug_commands
__________________
"What do you mean it doesn't exist clientside?"
Meowcat's Mods for UT2K4:
Yet Another Real-life Mod: Class-based play, generic realistic weapons, unoriginal gameplay, w/ cheap COD4 knockoff, parkour player moves
TD Vehicles v125: HMMWV, MI4Hound, Black Hawk & AH-6 Helicopters, Motorcycle, IFAV Jeep, Abrams Tank
Jetpacks for UT2k4!
meowcat is offline   Reply With Quote
Old 10th May 2006, 02:28 AM   #10
Cybog
Registered User
 
Join Date: May. 9th, 2006
Posts: 17
After doing this, their sight radius and hearing radius are exactly the same as specified in the command, and yet at the beginning of the level they detect me and come towards me no matter what.

Can you guide me through whatever command you entered into your script to get it to work? Does it look just like this one?

Does the gametype matter? I am extending Deathmatch for this game. When making a single player style map, is this ok?

The fact that he is an extend of a Monster class rather than a Pawn?

I'm throwing out all sorts of ideas....I have this thread posted on 4 forums and nobody seems to know how to set up a single player map with proper working bots....I have a hard time believing this
Cybog is offline   Reply With Quote
Old 10th May 2006, 10:00 PM   #11
meowcat
i am a rock, i am an island
 
meowcat's Avatar
 
Join Date: Jun. 7th, 2001
Posts: 763
Ok, it took me a minute or two but I found the code that allows it to see you. The reason I did not have this issue was that I did not subclass MonsterController. Look at the FindNewEnemy function in Monster controller. It searches through all level controllers and picks an enemy that can be seen (would appear not to take pawn.sightradius into account) from where the monster is. This function is called whenever the monster does not have an enemy (form the ExecuteWhatToDoNext function). Change this function to take into account the pawn view radius, or perhaps remove it al together. I would recommend overwriting the ExecuteWhatToDoNext function in your custom controller class and remove the call to that function (or something similar)
__________________
"What do you mean it doesn't exist clientside?"
Meowcat's Mods for UT2K4:
Yet Another Real-life Mod: Class-based play, generic realistic weapons, unoriginal gameplay, w/ cheap COD4 knockoff, parkour player moves
TD Vehicles v125: HMMWV, MI4Hound, Black Hawk & AH-6 Helicopters, Motorcycle, IFAV Jeep, Abrams Tank
Jetpacks for UT2k4!
meowcat is offline   Reply With Quote
Old 10th May 2006, 10:18 PM   #12
Cybog
Registered User
 
Join Date: May. 9th, 2006
Posts: 17
Sorry if I am so noob But the scripts that I have are sorta piece-milled together...I am still learning the language for the most part.

Can you help me clarify what exact function I should be writing into my custom controller? I looked through the Monster class and I don't see any "FindNewEnemy" anywhere in the script

Again, thank you big time for this help. Everyone I have asked so far can't seem to get it figured out either.
Cybog is offline   Reply With Quote
Old 11th May 2006, 08:14 AM   #13
Cybog
Registered User
 
Join Date: May. 9th, 2006
Posts: 17
Ok, I think I know what you are saying. My problem is lying in the fact that I am not using any sort of Monster controller. I'm not even sure how to set this up.

Basically all I have been doing is extending the monster class, and then extending of of that custom type. Gonna have to do some more research into setting up a controller. Not sure how that works
Cybog is offline   Reply With Quote
Old 11th May 2006, 04:21 PM   #14
techbinge
Registered User
 
Join Date: Jan. 16th, 2006
Location: San Diego
Posts: 26
Don,

here are few links to where I got started w/ my controllers / subclasses:

http://wiki.beyondunreal.com/wiki/A_...nster_Tutorial
http://wiki.beyondunreal.com/wiki/Ar...l_Intelligence

-t
__________________
Game Design Student // AiCA-SD
techbinge is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 08:15 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.

Copyright ©1998 - 2012, BeyondUnreal, Inc.
Privacy Policy | Terms of Use
Bandwidth provided by AtomicGamer