Page 1 of 1

Game Crashes when Killed while ADS

Posted: Wed Dec 18, 2013 11:43 pm
by Fabysk
Recently, I was able to implement the Black Ops 2 weapons into Project 115 with full success. But when I get killed while aiming down the sights, the game crashes :neutral: . I'm not sure what the problem is here , but if anyone can help, that would be great.

Code: Select all

ACTOR Type25 : Weapon 20006
{ 
	Spawnid 202
	Weapon.AmmoType "Type25Ammo" 
	Weapon.AmmoGive 999
	Weapon.AmmoUse 1
	Weapon.SlotNumber 5
	Inventory.PickupSound "misc/w_pkup" 
	AttackSound "weapons/TYPE25"
	Decal "BulletChip"
	+NOAUTOFIRE
	States 
	{ 
	Spawn: 
		MGU3 A -1 
		Loop 
	Ready: 
		TPH1 A 1 A_WeaponReady 
		Loop 
	Deselect: 
		TPH1 A 1 A_Lower 
		Loop 
	Select: 
		TPH1 A 1 A_Raise 
		Loop 
	Fire: 
		TPH1 A 0 A_SetPitch (pitch-2.0)
		TPH1 A 1 A_GunFlash
		TPH1 B 2 A_FireBullets(5, 1, 1, 2, 0, 1)
		TPH1 A 1 A_ReFire
		goto Ready
	AltFire:
		TPH1 B 0 A_GiveInventory("sightsType25")
		TPH1 B 0 A_SelectWeapon("sightsType25")
		TPH1 A 0 A_Lower 
		Loop
	}
} 
actor sightsType25 : Weapon 20007
{
	Decal "BulletChip"
	Weapon.AmmoType "Type25Ammo" 
	Weapon.AmmoGive 999
	Weapon.AmmoUse 1
	AttackSound "weapons/TYPE25"
	Weapon.AmmoGive 0
	States
	{
		Select:
		TPH1 C 0 A_ZoomFactor(1.5)
		TPH1 C 1 A_Raise
		Loop
	
		Ready:
		TPH1 C 1 A_WeaponReady
		Loop
		
		AltFire:
		TPH1 C 0 A_ZoomFactor(1.5)
		TPH1 C 0 A_Takeinventory("sightsType25")
		TPH1 C 1 A_SelectWeapon("Type25")
		Goto Deselect
		
		Deselect:
		TPH1 C 0 A_Lower
		Loop
		
		Fire:
		TPH1 C 0 A_SetPitch (pitch-1.4)
		TPH1 C 1 A_GunFlash
		TPH1 D 2 A_FireBullets(2, 1, 1, 2, 0, 1)
		TPH1 C 1 A_ReFire
		Goto Ready
	}
}

RE: Game Crashes when Killed while ADS

Posted: Wed Dec 18, 2013 11:44 pm
by Ænima

Code: Select all

        Deselect:
        TPH1 C 0 A_Lower
        Loop
Probably that.

http://en.wikipedia.org/wiki/Infinite_loop

RE: Game Crashes when Killed while ADS

Posted: Wed Dec 18, 2013 11:49 pm
by Fabysk
Ænima wrote:

Code: Select all

        Deselect:
        TPH1 C 0 A_Lower
        Loop
Probably that.
No luck, that didn't work :(

EDIT: I figured out the problem. Thanks anyways Ænima

RE: Game Crashes when Killed while ADS

Posted: Thu Dec 19, 2013 12:12 am
by Ænima
Fabysk wrote:
Ænima wrote:

Code: Select all

        Deselect:
        TPH1 C 0 A_Lower
        Loop
Probably that.
No luck, that didn't work :(
No I mean that's what's causing the crash. There has to be a state with at least 1 tic duration in a Deselect state somewhere. When you die, you don't switch to another weapon, but your current weapon loops its Deselect state. Since yours has zero delay, it causes a crash.

RE: Game Crashes when Killed while ADS

Posted: Thu Dec 19, 2013 12:36 am
by Fabysk
Ænima wrote: No I mean that's what's causing the crash. There has to be a state with at least 1 tic duration in a Deselect state somewhere. When you die, you don't switch to another weapon, but your current weapon loops its Deselect state. Since yours has zero delay, it causes a crash.
I just realized that; with a surprise seeing that it was supposed to be at 1. I'm getting better at DECORATE little by little. Thanks for the help :smile: