Page 5 of 33
Posted: Mon Aug 21, 2006 2:50
by lizardcommando
Sup Marty. Actually, that's what I was going to make my next post about. I have decided to add in some reloading sequences for most of the guns. The Pistol, Shotgun, and the Assault Rifle will be having reloading sequences. The Handcannon, both SMG and AkimboSMGs, and most likely the rest of the guns I'll be making won't have reloading sequences. The Handcannon won't since you'll be shooting both shells at a time, so adding a reload sequence seems a bit too bothersome. The SMG and AkimboSMG's won't since, hey, if you've got an itchy trigger finger, you won't want to bother reloading anyways, right?

Ehh, but that might change in the future if enough people say otherwise. Now onto my question on reloading:
I have been trying to follow the tutorial on how to reload, but I can't seem to get it to work. For the first part of that tutorial, where exactly do I post this part and was I supposed to copy EVERYTHING from that first part of the code?
Code: Select all
ACTOR Action_Reload : CustomInventory
{
Inventory.Amount 1
Inventory.MaxAmount 1
-INVBAR
States
{
Use:
PISR A 0 A_GiveInventory("IsReloading",1)
Fail
}
}
ACTOR Action_ReloadCancel : CustomInventory
{
Inventory.Amount 1
Inventory.MaxAmount 1
-INVBAR
States
{
Use:
PISR A 0 A_TakeInventory("IsReloading",1)
Fail
}
}
ACTOR IsReloading : Inventory
{
Inventory.Amount 1
Inventory.MaxAmount 1
-INVBAR
}
I split up my DECORATE into two sections so far. One is WEAPONS, which is where I've stored information on weapon animations and whatnot and the other is AMMO, which is where I've stored information on AMMO and how much bullets each magazine has. I stored the coding above in the WEAPONS part of the DECORATE coding.
Here's the second part of the coding.
Code: Select all
ACTOR .45Pistol : Weapon replaces Pistol
{
+NOAUTOFIRE
+AMMO_OPTIONAL
Obituary "%o was capped by %k's trusty ol' .45."
AttackSound "weapons/pistol"
Weapon.AmmoType1 ".45BULLETS" //The guns magazine
Weapon.AmmoType2 ".45MAG" //The real ammo
Weapon.AmmoGive 0
Weapon.AmmoGive2 1
Weapon.AmmoUse 1
Weapon.SelectionOrder 6000
States
{
Ready:
PISG A 1 A_WeaponReady
PISG A 0 A_JumpIfInventory("IsReloading",1,15)
Loop
Deselect:
PISG A 1 A_Lower
Loop
Select:
PISG A 1 A_Raise
Loop
Fire:
PISG B 2 A_JumpIfNoAmmo(8)
PISG C 2 A_GunFlash
PISG D 2
PISG E 2
PISG C 2
PISG B 1
PISG A 0
Goto Ready
PISR A 1 A_Playsound("weapons/click")
Flash:
PISF A 2 BRIGHT A_FireBullets(2,1,-1,10,0,1,0)
stop
//Reload:
PISR A 0 A_JumpIfInventory(".45BULLETS",8,2)
PISR A 0 A_JumpIfInventory(".45MAGS",1,2)
PISR A 0
Goto Ready
PISR A 0 A_TakeInventory(".45BULLETS",999)
PISR A 4
PISR B 3 A_PlaySound("weapons/pmagout")
PISR C 2
PISR B 1
PISR A 2
PISR D 1
PISR A 1 A_PlaySound("weapons/pmagin")
PISR A 0 A_TakeInventory(".45MAGS",1)
PISR A 0 A_GiveInventory(".45BULLETS",999)
PISG A 1
Goto Ready
}
}
I copied the coding from that reloading tutorial and changed some parts which suited my needs. I can't figure out what the hell is wrong with it.
As for the Katana's handle, I can't really think of a different color for it. The old color from ICD-LIZARD was kinda tacky.
Posted: Mon Aug 21, 2006 3:00
by wildweasel
The first portion of code is for Decorate. Action_Reload etc. are dummy inventory items which are used when the Reload key is pressed. In order for them to work, you'll need to ensure that the player has both Action_Reload and Action_ReloadCancel in their inventory.
Posted: Mon Aug 21, 2006 6:02
by lizardcommando
Ugh.... I still can't seem to get this cursed Reloading code to work at all. I did add that Action_Reload and Action_Reloadcancel commands in the inventory, but it still won't work... I changed the .45MAG and .45BULLETS names around with each other so it would make things a bit easier on me.
Code: Select all
ACTOR .45Pistol : Weapon replaces Pistol
{
+NOAUTOFIRE
+AMMO_OPTIONAL
Obituary "%o was capped by %k's trusty ol' .45."
AttackSound "weapons/pistol"
Weapon.AmmoType1 ".45MAG" //The guns magazine
Weapon.AmmoType2 ".45BULLETS" //The real ammo
Weapon.AmmoGive 0
Weapon.AmmoGive2 8
Weapon.AmmoUse 1
Weapon.SelectionOrder 6000
States
{
Ready:
PISG A 1 A_WeaponReady
PISG A 0 A_JumpIfInventory("IsReloading",1,15)
Loop
Deselect:
PISG A 1 A_Lower
Loop
Select:
PISG A 1 A_Raise
Loop
Fire:
PISG B 2 A_JumpIfNoAmmo(8)
PISG C 2 A_GunFlash
PISG D 2
PISG E 2
PISG C 2
PISG B 1
PISG A 0
Goto Ready
PISR A 2 A_Playsound("weapons/click")
PISR A 0
Flash:
PISF A 2 BRIGHT A_FireBullets(2,1,-1,10,0,1,0)
stop
//Reload:
PISR A 0 A_JumpIfInventory(".45MAG",1,2)
PISR A 0 A_JumpIfInventory(".45BULLETS",8,2)
PISR A 0
Goto Ready
PISR A 0 A_TakeInventory(".45MAG",999)
PISR A 4
PISR B 3 A_PlaySound("weapons/pmagout")
PISR C 8
PISR B 3
PISR C 2 A_PlaySound("weapons/pmagin")
PISR D 2
PISR A 1 A_PlaySound("weapons/pslide")
PISR A 0 A_TakeInventory(".45BULLETS",8)
PISR A 0 A_GiveInventory(".45MAG",1)
PISG A 1
Goto Ready
}
}
I dunno what else to do. I'm totally stumped. I've looked at other examples of this in mods, but I still can't figure it out.

Posted: Mon Aug 21, 2006 6:11
by wildweasel
The Reload stuff ought to go with the Fire state, not the Flash state.
Posted: Mon Aug 21, 2006 7:28
by lizardcommando
Alright, I made the changes like you've suggested and it's pretty much how I want it to act. I can reload with the press of a button, although when I reload through about half of a magazine, for example, if I have 5 shots left in my magazine for my Colt .45, it'll still take away 8 bullets. You get what I mean right? Also, even when I'm out of ammo, I can still reload.
Posted: Wed Aug 23, 2006 1:49
by Marty Kirra
That the clip style system, it was done by DoomRater has a means for an easier reload system. Basicly, you throw away an empty or half full clip for a full one. Trust me, it's way easier than the one used in the Stranger and such.
Posted: Wed Aug 23, 2006 4:06
by lizardcommando
Alright. Doomrater made a Reloading tutorial, right? If so, can you show me a link to that?
Also, is there a tutorial on how to make thrown grenades?
I've got another question. Is there an easy way to make random spawners? I want to have something like those random spawners in ICD-Lizard where random items or enemies would spawn. How would I go about doing that?
Posted: Thu Aug 24, 2006 8:40
by lizardcommando
I have good news and bad news yet again. The good news is that I have finished making the grenades and they are in the game. The bad news is that the coding is fucked up for them. Also, the pistol still doesn't want to work the way I want it to. You can see that in my previous post.
So I tried to put in some coding for the grenade. The animation works, but the grenades don't act like how I want it. The following code is the grenade that's being thrown.
Code: Select all
ACTOR GrenadeObj
{
height 8
radius 6
damage 5
speed 10
seesound "weapons/grenbounce"
deathsound "weapons/boom"
PROJECTILE
+HEXENBOUNCE
+RANDOMIZE
states
{
Spawn:
HGND ABCDEF 3
loop
Death:
FBXP ABC 3 BRIGHT A_EXPLODE(30,30,0)
stop
}
}
So what exactly do I need to do to fix it? All I pretty much want it to do is after I throw it, it bounces on the ground 3 or 4 times and then it explodes.
I have another question. What would the Doom Rocket's stats look like via DECORATE?
Posted: Thu Aug 24, 2006 21:42
by Marty Kirra
Try searching the ZDoom Wiki, I'm kinda in a hurry or I would've given you a link

Posted: Thu Aug 24, 2006 22:41
by Doomed Soul
bouncecount
That will limit the number of bounces to the number specified.
Glad I have the entire ZDoom wiki saved on disk

.
Posted: Fri Aug 25, 2006 0:14
by lizardcommando
Hey guys, thanks for your help so far.
I got the grenade to kinda work. I still have a minor problem though. Is there a way so that you can aim where you throw the grenade? For example, if there's a window above you and you want to throw it up there. Just look up and then throw it. Currently, I can't do that with the grenades. If I look up and throw it, it still throws the grenade in the default direction.
Does that make sense?
Posted: Fri Aug 25, 2006 4:07
by wildweasel
If you're using A_ThrowGrenade for your attack, I suggest switching to A_FireCustomMissile instead, and then modifying your grenade projectile like so:
Code: Select all
Spawn:
HGND A 0 ThrustThingZ(0,3,0,1)
HGND ABCDEF 3
loop
Change the 3 in ThrustThingZ accordingly to determine how much of an arc the grenade has when thrown.
Posted: Fri Aug 25, 2006 6:58
by lizardcommando
Well, the grenades now act all weird. What am I doing wrong here? Also, am I supposed to have some kind of tag where the grenade is affected by gravity?
Code: Select all
GREN G 2 A_FireCustomMissile("GrenadeObj",-1,0,4,2)
Posted: Fri Aug 25, 2006 6:59
by wildweasel
Yes - your flag is -NOGRAVITY.
Posted: Fri Aug 25, 2006 21:59
by lizardcommando
Thanks for that bit of information. I've almost got the grenades to work how I want them although I have some stuff to fix.
I can't seem to get the sounds to work. Whenever I throw the grenade, it would play the bounce sound with the throwing sound. I even defined the attacksound for the grenades being the grenade throw sound. I have the grenade projectile having the grenade bounce sound as its seesound. What am I doing wrong here?
Code: Select all
ACTOR Grenades : Weapon replaces RocketBox
{
Inventory.Pickupmessage "Picked up a pack of Grenades!"
Obituary "%o tripped on %k's grenade."
Weapon.SelectionOrder 4000
Weapon.AmmoGive 5
Weapon.AmmoUse 1
Weapon.AmmoType "GRENADEPACK"
AttackSound "weapons/grenthrow"
+NOALERT
States
{
Spawn:
BROK A -1
LOOP
Ready:
GRNI A 1 A_WeaponReady
LOOP
Deselect:
GRNI A 1 A_Lower
LOOP
Select:
GRNI A 1 A_Raise
LOOP
Fire:
GRNI A 0 A_JumpIfNoAmmo(1)
GRNI A 2
GRNI B 2
GRNI C 2
GREN A 2
GREN B 2
GREN C 2
GREN D 4 A_PlayWeaponSound("weapons/grenarm")
GREN E 2
GREN F 2
GRNI A 4
GREN G 1 A_PlayWeaponSound("weapons/grenthrow")
GREN G 1 A_FireCustomMissile("GrenadeObj",-1,0,3,2)
GREN H 2
GREN I 2
GRNI A 4
Goto Ready
}
}
My next question regarding the grenades is how do I define the explosion's radius for the grenade and how do I make it so that it damages me as well? It has something to do with this script, right?
Code: Select all
ACTOR GrenadeObj
{
height 8
radius 6
damage 5
speed 25
seesound "weapons/grenbounce"
deathsound "weapons/boom"
bouncecount 4
PROJECTILE
+HEXENBOUNCE
+RANDOMIZE
-NOGRAVITY
states
{
Spawn:
HGND A 0 ThrustThingZ(0,5,0,1)
HGND ABCDEF 3
loop
Death:
FBXP ABC 3 BRIGHT A_EXPLODE(50,50,0)
stop
}
}
My next question is how do I make it so that when I pick up the RocketBox which has been replaced with Grenades, not only do I pick up more grenades, but I also can pick up the Grenade weapon? You get what I mean right? Right now, when I pick up the RocketBox, I pick up the ammo, but not the grenades themselves which would allow you to use them.
This last question isn't related to the grenade, but I can't get the default rocket replaced. I already know the problem as to why. It's because Projectile isn't a defined Actor property or something. So since that's the case, what exactly
is the property that is being replaced?
Code: Select all
actor RPG : _________ (what goes in the blank spot?) replaces Rocket
{
obituary "%o explosered from %k's RPG."
radius 11
height 8
speed 60
damage 20
deathsound "weapons/rpgexp"
PROJECTILE
+RANDOMIZE
+ROCKETTRAIL
states
{
Spawn:
MISL A 1 bright
loop
Death:
EXP4 BCDEFG 5 bright A_Explode
EXP4 HIJKLM 5 bright
EXP4 LMNOPQ 5 bright
EXP4 RS 5 bright
stop
}
I want to thank you guys for helping me with the coding. I've been trying really hard in doing the coding by myself, but there's only so much I can do with my limited knowledge of DECORATE on my own. So again, thanks for your help.