Invisible weapons in MH-Treasure2DXfixed

Tutorials and discussions about Mapping - Introduce your own ones!
Post Reply
User avatar
Barbie
Godlike
Posts: 2792
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Invisible weapons in MH-Treasure2DXfixed

Post by Barbie »

<EDIT>
2017-07-30: Map is fixed now
</EDIT>

The map MH-Treasure2DXfixed uses package Humane.u which has sub classes of SkaarjTrooper:

Code: Select all

class Humangrant extends SkaarjTrooper;
class Recon extends Humangrant;
class gunner extends Humangrant;
The pawns Humane.Recon and Humane.Gunner are given one of the weapons Humane.FullAutoGun, Humane.assaultgun or bPak.BFlakCannon. These weapons do not exist as pickup in this map.

Now the problem: if the map is played on my server and such a pawn is killed, it drops its weapon, and if a player picks it up and switches to it, the weapon is fully functional but invisible in players 1st person view (but not in 3rd person view). I also noticed other effects like DoubleJump not working any more or HUD ammo display vanishes for other weapons. While writing this I've found that also BotPack.minigun2, dropped from a trooper, has this issue. Client's log is full with warnings:
ScriptWarning: minigun2 MH-Treasure2DX+SBFix1.minigun22 (Function Botpack.TournamentWeapon.TweenToStill:000D) TweenAnim: Sequence 'Still' not found in Mesh 'MinigunPick'
Any hint what can be wrong here?
Last edited by Barbie on Sun Jul 30, 2017 1:39 am, edited 1 time in total.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Invisible weapons in MH-Treasure2DXfixed

Post by sektor2111 »

I think I did white hair talking about monster dropping invisible weapons and how this problem can be solved... not only Skaarj have this issue that needs fixed - I was speaking about ScriptedPawn generally...

I gotta admit some coders were forcing a "fix" but they were doing bad things.

Edit:
After a bit of research I think those troopers are calling "init" functions twice. Because I've done some fixes I see them holding weapons and... other copies spawned in their location... Eh "super.SetHome", "Super.BeginState" - actually they call again Trooper code but... everything is too fast causing a DOUBLE BUG, NONE of both spawned weapons are not visible ON-Line if player is picking them up :loool: because I have explained that in section with "monsters should not move before game-start" where nobody is taking in account what I'm saying - their loss...

Aside from armed monsters problem, that BT section is annoying but not that evil. The "cherry" is that stupid warp zone having a HOM Effect - even if the trash has in name the string "fixed".
I don't ask about stuff (ammo, armors, etc.) is just a dumb regen-type map...
User avatar
Barbie
Godlike
Posts: 2792
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Invisible weapons in MH-Treasure2DXfixed

Post by Barbie »

sektor2111 wrote:"super.SetHome", "Super.BeginState" - actually they call again Trooper code
Thanks for that hint, I didn't noticed that. So the following should do the trick?

Code: Select all

auto state Startup {

	function BeginState() {
		Super(SkaarjTrooper).BeginState();
	}

	// if I enable this, I get the compiler error:
	// "Unknown Function 'SetHome' in Class UnrealI.SkaarjTrooper'"
	//function SetHome() {
	//	Super(SkaarjTrooper).SetHome();
	//}
}
And I got really confused by the compiler error that function 'SetHome' was unknown. Maybe the syntax for overwriting and calling parent's state function is wrong?
sektor2111 wrote:The "cherry" is that stupid warp zone having a HOM Effect
That is already fixed in my version.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Invisible weapons in MH-Treasure2DXfixed

Post by sektor2111 »

Wrong, I said that IT IS already BEING called twice so they spawn 2 weapons and attempting a twice touch - and both of them are crapped up because are spawned Too EARLY. Yeah, that "coder" was pretty much clueless how does trooper work, but addicted to more brain-farts - let's do the error TWICE if once is not enough. If I will rewrite a fixed version of those pawns, I will remove that crapped duplicated code, they are Troopers and they already do spawn weapon, they don't even need that repeated "auto state" because it do happens already - and NOTHING is changed from original so my question is: For which purpose was duplicated ?

Code: Select all

class gunner expands Humangrant;
and the cake...

Code: Select all

class Humangrant expands SkaarjTrooper; //So we are doing again the stupid thing
LIKE I said, Drop them in "GameEnded" until game is being started - End of story.
As a note those pawns Could be direct child of ScriptedPawn and writing properly weaponry code rather that calling the default sh!t again. By example my NsMonster (troopers there) doesn't use any bIsPlayer as a master option - just as a backup and only if a weapon is in range to be touched else they will never spam crap with bIsPlayer stupidity.

Edit: Piece of stuff used by me for safety...

Code: Select all

function bool CheckReplacement( Actor Other, out byte bSuperRelevant)
{
	local Inventory Inv;
	local int i;
	local Pawn P;

	bSuperRelevant = 1;
	if ( Weapon(Other) != None && Weapon(Other).Instigator != None && Weapon(Other).Instigator.IsA('Pawn') ) //Make sure about when timer is sucky
	{
		P = Weapon(Other).Instigator;
		if ( P.Health > 0 && P.PlayerReplicationInfo == None )
			spawn (class'PawnControl',P,,P.Location); //Wait a bit to see what's the deal
	}
	if ( MH.bMegaSpeed && Other.bIsPawn && Pawn(Other).bIsPlayer )
	{
		Pawn(Other).GroundSpeed *= 1.4;
		Pawn(Other).WaterSpeed *= 1.4;
		Pawn(Other).AirSpeed *= 1.4;
		Pawn(Other).AccelRate *= 1.4;
	}
....
This is part of "MonsterBase" or such...
And the toy:

Code: Select all

class PawnControl expands Info;

var Pawn P;
var float Patience;

event PrebeginPlay()
{
}

event PostBeginPlay()
{
	Patience=0.15; //wait a bit to see what's the deal
}

function FinishWaiting()
{
	local Weapon W;

	if ( Pawn(Owner) != None && Pawn(Owner).Health > 0 )
		P = Pawn(Owner);

	if ( P == None || P.bDeleteMe || P.Health <= 0 )
	{
		Destroy();
		GoTo JL48;
	}

	if ( P != None && P.Weapon == None )
	{
		Foreach RadiusActors (class'Weapon',W,100,P.Location)
		{
			if ( W != None && W.Instigator == P )
			{
				W.BecomeItem(); // Do not mess anims
				P.AddInventory(W);
				W.GiveAmmo(P);
			}
		}
		P.SwitchToBestWeapon();
		P.bIsPlayer = False;
	}
JL48:
}

Auto State CheckAndGo
{
Begin:
	Sleep(Patience);
DoneWaiting:
	FinishWaiting();
	LifeSpan=0.1;
}
Yehaw!
The bug: Recommend breaking iterator at first weapon loaded ? Or allow all load ? Some "weapon holders" uses More than one weapon... so we might have multiple copies of such "helpers".
Higor
Godlike
Posts: 1866
Joined: Sun Mar 04, 2012 6:47 pm

Re: Invisible weapons in MH-Treasure2DXfixed

Post by Higor »

Proto build implements this fix in MonsterHunt package.
https://github.com/CacoFFF/MonsterHunt- ... terHunt.uc

Code: Select all

function bool PickupQuery( Pawn Other, Inventory item )
{
	local bool bResult;
	
	bResult = Super.PickupQuery( Other, Item);
	if ( bResult && Item.bAlwaysRelevant )
		Item.bAlwaysRelevant = false;
	return bResult;
}
Quoting another post:
ANY faulty mutator/mod/map can produce bAlwaysRelevant inventory that can be transferred onto the player, not just Skaarj drops, so this is a general purpose fix that produces the smallest possible overhead by patching the pickup event.
The deal with bAlwaysRelevant inventory is a UT post-v400 patch that optimized inventory replication for pickups, the rule/limitation added is very simple:
- If item is bAlwaysRelevant=True, it only tells player of appearance and location and completely skips UnrealScript replication blocs.
============
I've done a full stop during this month, and probably next one so don't expect MH news soon lol.
You should be able to implement this sort of fix into a mutator without using long loops, take it as homework.

TIP: If you check on players you'll fix the invisibility issue, if you check all pawns/events, you'll also prevent the server from replicating these weapons when held by the monsters saving you from used channels.
Either intercept pickup queries... or wait 0.1 second and find all 'Skaarj' pawns that own a bAlwaysRelevant weapon and set that to false.
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Invisible weapons in MH-Treasure2DXfixed

Post by sektor2111 »

So you say that by using this query thing, if you kill monster you will use properly his weapon without being invisible in HUD ? I'll wrote a small thing and testing in default MH. However preservation will stay because some Skaarj... still have problems randomly, those custom types...
EDIT
Test ended... Yes, they don't spawn bugged weapons by using this solution but they might have problems at holding them... I will use BOTH solutions...
Post Reply