Fixes for MonsterHunt.u v503

Discussions about GameTypes
Buggie
Godlike
Posts: 2734
Joined: Sat Mar 21, 2020 5:32 am

Fixes for MonsterHunt.u v503

Post by Buggie »

Look like we need one topic where I can post continue improved conformed MonsterHunt.u with changes which fix bugs and not break compatibility.

Important note: files conformed, but tools like ACE which compare file byte-by-byte or calculate difference will be complain about files modification.

As base choosen most popular MH v503.

There can be some extensions which need only server work. In any case compatibility preserved so you can safely replace MonsterHunt.u on client or server (do not forget about .uz version in this case!).

fix1. Fix cropped sources: viewtopic.php?f=34&t=14054

fix2. Fix OlRifle zoom for dedicated server: viewtopic.php?f=4&t=14512

fix3. Fix flood in logs:

Code: Select all

ScriptWarning: MonsterHunt Autoplay.MonsterHunt0 (Function MonsterHunt.MonsterHunt.AddToTeam:0150) Accessed None 'PlayerReplicationInfo'

fix4. Include server-side fix for bots inspired by sector: viewtopic.php?p=70125#p70125

Code: Select all

/*
AssessBotAttitude returns a value that translates to an attitude
		0 = ATTITUDE_Fear;
		1 = return ATTITUDE_Hate;
		2 = return ATTITUDE_Ignore;
		3 = return ATTITUDE_Friendly;
*/	
function byte AssessBotAttitude(Bot aBot, Pawn Other)
{
	local vector HitLocation, HitNormal;

	if ( Other.isA('Titan') && Other.GetStateName() == 'Sitting' )
		return 2; // ATTITUDE_Ignore
	// prevent attack through Movers (if engine support)
//	if ( Trace(HitLocation, HitNormal, Other.Location, aBot.Location, False) != None )
	if (!aBot.LineOfSightTo(Other))
		return 2; // ATTITUDE_Ignore
	if ( Other.IsA('Nali') || Other.IsA('Cow') )
		return 3; // ATTITUDE_Friendly
	if ( Other.bIsPlayer && Other.PlayerReplicationInfo != None && Other.PlayerReplicationInfo.Team == aBot.PlayerReplicationInfo.Team )
		return 3; // ATTITUDE_Friendly
	if ( Other.IsA('TeamCannon') )
	{
		if (TeamCannon(Other).SameTeamAs(0) )
			return 3; // ATTITUDE_Friendly
		if (Other.GetStateName() != 'ActiveCannon')
			return 2; // ATTITUDE_Ignore
	}
	if ( !(Other.bIsPlayer && Other.PlayerReplicationInfo != None) && Other.CollisionHeight < 75 )
		return 1; // ATTITUDE_Hate
	if ( !(Other.bIsPlayer && Other.PlayerReplicationInfo != None) && Other.CollisionHeight >= 75 )
		return 0; // ATTITUDE_Fear
		
	return super(DeathMatchPlus).AssessBotAttitude(aBot, Other);
}
Note: This help not in all cases. Sometimes bots still attack TeamCannon not in ActiveCannon state. Sometime bots unexpectedly shoot Nali after few minutes walk near him. Possible Bugs in Bots code.


fix5. Fix flood in logs:

Code: Select all

Error: MonsterHunt Autoplay.MonsterHunt0 (Function Botpack.TeamGamePlus.ScoreKill:016E) Accessed array 'Teams' out of bounds (255/4)
With happens if player without team (Team = None, TeamId = 255), kill something.
Fixed by set

Code: Select all

bScoreTeamKills=False
For MonsetHunt GameInfo.


fix6. Try resolve some issues with bots:
- Suddenly attack Nali and Cows.
- Wake up Sitting Titan before intended time.

Code: Select all

		if ( S.isA('Titan') && S.GetStateName() == 'Sitting' )
			continue;
		if ( S.IsA('Nali') || S.IsA('Cow') )
			continue;
For loop inside FindSpecialAttractionFor.


fix7. Dispersion pistol now accept both
osWeaponPowerup (missing class in MH) and WeaponPowerup (standard U1 class).

Code: Select all

function bool HandlePickupQuery( inventory Item )
{
  if ( Item.IsA('osWeaponPowerup') || Item.IsA('WeaponPowerup') )

fix8. Razorjack properly replaced to MH version (fix typo OLRajorjack -> OLRazorjack):

Code: Select all

		if ( Other.IsA('Razorjack') )
		{
			ReplaceWith(Other, "MonsterHunt.OLRazorjack");
			Return false;
		}

fix9. Fix flood in log when Skaarj pickup OLautomag:

Code: Select all

Function MonsterHunt.OLautomag.HandlePickupQuery:0316) Accessed None 'myHUD'

fix10. better handle Nali and Cow for Bots:

Code: Select all

	if ( Other.IsA('Nali') || Other.IsA('Cow') )
	{
		switch (ScriptedPawn(Other).AttitudeToCreature(aBot))
		{
			case ATTITUDE_Hate:
			case ATTITUDE_Frenzy:
				bEnemy = true;
		}
		switch (Other.AttitudeToPlayer)
		{
			case ATTITUDE_Hate:
			case ATTITUDE_Frenzy:
				bEnemy = true;
		}
		if (!bEnemy)
			return 3; // ATTITUDE_Friendly
	}

fix11.
- Remove useless check for ScriptedPawn.IsA('NaliRabbit')
- Fix ScoreKill code for run and access to None. Evil Nali and Evil Cow now counted as Evil.
- Fix bScoreTeamKills for child subclasses of MonsterHunt game type (Arena, Solo, Defence).
- Prevent call GameEnded if game already ended.

Code: Select all

function EndGame( string Reason )
{
	if ( bGameEnded )
		return;
	Super.EndGame(Reason);
}

fix12. Fix access None at Killed.


Next updates here: viewtopic.php?p=128257#p128257
Last edited by Buggie on Sun May 23, 2021 7:48 pm, edited 12 times in total.
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Fixes for MonsterHunt.u v503

Post by sektor2111 »

Please Translate these:

Code: Select all

	if ( !(Other.bIsPlayer && Other.PlayerReplicationInfo != None) && Other.CollisionHeight < 75 )
		return 1; // ATTITUDE_Hate
	if ( !(Other.bIsPlayer && Other.PlayerReplicationInfo != None) && Other.CollisionHeight >= 75 )
		return 0; // ATTITUDE_Fear
Can you see that these are MONSTERS not players ?
Monster doesn't have PlayerReplicationInfo check it yourself.
This is the faster code without that useless check

Code: Select all

		if ( !Other.bIsPlayer && Other.CollisionHeight < 75 )
			return 1;
		if ( !Other.bIsPlayer && Other.CollisionHeight >= 75 )
			return 0;
Monster is not player in my controllers and Big ones are hazard not smaller ones. And this check is not against players because it's about 75 collisionheight and NON PLAYER defaulted without PlayerReplicationInfo - see Pawn.uc. Skaarj is not bIsPlayer in PrebeginPlay - it goes crazy later...
Also you can track this:

Code: Select all

function int ReduceDamage(int Damage, name DamageType, pawn injured, pawn instigatedBy) //screwed properly
{
	local ScriptedPawn S;

	if ( instigatedBy != None && instigatedBy.bIsPlayer && instigatedBy.PlayerReplicationInfo == None )
		instigatedBy.bIsPlayer = False;
	if ( injured != None && injured.bIsPlayer && injured.PlayerReplicationInfo == None )
		injured.bIsPlayer = False;

	if (injured.Region.Zone.bNeutralZone)
		return 0;
....
Last edited by sektor2111 on Sun Apr 11, 2021 1:23 pm, edited 2 times in total.
Buggie
Godlike
Posts: 2734
Joined: Sat Mar 21, 2020 5:32 am

Re: Fixes for MonsterHunt.u v503

Post by Buggie »

https://github.com/OldUnreal/UnrealTour ... issues/296

Monster can have bIsPlayer = True if this is SkaarjTrooper (or child class).

Welcome to wonderful UE1 World, where Monsters can be Players. :lol2:
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Fixes for MonsterHunt.u v503

Post by sektor2111 »

Enough FALSE - in PreBeginPlay is NOT player and it goes bIsPlayer LATER in AutoState without any "playerreplicationInfo" - TESTED and LOGGED, that's why "ReduceDamage" solves problem, this is not a story, you'd better check my controllers in MGS server, lol... UE1 can stay as it is, I do not have any problem with it - okay, except small touches here and there. I worked years at these things - for me they are already solved, no worries 8) . If Skaarj is not going bIsPlayer he won't call the "Weapon.Touch(Self)" for weapon properly, to not forget replacements which need a customized ReplaceWith function... and so on.

Oh, yeah, welcome to MH controller - nice to meet you running the same movie :lol: . The evil chain it's longer than your expectations...

Do you want to see more ? Guess what...

Code: Select all

class MHLogFile expands StatLogFile;

function LogPickup(Inventory Item, Pawn Other)
{
	if ( Other.bIsPlayer && Other.PlayerReplicationInfo != None ) //We aren't monkeying if Replication not exist or pawn is not OK
	{
		if ( Item.ItemName != "" )
			LogEventString(GetTimeStamp()$Chr(9)$"item_get"$Chr(9)$Item.ItemName$Chr(9)$Other.PlayerReplicationInfo.PlayerID);
		else
			LogEventString(GetTimeStamp()$Chr(9)$"item_get"$Chr(9)$Item.Class$Chr(9)$Other.PlayerReplicationInfo.PlayerID);
	}
	else
		{
			if ( Item.ItemName != "" )
				LogEventString(GetTimeStamp()$Chr(9)$"item_get"$Chr(9)$Item.ItemName$Chr(9)$Other.GetHumanName());
			else
				LogEventString(GetTimeStamp()$Chr(9)$"item_get"$Chr(9)$Item.Class$Chr(9)$Other.GetHumanName());
		}
}
....
Ayeee ! Spam caused by Skaarj monsters coming later in game are no longer printing junks in log... and no GitHub even needed.

And the story - now feel free to conform a new version having a new class with older one not having new class - let me know what you get...

If you ask about solutions, proposal it's expanding controller

Code: Select all

class Ex_MonsterHunt expands MonsterHunt config(EX_Hunt);
then

Code: Select all

class MonsterHunt expands Ex_MonsterHunt;

defaultproperties
{
	bCanChangeSkin=True
}
Now you have MonsterHunt rooted in map properly and visible in Player Browser.

More stuff goes in "SetPawnDifficulty" concerning recovery of dumb mapping settings... and bytes abominations from original package.

Then we have maps with TimeDilation screwed which will need some... love for "Classic" difficulty setup...

Then we need Monster skill aligned properly at Level.Game.Difficulty or aligned at variable with the same "skill" name because in 503 it's a fake skill... according to Pawn.uc stuff.

I'm afraid list is longer. Either way I'm curious if you still want MonsterShadow decal ticking in server where decals are NEVER attached because are useless over there.

Then it goes Bot Code which can be powered up a bit, MonsterWayPoint that needs some prevention against wild touches Pos3 before Pos1 and such, MonsterEnd ends game multiple times, and so on.

You can imagine that I solved a mountain of issues, and then I'm not intended to replace controller for a few fixes which I don't mind. As far as I recall, in whatever old map some cows went evil attacking "Players", let me know how goes the "Cow" deal in that particular case.
Buggie
Godlike
Posts: 2734
Joined: Sat Mar 21, 2020 5:32 am

Re: Fixes for MonsterHunt.u v503

Post by Buggie »

Added fix7.
--- EDIT ---
Added fix8.
--- EDIT ---
Added fix9.
Eternity
Skilled
Posts: 172
Joined: Sat Nov 30, 2019 10:56 pm

Re: Fixes for MonsterHunt.u v503

Post by Eternity »

Buggie wrote: Sun Apr 11, 2021 10:23 am if ( S.IsA('Nali') || S.IsA('Cow') )
continue;
There are such packages as, for example, "WarNukingGround" that contain, for example, 'CowAvenger' class which is inherited from the 'UnrealShare.Cow' and is not the normal 'Cow'...
Something similar, probably, might exist for 'Nali'... (though, i did not see this yet...)
So, maybe to use additional checks: (S.IsA('Cow') && (S.Class.Name=='Cow' || S.Class.Name=='BabyCow')) ...

---

This direction has a huge mountain of work that may take a couple of years or even more in order to get accomplished... Most part of that was already done within one or another project in past. So, it definitely worth to check already existing projects out, since reading their scripts you quickly realize what developers were working on and which problems they tried to resolve... This would have saved a substantial amount of time by skipping the phase of testing/discovering of all of those old problems once again, and not starting the project from the very beginning, but from the point of overall currently achieved progress in this direction...

There are at least 3 projects that definitely worth attention, one of them is here. Else projects are an extended GameType's, because there are many problems that can not be fixed without breaking compatibility (and this itself is also a problem in this case), nevertheless it worth to check them out as they also contain the fixes that do not break compatibility and could be also used for fixed MonsterHunt v503.
Buggie
Godlike
Posts: 2734
Joined: Sat Mar 21, 2020 5:32 am

Re: Fixes for MonsterHunt.u v503

Post by Buggie »

Slippery way.
Cow also can subclassed as friendly creatures. Or hostile. Possible need look deeper for find exact difference between them.

As i see need check next things:
1. Call AttitudeToCreature(aBot) and check result.
If ATTITUDE_Hate or ATTITUDE_Frenzy - then enemy.
http://medor.no-ip.org/UEditor_Developi ... kazeCow.uc

Code: Select all

function eAttitude AttitudeToCreature(Pawn Other)
{
	if ( Other.IsA('Cow') )
		return ATTITUDE_Friendly;
	else if ( Other.IsA('PlayerPawn') )
		return ATTITUDE_Hate;
	else
		return ATTITUDE_Ignore;
}
2. Check AttitudeToPlayer field.
If ATTITUDE_Hate or ATTITUDE_Frenzy - then enemy.
http://medor.no-ip.org/UEditor_Developi ... EvilCow.uc

Code: Select all

AttitudeToPlayer=ATTITUDE_Hate
3. Check RangedProjectile
if != None = enemy
http://medor.no-ip.org/UEditor_Developi ... sycoCow.uc

Code: Select all

RangedProjectile=Class'BQQ.DeathBolt'
But this rule is so-so, because even if Cow have RangedProjectile this can be friendly cow.

Here example why not need shoot every cow:
http://medor.no-ip.org/UEditor_Developi ... es/TCOW.uc

Code: Select all

function PlayTakeHit(float tweentime, vector HitLoc, int damage)
{
local actor explo;

explo = Spawn(class'BallExplosion',,,location);
explo.drawscale *= 6;
explo = Spawn(class'BallExplosion',,,location);
explo.drawscale *= 7;
Hurtradius(999999,900,'exploded',200000,location);
Destroy();
}
So I think first two rules enough for distingish most evil cow/nali from good ones.

--- EDIT ---

Bots in MH mostly useless.
And most MH map not designed for bots.
And network patching bugged in UT which is very critical for bots work.

So bots not a target of MH usually.

Main goal this fixes - fix common obvious bugs. I do not intended go deep with that.
User avatar
OjitroC
Godlike
Posts: 3613
Joined: Sat Sep 12, 2015 8:46 pm

Re: Fixes for MonsterHunt.u v503

Post by OjitroC »

Eternity wrote: Tue Apr 13, 2021 7:07 am There are such packages as, for example, "WarNukingGround" that contain, for example, 'CowAvenger' class which is inherited from the 'UnrealShare.Cow' and is not the normal 'Cow'...
Something similar, probably, might exist for 'Nali'... (though, i did not see this yet...)
There is, indeed, something similar for 'Nali'. There are 'hostile' Nali subclassed from UnrealShare.Nali in Taco-nalisorc.u; NaliWarrior.u and AKCoop.u. There are one or two other more obscure examples.
Buggie
Godlike
Posts: 2734
Joined: Sat Mar 21, 2020 5:32 am

Re: Fixes for MonsterHunt.u v503

Post by Buggie »

http://medor.no-ip.org/UEditor_Developi ... heClasses/
Ctrl+F
"Nali"
And check each class manually.

Or

Download http://medor.no-ip.org/UEditor_Developi ... Classes.7z
Unpack somewhere and use any good tool for that.
Search in Total commander good enough for that.

Cmd line-ninja can use grep and friends.

--- EDIT ---
Examples:
http://medor.no-ip.org/UEditor_Developi ... azeNali.uc

Code: Select all

function eAttitude AttitudeToCreature(Pawn Other)
{
	if ( Other.IsA('Nali') )
		return ATTITUDE_Friendly;
	else if ( Other.IsA('PlayerPawn') )
		return ATTITUDE_Hate;
	else
		return ATTITUDE_Ignore;
}
http://medor.no-ip.org/UEditor_Developi ... sedNali.uc

Code: Select all

AttitudeToPlayer=ATTITUDE_Hate
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Fixes for MonsterHunt.u v503

Post by sektor2111 »

Buggie wrote: Tue Apr 13, 2021 8:04 am Bots in MH mostly useless.
And most MH map not designed for bots.
And network patching bugged in UT which is very critical for bots work.

So bots not a target of MH usually.
I think I already demonstrated that these can be DONE and fully operational - I made MH maps myself (all operational - by Bots too) and I added Bot Support even WITHOUT PathNodes. Bugged is MAPPER not pathing: bad combos usage, missing Lift triggers, hilarious Nodes placement, Retarded Dumb MonsterWaypoint settings and locations, etc, etc.
The problem connected is missing real MH TUTORIALS + pathing chapter described correctly and all needs for UE1. First of all UE1 was addressing Monsters not Bots which are more difficult to manage than Bots so I completely deny these - try understand a RED Path, exactly, that's not a monster path.
If you understand a big part of pathing requirements in MonsterHunt, all goes a piece of cake in plain cubed maps - mappers are making Bots useless in MH and nobody else. Stay under 3000 reachSpecs (hard-coded array for UE1) and all it's working in a normal PathsNet - old mappers demonstrated this as well. If coders cannot handle things it's a different story, because it's all SCRIPTS which need aligned and working in good timings.

I can even make small demo maps demonstrating what is doable as mapping + game controller. Map vs old MH - Map vs an adjusted MH - And Bot as presence in both cases.
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Fixes for MonsterHunt.u v503

Post by sektor2111 »

Buggie wrote: Sun Apr 11, 2021 10:23 am fix10. better handle Nali and Cow for Bots:

Code: Select all

	if ( Other.IsA('Nali') || Other.IsA('Cow') )
	{
		switch (ScriptedPawn(Other).AttitudeToCreature(aBot))
		{
			case ATTITUDE_Hate:
			case ATTITUDE_Frenzy:
				bEnemy = true;
		}
		switch (Other.AttitudeToPlayer)
		{
			case ATTITUDE_Hate:
			case ATTITUDE_Frenzy:
				bEnemy = true;
		}
		if (!bEnemy)
			return 3; // ATTITUDE_Friendly
	}
- AttitudeToCreature(aBot) -
Somehow questioning, unless bot will annoy monster in a way, otherwise Monster won't be interested who is there and why, because monster's plain attitude toward Bot it's IGNORE all day long...

Code: Select all

function eAttitude AttitudeToCreature(Pawn Other)
{
	if( Other.Class == Class ) 		// if it's like me
		return ATTITUDE_Friendly; //is a friend
	else						// or else
		return ATTITUDE_Ignore; 	// I don't have any problem with this guy
}
I tested this attitude for a Skaarj. It's not even blinking until his friends are telling him about me or I shoot him. Tested in custom environments not MonsterHunt altering attitude code.
SC]-[WARTZ_{HoF}
Adept
Posts: 426
Joined: Tue Feb 21, 2012 7:29 pm

Re: Fixes for MonsterHunt.u v503

Post by SC]-[WARTZ_{HoF} »

@Buggie Make sure any help from sektor2111(aka Nelsona) is documented in your fixes. It is a good policy especially if future developers inquire about them.
Image
Image
Image
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Fixes for MonsterHunt.u v503

Post by sektor2111 »

Perhaps 469 has different codes but original UT blocks Monster in "UnrealShare.SetEnemy" and... you cannot do anything with stock UT at this point. Even if monster is omni-hater, it needs a new SetEnemy - see EXU and MonsterSpawn else those codes are just guessing for plain monsters.
Now you can conform UnrealShare into something really needed. Me one I'm no longer using stock codes, else MonsterShadow spawned in server doesn't make any sense and processing skill 2 in SetPawnDifficulty is USELESS, as SetPawnDifficulty has two arguments for no reason. Said "Skill" is known already and can be used from controller as it is without computing a Diff - it's pointless, either way I don't see where "Pawn.Skill" grows up to 3 matching with "GameInfo.Difficulty".

Other "codes":
MonsterHunt_UC wrote: foreach AllActors(class'ScriptedPawn', S)
{
MonstersTotal ++;
if ( !S.IsA('Nali') && !S.IsA('Cow') && !S.IsA('NaliRabbit') )
S.AttitudeToPlayer=ATTITUDE_Ignore;
and rocket is train and train is car ? NaliRabbit was NEVER Scriptedpawn. Here MonstersTotal++ counter includes lousy data...
Melee attack has no fix when monster is powered up by mapper as long as that byte goes Over RANGE. I don't have more plans for returning at old problems.

Bot Support
MonsterWayPoint is original - NO FIX

MonsterEnd
A big one going active Ends game 4 times if more players are in radius - NO FIX.

Then...
MonsterHunt_uc wrote: function ScoreKill(pawn Killer, pawn Other)
{
local ScriptedPawn S;

if ( (Killer == None) || (Killer == Other) || !Other.bIsPlayer
|| (Killer.PlayerReplicationInfo.Team != Other.PlayerReplicationInfo.Team) )
Super.ScoreKill(Killer, Other);

MonstersTotal = 0;

foreach AllActors(class'ScriptedPawn', S)
{
if (S.Health >= 1)
MonstersTotal ++;
if (S.Shadow == None)
SetPawnDifficulty(MonsterSkill, S);
}
.....
Iterating all time when something dies and only when dies ? And is nothing fixed anyway... to not forget Monster with health 1 ghosting based on TriggeredDeath crap... it's not dying...

Code: Select all

Killer.PlayerReplicationInfo.Team != Other.PlayerReplicationInfo.Team
Oh really ? Show me PlayerReplicationInfo at pupaes, this is Accessed Nones and nothing more... In 2021 perhaps if you have a single team this check doesn't make any sense. When are happening these ? It's all about Killing monsters or mates.

Code: Select all

     MaxTeams=1
     MaxAllowedTeams=1
Now allow me to ignore these until real fixes...
Buggie
Godlike
Posts: 2734
Joined: Sat Mar 21, 2020 5:32 am

Re: Fixes for MonsterHunt.u v503

Post by Buggie »

Added fix11.

I play only in MonsterHuntSB (where many things different or fixed). I not play and not intended to play in plain MH. But if you want these fixes and I understand essence of problem - I make fix for it.

If I doubt about side effects then I not change things.

--- EDIT ---

Added fix12.

--- EDIT ---

fix13. Remove shadow for some bugged monsters like Predator.


--- EDIT ---

fix14. Not activate triggers on spawn location before game start by set bSpawnInTeamArea=False


fix15. Fix break broken skins like Cow and Nali. Now You can use bUseTeamSkins=True.

Code: Select all

		if (MonsterReplicationInfo(GameReplicationInfo).bUseTeamSkins)
		{
			Other.static.GetMultiSkin(Other, SkinName, FaceName);
			if (SkinName ~= "None")
				SkinName = string(Other.Skin);
			if (SkinName ~= "None")
				SkinName = string(Other.MultiSkins[1]);
			if (!(SkinName ~= "None"))
				Other.static.SetMultiSkin(Other, SkinName, FaceName, 0);
		}
MonsterHunt_503fix15.zip
(387.4 KiB) Downloaded 30 times
Last edited by Buggie on Sun May 23, 2021 7:48 pm, edited 1 time in total.
Post Reply