Page 1 of 1

Selecting a weapon hangs GZdoom

Posted: Tue Aug 04, 2009 22:06
by chopkinsca
I have a axe that can be leveled up. It works fine for the most part. The exception is at axe level 3, selecting the axe while you already have it selected will cause GZdoom to hang.

The acs/decorate is here: http://zdoom.pastebin.com/m22a73c74

and my keyconf:
weaponsection Phocas2
setslot 1 handaxe handaxe0 handaxe1 handaxe2 handaxe3 handaxe4 handaxe5 handaxe6 handaxe7 handaxe8 handaxe9 SmokeFist
And script 440

Code: Select all

// 1 = take, 2 = give
script 440 (int takeorgive){
	print(d: takeorgive);
	if(takeorgive ==  1) {
		TakeActorInventory(255, "haveaxe", 1);
	}
	
	if(takeorgive == 2) {
		GiveActorInventory(255, "haveaxe", 1);
	}
}
I don't understand why it works fine until it gets to level 3.

Re: Selecting a weapon hangs GZdoom

Posted: Wed Aug 05, 2009 18:41
by Cherepoc
I don't understand why it works fine until it gets to level 3.
So do I :D . From the code you posted here I understand only one thing - your code isn't looking good :D .
Use inheritance in decorate. Your axes have same properties and states, exept Fire states. So something like this

Code: Select all

ACTOR handaxe0 : Weapon 
{
   
   Weapon.AmmoUse 0 
   weapon.kickback 130  
   Weapon.SelectionOrder 1000
   +noalert 
   DamageType Axe
   
   States
   {
   Ready:
      MYAX A 1 A_WeaponReady
      Loop
   Deselect: 
          NULL A 0 acs_executealways(440, 0, 1) 
      MYAX A 1 A_Lower
      goto deselect +1
   Select: 
      NULL A 0 acs_executealways(440, 0, 2)
      MYAX A 1 A_Raise
      goto select +1
   Fire:
      MYAX B 5
      MYAX C 5 
      MYAX D 1 A_PlayWeaponSound("axswing")  //axswing
      MYAX D 1 A_CustomPunch(2, 0, 0, "MyAxePuff", 75)  //MyAxePuff sickfogpuff
      MYAX D 3 
      MYAX E 6
      MYAX A 1 A_ReFire
      MYAX A 4
      Goto Ready
   }
}

ACTOR handaxe1 : handaxe0
{
   States
   {
   Fire:
      MYAX B 5
      MYAX C 4 
      MYAX D 1 A_PlayWeaponSound("axswing")  //axswing
      MYAX D 1 A_CustomPunch(2, 0, 0, "MyAxePuff", 75)  //MyAxePuff sickfogpuff
      MYAX D 1 
      MYAX E 6
      MYAX A 1 A_ReFire
      MYAX A 4
      Goto Ready
   }
}
looks better :D
Also, why are you using 1 and 2 as give and take for script 440? You can use true/false where 0 - false, and non-zero - true.

Code: Select all

//0 - take, 1 - give
script 440 (int give)
{
   print(d: give);
   if(give)
      TakeActorInventory(255, "haveaxe", 1);
   else
      GiveActorInventory(255, "haveaxe", 1);
}
About subj - what you posted here isn't enough (well, for me :D ). Can't you post the wad here?

Re: Selecting a weapon hangs GZdoom

Posted: Wed Aug 05, 2009 20:29
by chopkinsca
Yeah, I was lazy when I didn't inherit the axes. Also no idea why I used 1 and 2 when I usually use 1 and 0. The wad is kind of big and would rather now give it to random people.

Re: Selecting a weapon hangs GZdoom

Posted: Wed Aug 12, 2009 0:03
by chopkinsca
Hmm, nobody seems to care. I suppose I could give someone the .wad, but it'd have to be someone I can trust. Not that my project is important in anyway. The only problem is the time it takes to get to the game hang.

Re: Selecting a weapon hangs GZdoom

Posted: Wed Aug 12, 2009 15:53
by Cherepoc
I suppose I could give someone the .wad, but it'd have to be someone I can trust.
You should have done that from the beginning. :D
Hmm, nobody seems to care.
Using the code you gave I made a zip (well, it's pk3 actually). Axe is gainnig exp when you press "b". And it doesn't hang. Thats all I can do with the info you gave.

Re: Selecting a weapon hangs GZdoom

Posted: Thu Aug 13, 2009 14:39
by Firebrand
Doing a quick check of this... I didn't found any apparent problems, maybe the problem is somewhere else... more deep on the engine.

Re: Selecting a weapon hangs GZdoom

Posted: Thu Aug 13, 2009 17:50
by chopkinsca
Okay, whatever it was, it's fixed in the newest SVN.

Re: Selecting a weapon hangs GZdoom

Posted: Thu Aug 13, 2009 22:47
by Graf Zahl
Good to know. There was a bugfix in the weapon selection code recently that could cause it to hang.