[DECORATE] Custom weapon, Zandro freezes on Player death

Discuss all aspects related to modding Zandronum here.
Post Reply
User avatar
doomista
Forum Regular
Posts: 147
Joined: Sat Mar 07, 2015 6:58 pm
Location: I've been to hell. Twice

[DECORATE] Custom weapon, Zandro freezes on Player death

#1

Post by doomista » Wed Apr 20, 2016 9:39 am

Hi guys, I started making some small weapon mode, so far I DECORATEd this:

Code: Select all

ACTOR Projectile_Beamgun : PlasmaBall 16040 {
	Speed 30									// It's a bit faster than plasma ball
	Damage 50									// Player has two lives
	-RANDOMIZE
}

ACTOR Ammo_Beamgun : Cell 16050 {
	Inventory.Amount 25
	Inventory.MaxAmount 100	
	Ammo.BackpackAmount 50
	Ammo.BackpackMaxAmount 200
}

ACTOR Gun_Beamgun : PlasmaRifle 16060 {
	Weapon.SelectionOrder 350
	Weapon.AmmoType "Ammo_Beamgun"
	Weapon.AmmoGive 50
	Weapon.AmmoUse	25
	Weapon.SlotNumber 2
	+WEAPON.NOAUTOFIRE	
	+WEAPON.NOAUTOAIM
	
	States
	{
	Ready:
		TNT1 A 0 A_GiveInventory ("Ammo_Beamgun",0)	// Ammo regen
		TNT1 A 2 A_WeaponReady						// By putting here A 1 regen can be faster
		Loop
	Deselect:
		TNT1 A 0 A_Lower
		Loop
	Select:
		TNT1 A 0 A_Raise
		Loop
	Fire:
		TNT1 A 3
		TNT1 A 0 A_FireCustomMissile ("Projectile_Beamgun")
		TNT1 A 16 
		TNT1 A 5 A_ReFire
		Goto Ready
	Spawn:
		TNT1 A -1
		Stop
	}
}
Which works as I wanted, most of the time. But if the player holding the "Gun_Beamgun" dies, Zandronum freezes in a horrible way. That happens for Zandro 2.1.2, but not for the 3.0-alpha-r151004-2012. Has anybody a slight idea what can cause this bug and how to fix it for 2.1.2? I intend to do a DM mod and I'd like to develop for a played version of the game. I've attached custom wad reproducing this bug to this post, but be aware - this really freezes zandro in a horrible way! For those who still have enough courage, in the console type give gun_beamgun and then die in any way desired (this bug also happens if a bot holding the weapon dies, tested in Zandro deathmatch).
Thanks for help in advance

EDIT: Freeze happens even before any ondeath script can be called, so no, ACS is probably not an answer
You do not have the required permissions to view the files attached to this post.

User avatar
ZZYZX
Posts a lot
Posts: 742
Joined: Thu Jun 07, 2012 5:56 pm
Location: Ukraine
Clan: A3
Clan Tag: [A3]

[DECORATE] Re: Custom weapon, Zandro freezes on Player death

#2

Post by ZZYZX » Wed Apr 20, 2016 9:54 am

TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 A_Lower

The Deselect state should have finite length as sometimes it just lowers the weapon without switching states or switching to another weapon, like in case of player death.

User avatar
doomista
Forum Regular
Posts: 147
Joined: Sat Mar 07, 2015 6:58 pm
Location: I've been to hell. Twice

[DECORATE] Re: Custom weapon, Zandro freezes on Player death

#3

Post by doomista » Wed Apr 20, 2016 10:39 am

ZZYZX wrote:TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 A_Lower
The Deselect state should have finite length as sometimes it just lowers the weapon without switching states or switching to another weapon, like in case of player death.
This community is really for the best. Thanks.

User avatar
SwordGrunt
Forum Regular
Posts: 377
Joined: Thu Jun 07, 2012 8:43 pm

[DECORATE] Re: Custom weapon, Zandro freezes on Player death

#4

Post by SwordGrunt » Wed Apr 20, 2016 1:36 pm

You can really just change the 0 tic duration to 1 tic on the Select and Deselect states. Looping A_Lower and A_Raise is fine.

User avatar
ZZYZX
Posts a lot
Posts: 742
Joined: Thu Jun 07, 2012 5:56 pm
Location: Ukraine
Clan: A3
Clan Tag: [A3]

[DECORATE] Re: Custom weapon, Zandro freezes on Player death

#5

Post by ZZYZX » Wed Apr 20, 2016 3:56 pm

I believe he wanted instant switch.

User avatar
SwordGrunt
Forum Regular
Posts: 377
Joined: Thu Jun 07, 2012 8:43 pm

[DECORATE] Re: Custom weapon, Zandro freezes on Player death

#6

Post by SwordGrunt » Wed Apr 20, 2016 5:38 pm

Yeah but that should probably be taken care of by the player property instead of the actual weapon code, unless you want to do it for a single weapon (which would look really odd and out of place)

User avatar
doomista
Forum Regular
Posts: 147
Joined: Sat Mar 07, 2015 6:58 pm
Location: I've been to hell. Twice

[DECORATE] Re: Custom weapon, Zandro freezes on Player death

#7

Post by doomista » Wed Apr 20, 2016 9:39 pm

Yes. I wanted to have an instant switch, and yes, I eventually done it with the ACS and set player property. That TNT1 A 0 A_Lower was a relic of an old approach and I totally missed it.

darkmessenger84
New User
Posts: 13
Joined: Mon Jul 06, 2015 8:32 pm
Location: Grantham, UK

[DECORATE] Re: Custom weapon, Zandro freezes on Player death

#8

Post by darkmessenger84 » Sun May 15, 2016 6:00 pm

SetPlayerProperty(0,1,2) is your friend.

Put it either in a weapon's ready state or a player definition in DECORATE.


EDIT: Apologies, I just this moment noticed that you used the SetPlayerProperty approach. Still, I'm happy to be of assistance.

If anyone else is interested, SetPlayerProperty(0,1,2) enables instant weapon switch.

Post Reply