Jump to content

Photo

[2.53] Raft script breaking when moved via script


  • Please log in to reply
3 replies to this topic

#1 Moosh

Moosh

    Tiny Little Questmaker

  • ZC Developers

Posted 26 March 2021 - 08:28 PM

I got a request to make an update to this script from the database to make it summonable via an item script, and suddenly after using the script, the FFC was no longer colliding properly with Link.

https://www.purezc.n...=scripts&id=137

 

Here's a test file with the item included:

https://www.mediafir...ftItem.qst/file

 

And a video of how to trigger the bug:

 

And the script itself:

Spoiler

 

I tried solving the problem with Dimi and Rob, but we couldn't find anything that should be causing the issue on my end. The FFC is in the same spot before and after, it's not ethereal, and its EffectWidth and EffectHeight are the same. The only difference is it's a different FFC slot being used before and after when the raft script is being recreated, though I see no reason that would affect collision. As far as I can tell this seems to be a bug.

 

If anyone has any idea what's going on here I'd love to know. Apologies if it turns out this isn't an engine bug. The behavior seems to be the same between all versions, but this collision is wack and inconsistent.



#2 Moosh

Moosh

    Tiny Little Questmaker

  • ZC Developers

Posted 28 March 2021 - 08:24 AM

Did some more testing and I think I know what's causing the bug. 

				for(int i=1; i<=32; ++i){
					ffc f = Screen->LoadFFC(i);
					if(f->Script==raftSlot){
						f->Script = 0;
						f->Data = 0;
						
						lweapon spawn = CreateLWeaponAt(LW_SCRIPT10, f->X, f->Y);
						spawn->UseSprite(22);
						spawn->NumFrames = 3;
						spawn->ASpeed = 3;
						spawn->DeadState = spawn->NumFrames*spawn->ASpeed;
						spawn->CollDetection = false;
					}
				}
				

When the item script is clearing all the existing rafts, it clears Data and Script but not X and Y. Presumably when Data is 0 the FFC is considered invalid and indeed it doesn't cover up the water under it or anything when I try walking over it. But when the new raft FFC (32) is in the same position as the old one (1) with Data of 0, that's when the collision goes funky. I'm betting it has something to do with some FFC collision priority system not factoring in cases where Data is 0.



#3 Deedee

Deedee

    Bug Frog Dragon Girl

  • Moderators
  • Real Name:Deedee
  • Pronouns:She / Her, They / Them
  • Location:Canada

Posted 28 March 2021 - 11:44 PM

Did some more testing and I think I know what's causing the bug. 

				for(int i=1; i<=32; ++i){
					ffc f = Screen->LoadFFC(i);
					if(f->Script==raftSlot){
						f->Script = 0;
						f->Data = 0;
						
						lweapon spawn = CreateLWeaponAt(LW_SCRIPT10, f->X, f->Y);
						spawn->UseSprite(22);
						spawn->NumFrames = 3;
						spawn->ASpeed = 3;
						spawn->DeadState = spawn->NumFrames*spawn->ASpeed;
						spawn->CollDetection = false;
					}
				}
				

When the item script is clearing all the existing rafts, it clears Data and Script but not X and Y. Presumably when Data is 0 the FFC is considered invalid and indeed it doesn't cover up the water under it or anything when I try walking over it. But when the new raft FFC (32) is in the same position as the old one (1) with Data of 0, that's when the collision goes funky. I'm betting it has something to do with some FFC collision priority system not factoring in cases where Data is 0.

Tested these circumstances on my build with manually placed FFCs and was unable to recreate it, so either I accidentally fixed the bug or the cause is more specific than this.

...Didn't actually fix it. Tested the file you sent and it still bugs out. I hate everything.


Edit: Okay, it's fixed in my build now. I'm not familiar with 2.53 so I can't fix it there, but I can at least include the change in some other commits I'm about to make.



#4 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 11 April 2021 - 05:51 AM

Tested these circumstances on my build with manually placed FFCs and was unable to recreate it, so either I accidentally fixed the bug or the cause is more specific than this.

...Didn't actually fix it. Tested the file you sent and it still bugs out. I hate everything.


Edit: Okay, it's fixed in my build now. I'm not familiar with 2.53 so I can't fix it there, but I can at least include the change in some other commits I'm about to make.

 

Please highlight the specific commit, so that I can backport it. 


Did some more testing and I think I know what's causing the bug. 

				for(int i=1; i<=32; ++i){
					ffc f = Screen->LoadFFC(i);
					if(f->Script==raftSlot){
						f->Script = 0;
						f->Data = 0;
						
						lweapon spawn = CreateLWeaponAt(LW_SCRIPT10, f->X, f->Y);
						spawn->UseSprite(22);
						spawn->NumFrames = 3;
						spawn->ASpeed = 3;
						spawn->DeadState = spawn->NumFrames*spawn->ASpeed;
						spawn->CollDetection = false;
					}
				}
				

When the item script is clearing all the existing rafts, it clears Data and Script but not X and Y. Presumably when Data is 0 the FFC is considered invalid and indeed it doesn't cover up the water under it or anything when I try walking over it. But when the new raft FFC (32) is in the same position as the old one (1) with Data of 0, that's when the collision goes funky. I'm betting it has something to do with some FFC collision priority system not factoring in cases where Data is 0.

 

 

This is an oversight in your code. If you want to fully clear an ffc, then you need to do that! 

 

<std> has void ClearFFC(int ffc_id)for this. 




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users