Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
Rhebiz

I just need some scripting help

Question

Alright, I'm trying to make a rocket launcher that fires in a 2-burst fashion. I was creating a new projectile so that the rockets can travel faster, but when I use the A_FireCustomMissile command it comes up with this error.

 

 

error.PNG.f8e2f39822900874bc43596e5672d48d.PNG

 

Heres my script:

 

actor SuperLauncher : Weapon
{
    Weapon.SlotNumber 5
    Weapon.AmmoType "RocketAmmo"
    Weapon.AmmoUse 1
    Weapon.AmmoGive 20
    Weapon.BobStyle Smooth
    Weapon.BobSpeed 3
    Weapon.BobRangeX 0.7
    Weapon.BobRangeY 0.2
    Inventory.PickupMessage "You got the SuperRocketLauncher!"
    +Weapon.NoAutoFire
    
    States
    {
    Spawn: 
        SRLP A -1
    Stop
    Ready:
        SRLL A 1 A_WeaponReady
    Loop
    Select:
        SRLL A 1 A_Raise
    Loop
    DeSelect:
        SRLL A 1 A_Lower
    Loop
    Fire:
        SRLF A 2 BRIGHT A_PlayWeaponSound ("weapon/srlshot")
        SRLF B 4 BRIGHT A_FireCustomMissile ("SuperMissile")Random(-4, 4,) 0, 0, 0, 0, Random(-1, 1,))
        SLRF A 1 BRIGHT A_PlayWeaponSound ("weapon/srlshot")
        SRLF B 4 BRIGHT A_FireCustomMissile ("SuperMissile")Random(-4, 4,) 0, 0, 0, 0, Random(-1, 1,))
        SLRF C 2
    Goto Ready
    }
}

Actor SuperMissile
{
    Projectile
    +NoGravity
    Radius 13
    Height 9
    Speed 40
    Damage 25
    Scale 0.7
    Decal MancubusScorch
    DeathSound "weapons/srlhit"
    States
    {
        Spawn:
            SRLS A 1 BRIGHT
            Loop
        Death:
            MISL B 8 BRIGHT A_Explode (100, 64, 0,)
            MISL C 6 BRIGHT
            Stop
        }
    }
}

        

 

Am I just making a silly mistake? I dont really know but help would be most appreciated. (Also is this the right place to post this stuff here?)

Share this post


Link to post

5 answers to this question

Recommended Posts

  • 0

In the SuperLauncher A_FireCustomMissile lines you have misplaced parenthesis and commas

This:

        SRLF B 4 BRIGHT A_FireCustomMissile ("SuperMissile")Random(-4, 4,) 0, 0, 0, 0, Random(-1, 1,))

Should be:

        SRLF B 4 BRIGHT A_FireCustomMissile ("SuperMissile", Random(-4, 4), 0, 0, 0, 0, Random(-1, 1))

 

Also in the SuperMissile A_Explode line you have a misplaced comma

This:

            MISL B 8 BRIGHT A_Explode (100, 64, 0,)

Should be:

            MISL B 8 BRIGHT A_Explode (100, 64, 0)

Share this post


Link to post
  • 0
4 hours ago, Worst said:

In the SuperLauncher A_FireCustomMissile lines you have misplaced parenthesis and commas

This:

        SRLF B 4 BRIGHT A_FireCustomMissile ("SuperMissile")Random(-4, 4,) 0, 0, 0, 0, Random(-1, 1,))

Should be:

        SRLF B 4 BRIGHT A_FireCustomMissile ("SuperMissile", Random(-4, 4), 0, 0, 0, 0, Random(-1, 1))

 

Also in the SuperMissile A_Explode line you have a misplaced comma

This:

            MISL B 8 BRIGHT A_Explode (100, 64, 0,)

Should be:

            MISL B 8 BRIGHT A_Explode (100, 64, 0)

I still come up with the same error after the corrections. Heres the A_FireCustomMissile lines after correcting them.

 

Fire:
        SRLF A 2 BRIGHT A_PlayWeaponSound ("weapon/srlshot")
        SRLF B 4 BRIGHT A_FireCustomMissile ("SuperMissile", Random(-4, 4,), 0, 0, 0, 0, Random(-1, 1))
        SLRF A 1 BRIGHT A_PlayWeaponSound ("weapon/srlshot")
        SRLF B 4 BRIGHT A_FireCustomMissile ("SuperMissile", Random(-4, 4,), 0, 0, 0, 0, Random(-1, 1))
        SLRF C 2
    Goto Ready

 

Since the error talks about sprite names, I'll give the sprite names. Here they are.

 

912652619_spritemanes.PNG.23cc6cc6ba6bfe9020266651a0361689.PNG

Share this post


Link to post
  • 0
1 hour ago, Rhebiz said:

I still come up with the same error after the corrections. Heres the A_FireCustomMissile lines after correcting them.

 

Fire:
        SRLF A 2 BRIGHT A_PlayWeaponSound ("weapon/srlshot")
        SRLF B 4 BRIGHT A_FireCustomMissile ("SuperMissile", Random(-4, 4,), 0, 0, 0, 0, Random(-1, 1))
        SLRF A 1 BRIGHT A_PlayWeaponSound ("weapon/srlshot")
        SRLF B 4 BRIGHT A_FireCustomMissile ("SuperMissile", Random(-4, 4,), 0, 0, 0, 0, Random(-1, 1))
        SLRF C 2
    Goto Ready

You still have extra commas at the first Random calls in both A_FireCustomMissile lines, take the last comma out, so that it's Random(-4, 4)

 

Also the sprite name seems to be "SLRF" instead of "SRLF" in two of those lines, is that correct?

 

Share this post


Link to post
  • 0

Just a small tip: the GZDoom error specifically lists "Line 30" as the issue. That means literally it's the 30th line of your code that has the problem.

 

The "sprite name must be 4 characters" is referring to the "SLRF" bit. The problem (I believe, I'm no coder) is because your syntax wasn't written right, the game was interpreting everything after the syntax error as the sprite name too, i.e ",), 0, 0, 0, 0, Random(-1, 1))". That's why you got that error.

 

Generally when you get an error like that that lists a specific line, you need to go back to the code and go through that line with a fine toothed comb to spot the typo. It's usually an extra parenthesis, comma, or semicolon in my experience. 

Share this post


Link to post
  • 0
1 hour ago, Bauul said:

Just a small tip: the GZDoom error specifically lists "Line 30" as the issue. That means literally it's the 30th line of your code that has the problem.

 

The "sprite name must be 4 characters" is referring to the "SLRF" bit. The problem (I believe, I'm no coder) is because your syntax wasn't written right, the game was interpreting everything after the syntax error as the sprite name too, i.e ",), 0, 0, 0, 0, Random(-1, 1))". That's why you got that error.

 

Generally when you get an error like that that lists a specific line, you need to go back to the code and go through that line with a fine toothed comb to spot the typo. It's usually an extra parenthesis, comma, or semicolon in my experience. 

 

2 hours ago, Worst said:

You still have extra commas at the first Random calls in both A_FireCustomMissile lines, take the last comma out, so that it's Random(-4, 4)

 

Also the sprite name seems to be "SLRF" instead of "SRLF" in two of those lines, is that correct?

 

 

 

Well the weapon works after your help. Thanks!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×