Avoid teleporting of Queens

Discussions about Coding and Scripting
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Avoid teleporting of Queens

Post by JackGriffin »

That's all way too much work for a simple state check on a handful of monsters (at most). The longer I mess around in uscript the more I think that alterations instead of checkreplacements is just overall better when it's a feasible alternative. Move the queens out of the state(s) you don't want and it's done. I've tested StopYourFighting with hundreds of monsters at once online and it was fine...although it was quite weird to walk among them and the monsters just turned to look at me then go back to random animation/patrol.

KISS.
So long, and thanks for all the fish
User avatar
Barbie
Godlike
Posts: 2792
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Avoid teleporting of Queens

Post by Barbie »

JackGriffin wrote:That's all way too much work for a simple state check on a handful of monsters (at most).
That was not the main point for me for this mutator. Instead it was avoiding telefragging just spawned Queens themselves when they are introduced by a factory. Because their event is not processed correctly in such a case, counters do not count, and maps like EnterToCore get stuck on that point.
Aldebaran wrote:Perhaps someone else can give it a try and have a look into his log file? Perhaps my Monster Hunt Mod with customized CheckReplacement function in MH2Base.uc is the reason?
I did the work and got MonsterHunt2Gold ready to run - and now look at this snippet from MH2Base.uc:

Code: Select all

simulated function bool AlwaysKeep(Actor Other) {
	if(Other.IsA('ScriptedPawn')) return true;  //ADD
	...
If the function AlwaysKeep() returns TRUE, neither IsRelevant() nor CheckReplacement() of this or further Mutators are called. So no ScriptedPawns are passed to other mutators.
The original MonsterHunt code of package "Monsterhunt.u" is not better (here the BaseMutator is called "MonsterBase"):

Code: Select all

function bool AlwaysKeep(Actor Other) {
	local bool bTemp;

	if ( Other.IsA('ScriptedPawn') )
	{
		if (ScriptedPawn(Other).Shadow == None)
			MonsterHunt(Level.Game).SetPawnDifficulty(MonsterHunt(Level.Game).MonsterSkill, ScriptedPawn(Other));
		return true;
	}
	...
I cannot see any sense in returning the value TRUE.

What to do now? If you have a customized version of MonsterHunt, just remove that "return true;". For users who will/can not recompile the MonsterHunt code, I am thinking of a modification of my Mutator: Additionally replace the queens (and other Pawns given in the INI file) in a loop in my Mutator's PostBeginPlay() function or in a state.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
Aldebaran
Masterful
Posts: 672
Joined: Thu Jan 28, 2016 7:30 pm

Re: Avoid teleporting of Queens

Post by Aldebaran »

I can modify the Monster Hunt 2 Gold code but it uses the original MonsterHunt.u which I don't want to touch because of file mismatches.
Would it suffice to comment the "if(Other.IsA('ScriptedPawn')) return true;" line out in Monster Hunt 2 Gold?
User avatar
Barbie
Godlike
Posts: 2792
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Avoid teleporting of Queens

Post by Barbie »

Aldebaran wrote:Would it suffice to comment the "if(Other.IsA('ScriptedPawn')) return true;" line out in Monster Hunt 2 Gold?
That is what I wanted to say with above. 8)
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
Aldebaran
Masterful
Posts: 672
Joined: Thu Jan 28, 2016 7:30 pm

Re: Avoid teleporting of Queens

Post by Aldebaran »

Thank you, Barbie!

Log shows now these additional lines:

Code: Select all

ScriptLog: 2018-10-06 00:02:44 MH-Tomoko.QueenSaver0.MayTreatThisActor LOG_Debug: returns TRUE for Queen0
ScriptLog: 2018-10-06 00:02:44 MH-Tomoko.QueenSaver0.SpawnActor LOG_Verbose: spawned MH-Tomoko.QueenFixed0 at location 7984.000000,-14976.000000,-4368.000000
ScriptLog: 2018-10-06 00:02:44 MH-Tomoko.QueenSaver0.QueenDestsHave LOG_Debug: check for QueenDests results in False
ScriptLog: 2018-10-06 00:02:44 MH-Tomoko.QueenSaver0.CheckReplacement LOG_Debug: MH-Tomoko.QueenFixed0  has default DrawScale, therefore collision cylinder not changed
ScriptLog: 2018-10-06 00:02:44 MH-Tomoko.QueenSaver0.CheckReplacement LOG_Info: replaced MH-Tomoko.Queen0 with MH-Tomoko.QueenFixed0
Hopefully the deactivation of the one line in Monster Hunt 2 Gold will have no bad effects. Anyway I have built in a bool variable so I can re-activate it with ini configuration.
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Avoid teleporting of Queens

Post by JackGriffin »

It's been too long and I just didn't place script notes in along the way like I should have but I'm sure I added that AlwaysKeep for a reason (hence the "add" note). Let me know what ends up broken now, I'm interested.

...IIRC it was something to do with the inventory of some monsters being destroyed. Dropped Skaarj weapons being buggy? IDK. Still there's been a ton of monster replacements done on this MH version without an issue before. Why is your method failing? What could I have done better?
So long, and thanks for all the fish
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Avoid teleporting of Queens

Post by sektor2111 »

Barbie wrote:
Aldebaran wrote:Would it suffice to comment the "if(Other.IsA('ScriptedPawn')) return true;" line out in Monster Hunt 2 Gold?
That is what I wanted to say with above. 8)
Is this year 2008 somehow or I'm "LostInTime" ?
Aldebaran wrote: Hopefully the deactivation of the one line in Monster Hunt 2 Gold will have no bad effects.
:loool: Cough
I wouldn't count on hopes here because that one has a logic and YES, it will have some "effects", unless you want missing monsters to break maps because... without relevance check you'll have the same surprise as in old times.
Test: Start Map Arden+fix1 in original MonsterHunt and then your MH2 like (or MH2v3) without AlwaysKeep - count monsters in both of them - an evidence about Not Having All monsters in maps and messing counters and all that triggering chain in other maps where these creatures are critical.
One reason for some maps released as fix74++ was exactly this problem, so excuse me but I won't use any of "solutions" debated here - it's more simple to have a default queen acting properly rather than breaking maps...
Firing a forced replacer won't cost a penny, why you guys do you need the flawed solution all time ? You'd better add/move that line in CheckReplacement after replacing Queen if you are still addicted to CheckReplacement rule.
User avatar
Barbie
Godlike
Posts: 2792
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Avoid teleporting of Queens

Post by Barbie »

JackGriffin wrote:Let me know what ends up broken now, I'm interested.
That was one of the first things I changed in my customized version of MonsterHunt: putting that line away and have the monster tweaks in function CheckReplacement() in BaseMutator instead that hack in AlwaysKeep() together with Monster's shadow misused as a boolean flag and a periodical (!) check in Timer(). Maybe Shrimp thought that monsters have to be always kept (-> "AlwaysKeep") in a MonsterHunt game... No other reason for this comes into my mind.
JackGriffin wrote:Dropped Skaarj weapons being buggy?
No.
JackGriffin wrote:Still there's been a ton of monster replacements done on this MH version without an issue before.
Have you an example for this? Of course I can just run an iterator over all pawns and manipulate them. This will work without CheckReplacement(). Another approach is using CheckReplacement() for this, and that does not work if ScriptedPawns are not passed to that function.
JackGriffin wrote:Why is your method failing?
Hmm, isn't it stated clearly in my above postings? I could only repeat what I've written there.
sektor2111 wrote:Test: Start Map Arden+fix1 in original MonsterHunt and then your MH2 like (or MH2v3) without AlwaysKeep - count monsters in both of them
On both I got 171 - is that wrong?
sektor2111 wrote:an evidence about Not Having All monsters in maps and messing counters and all that triggering chain in other maps where these creatures are critical.
Either you or me didn't get the point: if Queens are spawned by a factory and have to trigger a counter, this does not work for stock queen. Ask Mars007 for his test map and run it with and without my mutator... This was my main motivation to code this.
sektor2111 wrote:so excuse me but I won't use any of "solutions" debated here
Noone is forced to use that mutator. In opposite, it was already successfully running on my server, and a user asked me to have this as a mutator. So I sit down for several hours and packed the existing code into an Mutator even with a extensive documentation - just for others, not for me.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
Aldebaran
Masterful
Posts: 672
Joined: Thu Jan 28, 2016 7:30 pm

Re: Avoid teleporting of Queens

Post by Aldebaran »

These Queens killing each other and make a counter mess really should be replaced with better ones. So I think this mutator is an enrichment.

The counter shows here 168 monsters in MH-Arden-Fix1 right from start and 250 monsters in total with creature factories by script. I have only commented out the one line in function AlwaysKeep in MH2Gold.
Without that code change I have 171 monsters at start.
I played a few smaller maps today and the hole Arden map with no further issues.
Sektor2111 wrote:You'd better add/move that line in CheckReplacement after replacing Queen if you are still addicted to CheckReplacement rule.
Would be that a solution in my situation? I am not sure what you mean, I would be thankful for more details how to code this.
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Avoid teleporting of Queens

Post by sektor2111 »

If you are using CheckReplacement as solution in first Line replace queen then call true and/set difficulty in next ones or do whatever stunts

IsA Queen and not a SBQueen replacewith SBQueen
IsA ScriptedPawn return True

Regarding to what you think in some maps action won't go that nice when creatures are missing. It's entirely pointless, we play MonsterHunt but we do not have monsters :noidea . Other creatures from Jurasik package won't exist if monster relevance is lost and hell knows how many are gone - and why these ? Because we cannot enforce ScriptedPawn True at tail of replacements ?

Code: Select all

If (Other.ISA('ScriptedPawn'))
{
	if ( Other.IsA('Queen') && !Other.ISA('SBQueen'))
	{
		ReplaceWithOther(....);
		return False;
	}
	return True; //LEAVE THEM ALIVE
}
To mention that ISA calls won't require dependendencies because it uses NAME/String not Class into code so you can happily attack all crap in this way.
Else, like I said, and I don't know if I have to post this over and over 100 times. A Monster can be replaced without any CheckReplacement and without to mess monsters, just wait a bit, loop through pawns, change them, change factory prototypes and/or MaxItems when Factory has Queen as item capping it to ONE per spawn.
By using a Brute-Force method you won't need to do changes to your MH controller, just use it as it is. I had a "monsterreplacer" used before XC ages which I used to replace all stock monsters and without to have missing monsters, even I saved some of them from death when mapper was messing up their location, replacement has spawned properly not like original one.
Doing deals with Monsters after game Initialization it's really nice. Today I wrote a sort of statue not like those shown in "advanced" HUDS and Bots bringing them to life due to borked MH code. Statue is completely frozen and comes to life ONLY when goes triggered - nothing will awake it too early and monster is nice, even SkaarjOfficer in original MH has weapon - LOL when comes from statue stage. I had a few troubles with this trooper but which I solved later. I have to say that Monster will support additional tweaking even after first second of game and no one will get hurt.

The default queen has a critical bug in state teleporting, if is dying telefraged by other Queen will ignore "died", if I recall correctly monster has to perform Event in that stage. In such case Event is gone/ignored - thanks to Epic. I f...ked that and my original queens have no issues - I should do that change months ago + I removed that stupid encroachment rule and... Queen is teleporting only if has a destination else won't telefrag anything, that was another dumb original move which I removed for fun :lol2: .

Now please excuse me, I gotta continue working at other MH stuff - it might help me when I'll move to some mapping task if a sudden inspiration will hit me at random...
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Avoid teleporting of Queens

Post by JackGriffin »

Ah yeah, thanks Nels. I remember why that was added now. We talked about this some years back, your discussion reminds me about it. I remember running the counting mod using the different configurations you suggested.
So long, and thanks for all the fish
Aldebaran
Masterful
Posts: 672
Joined: Thu Jan 28, 2016 7:30 pm

Re: Avoid teleporting of Queens

Post by Aldebaran »

Thank you Sektor2111 for the detailed instructions. So if I want to use CheckReplacements I have to copy the complete code of class SBQueenSaver (which is the mutator class from Barbie) into the Monster Hunt base mutator class (here MH2Base). This is much code but ok, perhaps it will work then. There is obviously no working way then to call the CheckReplacements function in the SBQueensaver mutator class.
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Avoid teleporting of Queens

Post by JackGriffin »

Alde, that's the essence of MH2. You have the freedom to do any of this easily. Change whatever you like. BTW I was reading earlier posts and you mentioned not being able to compile the original MH? Let's fix that.

Grab this zip:
backupMHforCompiling.7z
(403.97 KiB) Downloaded 51 times
Now for everyone grabbing this PLEASE take a moment and read the following. In fact if you offer this yourself you might add it to the text file in the zip as an explanation.

******************************************************
When Shrimp released monsterhunt he crippled one of the classes by not including the code. This prevented recompiling the code. He sent me the original though (shows it never hurts to ask) and I was able to recompile the mod. Since this makes 2 monsterhunt.u files with different checksums you will get version mismatch if you are not careful.

So how to use this? Well you swap out the monsterhunt.u file you play with and use the one marked for recompiling and then compile your mod that depends on mh. Once it's compiled you swap the normal one back into your system folder and it will all work. Easy stuff, just don't ever put the recompile on a server or in a map. PLEASE reread that last line and be sure to never do that. I've held back from wide release on this just to prevent version issues and I've only carefully sent this to people who understand.

Now you can compile anything that depends on MH and never have an issue. Enjoy.

-Kelly
*******************************************************

Oh, and I also included the source code to the unstripped u file too so you can have that also.
So long, and thanks for all the fish
User avatar
Barbie
Godlike
Posts: 2792
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Avoid teleporting of Queens

Post by Barbie »

Is there still interest for a version of SBQueenSaver that works together with MH versions that (mis)use the AlwaysKeep() function?
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Avoid teleporting of Queens

Post by JackGriffin »

Why the constant passive aggressive tone B? We are just having a simple discussion. Of course there's desire for your work. You are a good dude who does neat stuff. You could just stand to ease up some on the tone. Everyone makes mistakes. I'm a fucking mailman dude, not a computer programmer. Is it any surprise to anyone that I'll mess up? Mocking me for that is silly.
So long, and thanks for all the fish
Post Reply