[Code] NS's Random Code Stuff

Post your example zscripts/ACS scripts/etc here.
Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.
User avatar
zrrion the insect
Posts: 2411
Joined: Thu Jun 25, 2009 1:58 pm
Location: Time Station 1: Moon of Glendale

Re: [Code] NS's Random Code Stuff

Post by zrrion the insect »

This is a very cool trick. I am already using it in a mod of mine.
User avatar
Lagi
Posts: 676
Joined: Sat Jun 23, 2018 12:51 pm
Location: Thou shalt alter thy beliefs with new evidence

Re: [Code] NS's Random Code Stuff

Post by Lagi »

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 all

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")
Post Reply

Return to “Script Library”