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.

Adding Custom Weapons

Postby Gunslaher_Pi » Mon Nov 01, 2021 6:05 am

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
Gunslaher_Pi
 
Joined: 17 Jan 2021
Location: Aussieland - 3D REALMS OG DESIGNER
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: Intel (Modern GZDoom)

Re: Adding Custom Weapons

Postby ramon.dexter » Tue Nov 02, 2021 12:30 am

Affected code?
Please understand that this thread without affected code is completely useless.
User avatar
ramon.dexter
rudebwoy
 
Joined: 20 Oct 2015
Location: Kozolupy, Bohemia
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: Adding Custom Weapons

Postby Gunslaher_Pi » Tue Nov 02, 2021 8:58 pm

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
 
Joined: 17 Jan 2021
Location: Aussieland - 3D REALMS OG DESIGNER
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: Intel (Modern GZDoom)

Re: Adding Custom Weapons

Postby Gunslaher_Pi » Wed Nov 03, 2021 12:45 am

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.
User avatar
Gunslaher_Pi
 
Joined: 17 Jan 2021
Location: Aussieland - 3D REALMS OG DESIGNER
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: Intel (Modern GZDoom)

Re: Adding Custom Weapons

Postby Blue Shadow » Thu Nov 04, 2021 1:05 am

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

Code: Select allExpand view
ACTOR UACBattleRifle : Weapon

And this is the one from the code you posted above:

Code: Select allExpand view
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 allExpand view
ACTOR UACBattleRifle : Weapon 1900
User avatar
Blue Shadow
 
Joined: 14 Nov 2010
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: Adding Custom Weapons

Postby Gunslaher_Pi » Fri Nov 05, 2021 5:59 am

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
 
Joined: 17 Jan 2021
Location: Aussieland - 3D REALMS OG DESIGNER
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: Intel (Modern GZDoom)

Re: Adding Custom Weapons

Postby Gunslaher_Pi » Sat Nov 06, 2021 11:50 am

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.
User avatar
Gunslaher_Pi
 
Joined: 17 Jan 2021
Location: Aussieland - 3D REALMS OG DESIGNER
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: Intel (Modern GZDoom)

Re: Adding Custom Weapons

Postby Blue Shadow » Sat Nov 06, 2021 10:58 pm

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/z6uto7u1hffcoy2/gzdb_exclude.jpg?dl=0 (a very old screenshot but it should be enough, I think)
User avatar
Blue Shadow
 
Joined: 14 Nov 2010
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: Adding Custom Weapons

Postby Gunslaher_Pi » Sat Nov 13, 2021 2:35 am

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
 
Joined: 17 Jan 2021
Location: Aussieland - 3D REALMS OG DESIGNER
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: Intel (Modern GZDoom)

Re: Adding Custom Weapons

Postby Gunslaher_Pi » Wed Nov 17, 2021 4:08 am

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!
User avatar
Gunslaher_Pi
 
Joined: 17 Jan 2021
Location: Aussieland - 3D REALMS OG DESIGNER
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: Intel (Modern GZDoom)

Re: Adding Custom Weapons

Postby Blue Shadow » Thu Nov 18, 2021 12:38 am

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 A_FireCustomMissile, you mention A_CustomMissile. For weapons you want to use A_FireCustomMissile, not A_CustomMissile.
User avatar
Blue Shadow
 
Joined: 14 Nov 2010
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD (Modern GZDoom)


Return to Assets (and other stuff)

Who is online

Users browsing this forum: No registered users and 0 guests