Adding Custom Weapons

Ask about editing graphics, sounds, models, music, etc here!
Shaders (GLSL) and SNDINFO questions also go here!

Moderators: GZDoom Developers, Raze Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
User avatar
Gunslaher_Pi
Posts: 47
Joined: Sun Jan 17, 2021 3:41 am
Graphics Processor: Intel (Modern GZDoom)
Location: Aussieland - 3D REALMS OG DESIGNER

Adding Custom Weapons

Post by Gunslaher_Pi »

I think this the best place for this post being an "asset" and all.

I'm trying to add-in a custom weapon. So far, I've got two. The UAC Battle Rifle and the Sting Cannon (Later to be introduced in later levels)
However I've receive the following message upon launch. Does anyone understand this? Again, I feel like I'm either not doing something right
or my editor isn't compatible.
Execution could not continue.

Script error, "Athena_resource.pk3:decorate" line 3:
Unexpected 'Picked up the UAC Standard Battle Rifle.' in definition of 'UACBattleRifle'
I'm so tired of seeing error messages. What am I doing wrong guys. Please be patient.
Doom Scripting and editing isn't my forte'. I'm used to designing and scripting levels and objects on a Dos Based program called "Build" from
3D Realms.

TIA
User avatar
ramon.dexter
Posts: 1354
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Adding Custom Weapons

Post by ramon.dexter »

Affected code?
Please understand that this thread without affected code is completely useless.
User avatar
Gunslaher_Pi
Posts: 47
Joined: Sun Jan 17, 2021 3:41 am
Graphics Processor: Intel (Modern GZDoom)
Location: Aussieland - 3D REALMS OG DESIGNER

Re: Adding Custom Weapons

Post by Gunslaher_Pi »

Alright, I'll post the entire code when I can. It's so weird. Mainly the issue is located in the pickup message. But again, I will include the whole code. I originally got it from Realm667.

Ta.
User avatar
Gunslaher_Pi
Posts: 47
Joined: Sun Jan 17, 2021 3:41 am
Graphics Processor: Intel (Modern GZDoom)
Location: Aussieland - 3D REALMS OG DESIGNER

Re: Adding Custom Weapons

Post by Gunslaher_Pi »

ramon.dexter wrote:Affected code?
Please understand that this thread without affected code is completely useless.
Okie. Here buddy.
ACTOR UACBattleRifle 1900
{
Inventory.PickupMessage "Picked up the UAC Standard Battle Rifle." // "You got the chaingun"
Obituary "%o was anihilated by %k's BattleRifle."
Weapon.SelectionOrder 1900
Weapon.AmmoUse 1
Weapon.SlotNumber 4
Weapon.AmmoGive 30
Weapon.AmmoType1 "Clip"
Decal "BulletChip"
AttackSound "weapons/UACBR"
States
{
Spawn:
UACR C -1
Loop
Ready:
UACR A 1 A_WeaponReady
Loop
Select:
UACR A 1 A_Raise
Loop
Deselect:
UACR A 1 A_Lower
Loop
Fire:
UACR A 0 A_GunFlash
UACR A 0
UACR B 2 A_FireBullets(3, 2, 1, 8, "BulletPuff")
UACR B 2
UACR A 3
UACR A 3 A_ReFire
Goto Ready
Flash:
UACR D 1 Bright A_Light0
UACR E 1 Bright A_Light1
Goto LightDone
}
}
It's a Realm667 script. I haven't touched the script at all.
Blue Shadow
Posts: 4929
Joined: Sun Nov 14, 2010 12:59 am
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: Adding Custom Weapons

Post by Blue Shadow »

The code is actually modified. This is the first line from the original DECORATE code:

Code: Select all

ACTOR UACBattleRifle : Weapon
And this is the one from the code you posted above:

Code: Select all

ACTOR UACBattleRifle 1900
See the : Weapon in the original code? Its absence from the code you posted is the cause of the problem. Since it's not there, the actor is no longer considered a weapon item, which means certain "attributes" cannot be used with it, like Inventory.PickupMessage that you're getting the error for.

Fixed code:

Code: Select all

ACTOR UACBattleRifle : Weapon 1900
User avatar
Gunslaher_Pi
Posts: 47
Joined: Sun Jan 17, 2021 3:41 am
Graphics Processor: Intel (Modern GZDoom)
Location: Aussieland - 3D REALMS OG DESIGNER

Re: Adding Custom Weapons

Post by Gunslaher_Pi »

Oh wow! It's that simple???

So the mod I downloaded wasn't complete?
Awesome. Thank you! I wouldn't of picked up
On that. Thanks friend! I'll give it a try!

Oh, btw speaking of weapons. I had a mindspark
This afternoon, in Doom Eternal, Doom Slayer (btw Terrible name) I'll always know him as doomguy. Has a shoulder mounted weapon. I'm wondering if I could adaptate a similar function for the D2 iwad.

Thoughts?
User avatar
Gunslaher_Pi
Posts: 47
Joined: Sun Jan 17, 2021 3:41 am
Graphics Processor: Intel (Modern GZDoom)
Location: Aussieland - 3D REALMS OG DESIGNER

Re: Adding Custom Weapons

Post by Gunslaher_Pi »

Alrighty, so I've fixed the code to the point where the new weapon appears, changes, shoots, has sound etc. Awesome job Thank you. However, in my editor it still says it failed to find "class Weapon". It's a strange bug.

I'll post the deets when able.
Blue Shadow
Posts: 4929
Joined: Sun Nov 14, 2010 12:59 am
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: Adding Custom Weapons

Post by Blue Shadow »

Try loading gzdoom.pk3 file as a resource in the map editor. I don't remember if order matters, but just in case, make sure the file is loaded before the PDA file/resource.

Make also sure to exclude it from testing:

https://www.dropbox.com/s/z6uto7u1hffco ... e.jpg?dl=0 (a very old screenshot but it should be enough, I think)
User avatar
Gunslaher_Pi
Posts: 47
Joined: Sun Jan 17, 2021 3:41 am
Graphics Processor: Intel (Modern GZDoom)
Location: Aussieland - 3D REALMS OG DESIGNER

Re: Adding Custom Weapons

Post by Gunslaher_Pi »

Solved a fair amount of scripting issues with the new weapons. Some strange reason a_custommissile isn't working. When I get home tonight I'll post the script.

Thanks guys
User avatar
Gunslaher_Pi
Posts: 47
Joined: Sun Jan 17, 2021 3:41 am
Graphics Processor: Intel (Modern GZDoom)
Location: Aussieland - 3D REALMS OG DESIGNER

Re: Adding Custom Weapons

Post by Gunslaher_Pi »

I've had to rewrite the script to make the weapon fire plasma bullets instead of the designed projectiles.
I haven't touched this code except I've had to delete massive parts of it to make the weapon viable.

Bottom line, I can't make the projectile spawn. I have a feeling that the class definitions aren't compatible
with Zdoom parameters. If I upgrade to UDB would it provide a greater scope of compatibility for DECORATE
script?

Let me know what you guys think. A_CustomMissile parameters are frustrating.
actor FuzzyPlasma // edited from Doom's standard plasmaball actor
{
Radius 13
Height 8
Speed 30
Damage 4
Decal DoomImpScorch
Projectile
+RANDOMIZE
RenderStyle Add
Alpha 0.75
SeeSound ""
DeathSound "fuzzy/pdeath"
Obituary "%o was left decayed by %k's Plasmatic Rifle"
States
{
Spawn:
PLZM F 0
PLZM F 0 A_SpawnItemEx("FuzzyPlasmaTrail")
PLZM F 1 bright
PLZM G 0 A_SpawnItemEx("FuzzyPlasmaTrail")
PLZM G 1 bright
loop
Death:
PLZM H 0
PLZM H 0 A_Explode(8, 32)
PLZM HIJKL 3 bright
stop
}
}

ACTOR FuzzyPlasmaTrail
{
RenderStyle Translucent
Alpha 0.75
Scale 0.7
+NOBLOCKMAP
+NOGRAVITY
+NOCLIP
+DONTSPLASH
+NOTELEPORT
States
{
Spawn:
PLZM M 0
PLZM M 1 A_SetTranslucent(0.70, 1)
PLZM N 1 A_SetTranslucent(0.65, 1)
PLZM M 1 A_SetTranslucent(0.60, 1)
PLZM N 1 A_SetTranslucent(0.55, 1)
PLZM M 1 A_SetTranslucent(0.50, 1)
PLZM N 1 A_SetTranslucent(0.45, 1)
PLZM M 1 A_SetTranslucent(0.40, 1)
PLZM N 1 A_SetTranslucent(0.35, 1)
PLZM M 1 A_SetTranslucent(0.20, 1)
PLZM N 1 A_SetTranslucent(0.15, 1)
PLZM M 1 A_SetTranslucent(0.10, 1)
PLZM N 1 A_SetTranslucent(0.05, 1)
Stop
}
}

actor UACPlasmaticRifle : Weapon // Replaces PlasmaRifle
{
Weapon.SelectionOrder 100
Weapon.AmmoUse 1
Weapon.AmmoGive 50
Weapon.AmmoType "Cell"
Weapon.SlotNumber 6
//Weapon.BobStyle Alpha
Inventory.PickupMessage "UAC Standard Plasmatic Rifle"
States
{
Ready:
PLZM A 1 A_WeaponReady
Loop
Deselect:
PLZM A 1 A_Lower
//TNT1 AA 0 A_Lower
Loop
Select:
PLZM A 1 A_Raise
//TNT1 AA 0 A_Raise
Loop
Fire:
PLZM A 0
PLZM A 0 A_FireCustomMissile("FuzzyPlasma",0,1,0,0)
PLZM A 0 A_PlaySound("fuzzy/plasma")
PLZM B 2 BRIGHT
PLZM C 2
PLZM D 6 A_ReFire
Goto Ready
Spawn:
PLZM E -1
Stop
}
}
What's wrong with the code?

Thanks for your patience!
Blue Shadow
Posts: 4929
Joined: Sun Nov 14, 2010 12:59 am
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: Adding Custom Weapons

Post by Blue Shadow »

Gunslaher_Pi wrote:What's wrong with the code?
From examining it, I can't see anything wrong. Even though the weapon's code uses [wiki]A_FireCustomMissile[/wiki], you mention [wiki]A_CustomMissile[/wiki]. For weapons you want to use A_FireCustomMissile, not A_CustomMissile.

Return to “Assets (and other stuff)”