[ZScript] Destructible geometry material handler

Post your example zscripts/ACS scripts/etc here.

Re: [ZScript] Destructible geometry material handler

Postby Jaska » Mon Apr 06, 2020 2:24 am

For some unknown reason l.args[i] and l.special return 0 on every iteration. Sector index and lineindexes are correct.

Spoiler:
Jaska
 
Joined: 17 Dec 2019
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: [ZScript] Destructible geometry material handler

Postby dodopod » Mon Apr 06, 2020 2:57 pm

Okay, I didn't realize it, but Sector_Set3DFloor specials get erased, after the level loads. The good news is that it's actually much easier to do what you're trying to do than I originally thought. Try this:

Code: Select allExpand view
override void Material3DDestroyed(WorldEvent e)
{
    // I was wrong about how to calculate the pos before
    // z should be in the center of the control sector
    Vector3 pos;
    pos.z = e.damageSector.floorPlane.ZAtPoint(e.damageSector.centerSpot);
    pos.z += e.damageSector.ceilingPlane.ZAtPoint(e.damageSector.centerSpot);
    pos.z /= 2
   
    Super.Material3DDestroyed(e);   // calls MoveFloor/MoveCeiling

    for (int i = 0; i < e.damageSector.GetAttachedCount(); ++i)
    {
        Sector s = e.damageSector.GetAttached(i);

        // x & y should be in the center of the attached sector
        pos.xy = s.centerSpot;
        EjectDebris(8, "WOODGIB", pos, 32);   //Alternate debris, use this WoodenBit
    }
}
dodopod
 
Joined: 04 Oct 2017

Re: [ZScript] Destructible geometry material handler

Postby Jaska » Tue Apr 07, 2020 12:30 am

Thanks dodopod! That's a nice looking solution there. Have to try that brick- thing later. Otherwise my mapping won't progress at all.
Jaska
 
Joined: 17 Dec 2019
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: [ZScript] Destructible geometry material handler

Postby Jaska » Sat Apr 18, 2020 6:49 am

Got the brick spinning. It's so short time as the brick flies.. So the main importance is to have bricks on different positions after destruction and this works just fine:

Code: Select allExpand view
   Spawn:
      AAAA AAAAAAA 1 nodelay
      {
         A_SetAngle(15*random(0,23));
         A_SetPitch(4*random(-5,5));
         A_SetScale(0.2*random(-1,1)+1);
      }
      AAAA A -1
Jaska
 
Joined: 17 Dec 2019
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Previous

Return to Script Library

Who is online

Users browsing this forum: No registered users and 0 guests