[Code] NS's Random Code Stuff

Post your example zscripts/ACS scripts/etc here.

Re: [Code] NS's Random Code Stuff

Postby zrrion the insect » Thu Sep 04, 2014 12:16 pm

This is a very cool trick. I am already using it in a mod of mine.
User avatar
zrrion the insect
Like a fish in a child's hands.
 
Joined: 25 Jun 2009
Location: Time Station 1: Moon of Glendale

Re: [Code] NS's Random Code Stuff

Postby Lagi » Wed Mar 04, 2020 12:40 pm

I use the arc scan code for two of my melee weapons.

It game rarely it looks like it works (sometimes the player is turning to monster). This auto-aim its nowhere as good as in vanilla hexen.

Can somebody have a look at below code, what i do wrong?
here is mod

this code is at the bottom of decorate
Code: Select allExpand view
Actor Func_MeleeScan : CustomInventory //Neural Stunner https://forum.zdoom.org/viewtopic.php?f=37&t=32535#p616143
{
   States
   {
   Pickup:
   Scan:
      TNT1 A 0 A_SetArg (4, 0)
      TNT1 A 0 A_JumpIfCloser (Args[3], "Done")
   Scan1:
      TNT1 A 0 A_SetArg (4, Args[4] + 1)
      TNT1 A 0 A_SetAngle (Angle - Args[4])
      TNT1 A 0 A_JumpIfCloser (Args[3], "Done")
      TNT1 A 0 A_SetAngle (Angle + Args[4] + Args[4])
      TNT1 A 0 A_JumpIfCloser (Args[3], "Done")
      TNT1 A 0 A_SetAngle (Angle - Args[4])
      TNT1 A 0 A_JumpIf (Args[4] == Args[2], "Done")
      Loop
   Done:
      TNT1 A 0 A_SetArg (4, 0)
      TNT1 A 0 A_Jump (256, "DoneHit")
   DoneHit:
      TNT1 A 0
      Stop
   Spawn:
      TNT1 A 0
      Stop
   }
}


    Actor Func_HammerAttack : Func_MeleeScan
    {
       States
       {
       Pickup:
          TNT1 A 0 A_SetArg (2, 45) // Attack angle. Total scan arc will be twice this.
          TNT1 A 0 A_SetArg (3, 96) // Attack distance.
          Goto Scan
       DoneHit: // Actual attack goes here. A_FireBullets is strongly suggested.
         TNT1 A 0 {A_FireBullets (0,0,1,random(60,90),"hammerpuff",0,96); A_Stop();}
         TNT1 A 0 {A_Custompunch(random(0,83), 1, 0, "BURNPuff", 96)  ; A_Stop();}
          Stop
       }
    }

    Actor Func_StaffAttack : Func_MeleeScan
    {
       States
       {
       Pickup:
          TNT1 A 0 A_SetArg (2, 45) // Attack angle. Total scan arc will be twice this.
          TNT1 A 0 A_SetArg (3, 120) // Attack distance.
          Goto Scan
       DoneHit: // Actual attack goes here. A_FireBullets is strongly suggested.
         TNT1 A 0 A_FireBullets(0,0,1, random(20, 35), "staffpuff", 0, 120)
          Stop
       }
    }


zscript/hammer.zs
actors/goldwand2

in above weapon codes I add
stff m 3 A_GiveInventory ("Func_StaffAttack")
User avatar
Lagi
 
Joined: 23 Jun 2018
Location: Thou shalt alter thy beliefs with new evidence

Previous

Return to Script Library

Who is online

Users browsing this forum: No registered users and 0 guests