spawning pawn fails on overlapping collision cylinder

Discussions about Coding and Scripting
User avatar
Barbie
Godlike
Posts: 2807
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

spawning pawn fails on overlapping collision cylinder

Post by Barbie »

I've subclassed some ScriptedPawns to correct some errors there and the mutator replaces them with CheckReplacement(). This works fine except some cases where I think that overlapping collision cylinder is the reason for failing spawning the new class Actors.

I use this in CheckReplacement() for detecting the pawn, here for example Cow and BabyCow:

Code: Select all

function bool CheckReplacementScriptedPawn(ScriptedPawn SP) {
local ScriptedPawn NewSP;
local TCollisionFlags OldCollisionFlags;

	NewSP = None;
...
	if (SP.Class == class'BabyCow')
		NewSP = ScriptedPawn(SpawnAndPasteActor(SP, CProjectPrefix $ BabyCowNew, OldCollisionFlags));
	else if (SP.Class == class'Cow')
		NewSP = ScriptedPawn(SpawnAndPasteActor(SP, CProjectPrefix $ CowNew, OldCollisionFlags));
	else if (SkaarjTrooper(SP) != None)
...

And this for spawning the new Pawn:

Code: Select all

function Actor SpawnAndPasteActor(actor Template, coerce string aClassName, out TCollisionFlags OldCollisionFlags) {
/******************************************************************************
Does nearly the same as *ReplaceWith* but returns the spawned Actor.
******************************************************************************/
local Actor A;
local class<Actor> aClass;
local bool bOldCollideActors, bOldBlockActors, bOldBlockPlayers;

	if ( Template.IsA('Inventory') && (Template.Location == vect(0,0,0)) )
		return None;
	aClass = class<Actor>(DynamicLoadObject(aClassName, class'Class'));
	if (aClass == None)
	{
		warn("class '" $ aClassName $ "' could not be loaded.");
		return None;
	}
	else
	{
		OldCollisionFlags.bCollideActors = Template.bCollideActors;
		OldCollisionFlags.bBlockActors = Template.bBlockActors;
		OldCollisionFlags.bBlockPlayers = Template.bBlockPlayers;
		class'UtilsSB'.static.SetCollisionEx(Template, false, false, false);
		A = Spawn(aClass, Template.Owner, Template.tag, Template.Location, Template.Rotation);
		if (A == None) // failed: issue a warning, restore old values and exit
		{
			warn("could not spawn" @ aClassName @ "for Template=\"" $ Template $ "\" at" @ Template.Location);
			Template.SetCollision(OldCollisionFlags.bCollideActors, OldCollisionFlags.bBlockActors, OldCollisionFlags.bBlockPlayers);
			return None;
		}
	}
...
An example can be MH-NaliVillage][.unr where the collision cylinder of Cow1 and BabyCow0 overlap:
ucc.init.log wrote:KHMBase MH-NaliVillage][.KHMBase0 (Function BarbiesWorld.KHMBase.SpawnAndPasteActor:0195) could not spawn BarbiesWorld.CowSB for Template="MH-NaliVillage][.Cow1" at -946.707764,-3269.600586,-223.899628
KHMBase MH-NaliVillage][.KHMBase0 (Function BarbiesWorld.KHMBase.SpawnAndPasteActor:0195) could not spawn BarbiesWorld.BabyCowSB for Template="MH-NaliVillage][.BabyCow0" at -1002.988831,-3309.318359,-239.899445
MH-NaliVillage][-Cows.jpg
MH-NaliVillage][-Cows.jpg (32.3 KiB) Viewed 3288 times
Cow0 is replaced without errors.

I tried the following:
  • setting CollisionRadius=0, CollisionHeight=0, bBlockActors=false, bBlockPlayers=false, bCollideActors=false, bCollideWorld=false for the new Cow
  • setting CollisionRadius=0, CollisionHeight=0 for the existing cow before spawning the new one
  • adding a small z-axes offset to the location for the new cow (avoiding pivot points at the same location)
  • destroying the old cow before spawning the new one
but all without success.

I cannot understand why it is not possible to spawn an Actor at any place (even in the void) if it does not interact with anything in the world by setting all collision properties to 0/false?
PS - FYI the code of the new Cow

Code: Select all

class CowSB extends Cow;

function PostBeginPlay() {
local bool OldbHasBaby;

	OldbHasBaby = bHasBaby;
	bHasBaby = false; // avoid spawning a BabyCow in parent class
	Super.PostBeginPlay();
	bHasBaby = OldbHasBaby;

	// now add the new baby class, if *bHasBaby*:
	if (bHasBaby) //add baby
	{
		Destination = Location;
		baby = Spawn(class'BabyCowSB',,, Location + vector(Rotation) * 1.5 * CollisionRadius);
		if (baby != None)
			baby.mom = self;
	}
}


state Grazing {

	function EndState() {
	/**************************************************************************
	BabyCowSB MH-NekonekoHouse.BabyCowSB1 (Function UnrealShare.Cow.Grazing.EndState:0009) Accessed None
	**************************************************************************/

		if (Enemy != None && Enemy.bIsPlayer) // added "Enemy != None"
			MakeNoise(1.0);
		JumpZ = Default.JumpZ;
		bAvoidLedges = false;
		MinHitWall = Default.MinHitWall;
	}
}


defaultproperties {
	MenuName="Cow"
}
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
MrLoathsome
Inhuman
Posts: 958
Joined: Wed Mar 31, 2010 9:02 pm
Personal rank: I am quite rank.
Location: MrLoathsome fell out of the world!

Re: spawning pawn fails on overlapping collision cylinder

Post by MrLoathsome »

I think I have tried all that as well in the past.

This is one of the main reasons why the code for the SwarmSpawner is the way it is.
Should be getting back to looking at the v.2 final on that soon, and may try out a few ideas
in this area. (They probably won't work..... :omfg: )

*Edit: Good fix on that cow error.
I have bypassed that error before, by just setting the cow to a state other than 'Grazing' when it is spawned.
blarg
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: spawning pawn fails on overlapping collision cylinder

Post by sektor2111 »

Not an answer. BabyCow added separate in map intend to follow "MOM" and they just follow Accessed Nones - is mapping stupidity. Player sooner or later scares BabyCow and this stupid thing will call nothings in server.

Okay, spawning. Some spawning + timing related, boosted or slowed by your timers/processes make things a bit different. Who initializes first Mod or Cow ?
If Cow, take in account that bCollideworld=False return a fall out and/or not spawning/living anything. ENGINE is not interested to spawn pawn actors in Void because doesn't make sense.
The rest are BAD moves. Old pawn collides Actors around, it should be disabled from collision first before spawning a new one.

Last time I went to other way. Spawn a tool owner by Monster from map. Copy data from monster, destroy it, wait a tick (or many ticks), spawn a new one and assign properties from old monster. Else, don't destroy old monster, disable collision, try to spawn replacement, wait, if replacement is not there put back collision for Old monster. It is advisable to have a monster because if you lose them you will lose their Events. If new monster spawned copy data from old monster and then destroy original or let Engine to handle that VIA a short LifeSpan.

Some hint:
Not always healthy but... depending or how much is map loaded you might proceed in "fixing" placement. Call SetLocation for monsters in Level with 1 UU up and 1 UU back down around controller's PostbeginPlay - not very early. I never tried this at 1000+ creatures. This relocation helped me with bad colliding actors to prevent some "fall out..." problems. They might get a smooth adjusted position.

Debugging problem depends on mod, simple logs are recommended. New actor spawned properly ? Where ? The same as old pawn ? Old Pawn has cylinder straggled in walls ? Perhaps new one will not be glad about that. If Engine has no valid place for it, won't spawn. If new pawn has no world collision, pawn "soon" will fall out, spawn and die instantly.
MrLoathsome
Inhuman
Posts: 958
Joined: Wed Mar 31, 2010 9:02 pm
Personal rank: I am quite rank.
Location: MrLoathsome fell out of the world!

Re: spawning pawn fails on overlapping collision cylinder

Post by MrLoathsome »

You guys should check out the source for the new SpecStart v1.0 thingy I just posted.
(The wacky stuff I am doing with Tick() there might be adaptable to something like a Map Tweaker....)

If you have the bCowSpec mode turned on, it spawns a Playerpawn, a Babycow and a Book all in the same
location at the same time. (Collision off on all of course.) Seems to be working....

And also, How the hell are both of you looking at BabyCows the same week as I am using it in my new thingy? :wtf:

Do you have keyloggers installed on my PC? Should I run a scan? :mrgreen:

*Edit: Timing is EVERYTHING. The order in which things happen is ALSO everything. Think about it..... :loool:
blarg
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: spawning pawn fails on overlapping collision cylinder

Post by sektor2111 »

Barbie debated this, actually I don't have more headaches with my replacements (once - beta code - even I got 2 in 1 monsters). The only trouble maker is a small box where monster has been manually pushed with Editor. I found such works where monster cannot even "breath" properly. As for the rest of collision screwed I don't get why the fk they do changes in maps about things which they don't know a sh!t about. Usually trying to do some cool stunt, results in a trash.

Aside with these "spawn/move" I was planing a Level with something dynamic: find a book with an incantation for opening arena's door. You'll say that is not really a secret after playing it a few times... oh well, the book will not be in the same place, of course Bot will always find it... I think I can do these after my experience with "replacements/collisions" which I have at this moment. The only problem is my low skill with Level design and I don't see anyone willing for a team-work...
MrLoathsome
Inhuman
Posts: 958
Joined: Wed Mar 31, 2010 9:02 pm
Personal rank: I am quite rank.
Location: MrLoathsome fell out of the world!

Re: spawning pawn fails on overlapping collision cylinder

Post by MrLoathsome »

Barbie. Were you changing any physics settings while testing this? Were you testing only offline or both on and offline?

I have noticed that the key here, is to set the actors physics to None BEFORE any changes to collision stuff.
i.e.

Code: Select all

MyMooMoo.SetPhysics(PHYS_None);
Another consideration if you are testing both on and offline, is timing issues.

The issues I noticed last night with the bCowSpec option on in that new mutator NEVER happened
once in any offline testing. Think my plan to delay the spawns of multiple pawns in the same location by
one tick each might allow all the various settings for the previous pawn to be fully applied before the next one
is spawned.

Will be testing that some here in the next day or 3 I think.

@Sector. I had a 3 in 1 cow for a while last night. It was cool. When standing still, it looked like 1 cow with 3 heads and 3 tails.
Not efficient, but interesting.
Also, by setting the BabyCow to a state other than 'Grazing', you bypass any dependency's on 'Mom', and eliminate that final EndState error.
Seems to work well. At least for what I am messing with now... If you find them returning to 'Grazing' state for some reason, you will
need to make a new BabyCow, like Barbie did above to fix the issues in 'Grazing' for the Cow.
blarg
User avatar
Barbie
Godlike
Posts: 2807
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: spawning pawn fails on overlapping collision cylinder

Post by Barbie »

MrLoathsome wrote:Were you changing any physics settings while testing this?
Yep, I tried with setting it to PHYS_None before doing anything else but without success spawning the new Actor. I also tried it with bCollideWhenPlacing=false, bCollideWorld=false in CowSB default properties.
MrLoathsome wrote:Were you testing only offline or both on and offline?
I've never run my mutator offline - maybe I should try that.^^
MrLoathsome wrote:timing issues
Indeed! And I think you cannot compare the spawn process 1:1 if it is either done in a (state|timer|tick) function or in a (CheckReplacement|IsRelevant|AlwaysKeep) function, because the Actors initialisation states might be different - the functions in the second group are called very early in an Actor's spawning process. In case of replacing additionally the properties of the old actor have to be copied to the new one, and so both the old and new Actor have to be accessible at the same time.

Another wired thing that has come to my mind concerning timing: according to the log (see below) the engine's order of spawning is: Cow0, Cow1 and BabyCow0. So why does Cow1 collide with BabyCow0 which does not yet exist at this moment? :omfg:

Based on the description in the wiki here a summary of the Actor's creating event chain:
  1. Engine checks and settings
  2. NewActor.Spawned()
  3. NewActor.PreBeginPlay()
  4. GameInfo.IsRelevant()
  5. Mutator.AlwaysKeep() chain
  6. Mutator.IsRelevant() chain
  7. NewActor.BeginPlay()
  8. NewActor.PostBeginPlay()
  9. NewActor.SetInitialState()
  10. NewActor.PostNetBeginPlay()
To investigate that deeper, I've caught all initialization events in the Cow (but not in the BabyCow) and I also put some debugging info into the Mutator's CheckReplacement() process. Then my log tells the following:
// Incoming Cow0:
MH-NaliVillage][.KHMBase0.CheckReplacementScriptedPawn DEBUG: replacement check for ScriptedPawn=MH-NaliVillage][.Cow0
MH-NaliVillage][.CowSB0 DEBUG: event Spawned done, bDeleteMe=False
MH-NaliVillage][.KHMBase0.CheckReplacementScriptedPawn DEBUG: replacement check for ScriptedPawn=MH-NaliVillage][.CowSB0
MH-NaliVillage][.KHMBase0.CheckReplacementScriptedPawn DEBUG: not replacing ScriptedPawn=MH-NaliVillage][.CowSB0
MH-NaliVillage][.CowSB0 DEBUG: event PreBeginPlay done, bDeleteMe=False
MH-NaliVillage][.CowSB0 DEBUG: event BeginPlay done, bDeleteMe=False
MH-NaliVillage][.CowSB0 DEBUG: event PostBeginPlay done, bDeleteMe=False
MH-NaliVillage][.CowSB0 DEBUG: event SetInitialState start, bDeleteMe=False
MH-NaliVillage][.CowSB0 DEBUG: event SetInitialState done, bDeleteMe=False
// Until here Cow0 was replaced successfully. Next is Cow1:
MH-NaliVillage][.KHMBase0.CheckReplacementScriptedPawn DEBUG: replacement check for ScriptedPawn=MH-NaliVillage][.Cow1
// Cow1 has to be replaced, and spawn() is called in Mutator's CheckReplacement()
MH-NaliVillage][.CowSB1 DEBUG: event Spawned done, bDeleteMe=False
// very strange: the new Cow "CowSB1" does in fact exist now in the world...
MH-NaliVillage][.KHMBase0.CheckReplacementScriptedPawn DEBUG: replacement check for ScriptedPawn=MH-NaliVillage][.CowSB1
MH-NaliVillage][.KHMBase0.CheckReplacementScriptedPawn DEBUG: not replacing ScriptedPawn=MH-NaliVillage][.CowSB1
// my Mutator does not touch Actors of class'CowSB'
MH-NaliVillage][.CowSB1 DEBUG: event PreBeginPlay done, bDeleteMe=False
MH-NaliVillage][.CowSB1 DEBUG: event BeginPlay done, bDeleteMe=False
MH-NaliVillage][.CowSB1 DEBUG: event PostBeginPlay done, bDeleteMe=False
// Huh? SetInitialState is missing?
KHMBase MH-NaliVillage][.KHMBase0 (Function BarbiesWorld.KHMBase.SpawnAndPasteActor:0191) could not spawn BarbiesWorld.CowSB for Template="MH-NaliVillage][.Cow1" at -946.707764,-3269.600586,-223.899628
// ... but "CowSB1" never reaches the end of Mutator's CheckReplacement()-spawn
MH-NaliVillage][.KHMBase0.CheckReplacementScriptedPawn DEBUG: not replacing ScriptedPawn=MH-NaliVillage][.Cow1
MH-NaliVillage][.KHMBase0.CheckReplacementScriptedPawn DEBUG: replacement check for ScriptedPawn=MH-NaliVillage][.BabyCow0
MH-NaliVillage][.KHMBase0.CheckReplacementScriptedPawn DEBUG: replacement check for ScriptedPawn=MH-NaliVillage][.BabyCowSB0
MH-NaliVillage][.KHMBase0.CheckReplacementScriptedPawn DEBUG: not replacing ScriptedPawn=MH-NaliVillage][.BabyCowSB0
KHMBase MH-NaliVillage][.KHMBase0 (Function BarbiesWorld.KHMBase.SpawnAndPasteActor:0191) could not spawn BarbiesWorld.BabyCowSB for Template="MH-NaliVillage][.BabyCow0" at -1002.988831,-3309.318359,-239.899445
MH-NaliVillage][.KHMBase0.CheckReplacementScriptedPawn DEBUG: not replacing ScriptedPawn=MH-NaliVillage][.BabyCow0
MH-NaliVillage][.CowSB0 DEBUG: touch with MH-NaliVillage][.NaliFruitSB6
So something happened there in Cow1.PostBeginPlay(). I followed the PostBeginPlay-chain CowSB>Cow>ScriptedPawn>Pawn>Actor (red classes have no PostBeginPlay code), but did not find anything that rejects Actor's spawn. :noidea
<EDIT>
To verify that the problem consist in overlapping collision cylinder I've just modified the map by moving that BabyCow0 in xy-plane so that the collision cylinder do not overlap any more - the replacement is successfully done then.
</EDIT>
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: spawning pawn fails on overlapping collision cylinder

Post by sektor2111 »

If it's that map with those cows almost suffocated in that "cage" I wouldn't take spawning new in account. However only looking at mutator sequences, things might be clarified. Then... I would copy Cow-BabyCow originals as they are but adding full logs. Then making a map modification with new stuff. After starting map, just close game and see logs, that's the real chain of events.

Okay, what I'll do. Perhaps your SB stuff has to be 1,1 at collision and 0.1 DrawScale. At replacing procedure just record all data from old creature and spawn your tiny thing. Once spawned, "Grow it" after 50-80 milliseconds. If still doesn't spawn I'll be interested to attack other spawn type (decoration, etc) in that location. My way is simple, hunting timing is waste of time, each Level has a more or less load and all these won't work in the same way. I would wait a bit then attack bad stuff. Not a single time my mission was successful with patience rather than trying "the proper timing". How do works my MHReplacer at this moment:
- Wait 0.3 seconds (allow monsters to get all physics and properties);
- Spawn a monster-tracker for each monster separate - owned by monster and addressing it with no iterations;
- tracker does a primary copy using internal values as monster's ones;
- Tracker waits a bit again in order to check if creature was intended to hold a weapon;
- Remove collision and wait a bit again (if needs);
- Spawn the new dude, put properties and for some of them they might go at class before to spawn it - EDIT: AND REMOVE COLLISION FOR IT;
- Once done set properties and a small pause (imagine even a tick these pauses) check if an evil thing did not rammed our new guy - and weapon must be also there;
- if the new guy is there set a lifespan for old creature;
- Tracker will self destruct.
Actually each creature is debated separate by that "tracker" and not a single mod doing all changes. Why ? Because I don't want to iterate a bunch of times through that creature-soup which would be created at a moment. Also they have logs according to replacement operations if something went nasty. In such case I won't try to replace crap anymore.
"Slow way" was solution for some MapVote as well in order to prevent recursive crashing. Rushing these won't help.
Let's say that my replacements takes 1-2 seconds which is not bad after all, and they do happen after all Pre/Post Begins possible. Just let engine to breath and see what it does. Using "delayed" solution you are ok even with pawns bGameRelevant and such. I quit idea to track events at spawning actor. I let it breath a moment and I kill it AFTER.
Last edited by sektor2111 on Wed Jun 29, 2016 6:24 am, edited 1 time in total.
User avatar
Barbie
Godlike
Posts: 2807
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: spawning pawn fails on overlapping collision cylinder

Post by Barbie »

sektor2111 wrote:If it's that map with those cows almost suffocated in that "cage" I wouldn't take spawning new in account.
I remember that there is a MH map where some Cows are in a small cave like modern intensive animal farming. But this map has enough space for it; I also reduced the map to the core of the problem:
TestReplacement.jpg
The attached 7Z archive contains the two maps "TestReplacementWorks.unr" and "TestReplacementFails.unr". The only difference beside TimeSeconds and AIProfile is that I moved BabyCow0 until collision cylinder do not overlap any more:
TestReplacementFails.t3d wrote:Begin Actor Class=BabyCow Name=BabyCow0
Location=(X=-1002.988831,Y=-3309.318359,Z=-239.899445)
TestReplacementWorks.t3d wrote:Begin Actor Class=BabyCow Name=BabyCow0
Location=(X=-1005.945618,Y=-3312.645020,Z=-239.899445)
Attachments
TestReplacement.7z
(2.96 KiB) Downloaded 59 times
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: spawning pawn fails on overlapping collision cylinder

Post by sektor2111 »

On a note I HAVE done monster replacements even for 2 in 1 monsters placed into each-other. You are doing something wrong at creature's collision, there are hundreds of maps with bad placed creatures.

Let me see why. New dude spawned for first cow gets collision too EARLY. The second new dude won't spawn because of the first one. Your first new monster blocks the second new one, there is nothing to to with old cows. You can delay collision for new creatures until match is started, else their collision doesn't make sense before that.
So let's recall title doing a fine tuning
Do not forget to remove collision for everything until replacements from overlapping cylinders are entirely done.
As for the rest I'm not digging into my codes again since this problem doesn't exist in my mod. I'm not replacing cows but see gasbags...
MrLoathsome
Inhuman
Posts: 958
Joined: Wed Mar 31, 2010 9:02 pm
Personal rank: I am quite rank.
Location: MrLoathsome fell out of the world!

Re: spawning pawn fails on overlapping collision cylinder

Post by MrLoathsome »

Yes indeed. Any actor class it should be the same I think. In the experimental bCowSpec option in SpecStart, I have a playerpawn, babycow and book all involved and
most of the time it works..... If any delay is needed, it would just be needed when running on a server.

Cows/Babycows are just a good test class. And everybody loves cows. They are tasty little bastards.

Discovered this evening the issue with the cows/books failing seemingly randomly online in SpecStart is due to something that is probably not at all
related to collision issues. It is not random. It is a glitch. I will track it down.

I suspect we might all be overthinking this. And perhaps we are not on the same exact page.

After re-reading the thread, it seems this problem could be fixed by just adjusting the positions of the actors on the map a bit?
All my experience in spawning pawns has been via mutators. Adding pawns to maps either after they are loaded or in real time when things
are moving all over etc.

If you are talking about stuff that is in the map itself, why not just move it a bit?

I don't know nothing about no maps, but if default actors that are placed in the map itself are causing issues like this, then that map is defective.
It needs an adjustment and a new version released or something.
There are a lot of things a Map Fix mutator might adjust, but I don't think this is one of them.

*Disclaimer. I don't know nothing about no maps.

**Edit: Or maybe you just need a delay between the destruction of the existing cows, and your attempt to replace them.....?
blarg
User avatar
Barbie
Godlike
Posts: 2807
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: spawning pawn fails on overlapping collision cylinder

Post by Barbie »

Thanks for interest. My problem is not correcting the cows in that map. I could easily solve that by patching at run time or editing map. And the problem is not only related to cows but to other ScriptedPawns, too.
I want to know why that new spawned Actor runs through the initialization events including PostBeginPlay() but never reaches SetInitialState() and is destroyed for unknown reasons within the spawn process. I want to know what happens there behind the curtains.
sektor2111 wrote:You are doing something wrong at creature's collision, there are hundreds of maps with bad placed creatures.
Usually there is no problem with replacing in CheckReplacement(). But in seldom cases I got the error that the replacement of a ScriptedPawn could not have been done. And in all of these cases the replacement Actor is a subclass of the original one only differing in code, not in size or collision properties.
If you have a look at the CheckReplacement() code given in first post, you'll see that bCollideActors, bBlockActors, bBlockPlayers of the existing Actor is set to FALSE before the new gets spawned. And as I wrote below there, spawning does not even work, if the default properties of the new Actor are CollisionRadius=0, CollisionHeight=0, bBlockActors=false, bBlockPlayers=false, bCollideActors=false, bCollideWorld=false.
sektor2111 wrote:there is nothing to to with old cows
I tried that (if I understood you right): I removed Cow0 from the map so that the first replacement is the one with overlapping collision cylinder. Replacement fails then, too. I even tried that with a map from the scratch: If the collision cylinder overlaps, replacement fails.
MrLoathsome wrote:it seems this problem could be fixed by just adjusting the positions of the actors on the map a bit? [...] then that map is defective.
As I wrote above, I could repair the map. But that does not answer my question.^^
MrLoathsome wrote:Or maybe you just need a delay between the destruction of the existing cows, and your attempt to replace them
Because I want to copy the properties of the old to the new Actor, the simplest solution would be if both exist at the same time. If I destroy the original before spawning the replacement, I have to store the properties in a way and that makes things even more complicated.

Some more tests have shown: I can replace the Cows for example by "Engine.Trigger", "UnrealShare.Book", "BotPack.U", but not with for example "UnrealI.Pupae" or "UnrealShare.Fly" although they have a smaller collision radius and height.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: spawning pawn fails on overlapping collision cylinder

Post by sektor2111 »

Barbie wrote:Because I want to copy the properties of the old to the new Actor, the simplest solution would be if both exist at the same time. If I destroy the original before spawning the replacement, I have to store the properties in a way and that makes things even more complicated.
Not necessary, replacer has 2 main classes; Initializer assigning actor to pawn from Level and attacking factories; then the second class - it's working with delay alone and slow, while Auto States are done new stuff will get ready for hunt. Then monsters which I have in MH2 are "sleeping" until game is started, if not, they stay sleeping, no skaarj weapon spawned, no patrols, no nothing. Second actor owned by old monster has nothing else to do than copying testing waiting spawning etc. If job has been done, good bye...

For a constant tracking and team related things monsters used by me have a tiny light around them - in this way I can see if replacements have failed or not. Using delay strategy seems a good thing. All spawned creatures have collision removed instantly in order to release place for others placed in cylinder.
But you were triggering my curiosity for a "relocation" tweak in order to gain separate cylinders. Of course I'm expecting a game-crash but I think it worth trying. If won't crash I think I have chances to save from "fall" a couple of dumb placed ones, and I'm saying this because in one of maps with initially 545 creatures I got at starting game 549 - more to hunt, I can say that I was saving 4 pieces against getting lost. The rest of stuff placed at 1000 UU far from any valid zone there is not much hope - R.I.P. in void, monster...
The problem which I have to solve at my replacer is weaponry deal... no is not about unarmed Skaarj, is about over-armed. Properties for class might get screwed and I can figure my replaced Skaarj dropping 2 different weapons when they die, depending on how many are in map and how they are armed. Issue similar to SwarmSpawn when are debated default class properties. But... this is solvable using other trick which I don't have a good disposition to do at this moment.
Keeping tracker until game starts, wait weaponry, spawn weapon class, destroy original and moster, spawn new empty monster which will grab the closer weapon available (new skaarj are not kidding at weapons), and stuff will look perfectly original.

Here is an example of a server-side thing doing replacements:
[attachment=0]MHReplacer_Resources.zip[/attachment]
Attachments
MHReplacer_Resources.zip
(8.41 KiB) Downloaded 57 times
User avatar
Barbie
Godlike
Posts: 2807
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: spawning pawn fails on overlapping collision cylinder

Post by Barbie »

Some news here (if I were able to read it would had helped):
wiki wrote:In UnrealScript there is the EncroachingOn() event which returns whether the overlapping collision hulls with another actor actually needs to be handled [...] The newly spawned actor will be destroyed if other colliding actors detect encroachment with this actor.
(source)
My first idea was adding this piece of code in every Actor that has to be spawned by Mutator:

Code: Select all

event bool EncroachingOn(Actor Other) {
	if (bScriptInitialized)
		return Super.EncroachingOn(Other);
	else
		return false; // disable during spawning
}
But unfortunately EncroachedBy() is called for the existing Pawn resulting in destroying that one. :x
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: spawning pawn fails on overlapping collision cylinder

Post by sektor2111 »

Did you forgot about how do works SpawnPoint right now ? The only stupid encroachment is done by Queen which also is not well known like :omfg: .
Code above did not failed me that much and also disabling collision for NEW creatures will prevent nasty things for next ones. I'm sorry if this basic logic is that hard.
Post Reply