ACS_ExecuteWithResult

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
The Ultimate DooMer
Posts: 2109
Joined: Tue Jul 15, 2003 5:29 pm
Location: Industrial Zone

ACS_ExecuteWithResult

Post by The Ultimate DooMer »

When I use ACS_ExecuteWithResult it doesn't work, what am I doing wrong:

Code: Select all

   	Use: 
      		PTN2 A 1 ACS_ExecuteWithResult (303, 0, 0, 0)
			PTN2 A 0 A_GiveInventory ("HealthBonus", 25)
			Stop

Code: Select all


script 303 (void)

{
if(currenthealth < health)
	{
	SetResultValue (1);
	}
if(currenthealth >= health)
	{
	SetResultValue (0);
	}
}
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

The result of ACS_ExecuteWithResult isn't used. A_GiveInventory succeeds giving the health bonus and sets the overall result is true.

Apparently there needs to be an A_JumpIfResult code pointer to use this...
User avatar
The Ultimate DooMer
Posts: 2109
Joined: Tue Jul 15, 2003 5:29 pm
Location: Industrial Zone

Post by The Ultimate DooMer »

Yay for inventory hacks :)

btw, is the Fail implemented yet? (it crashes when it goes off)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

Fail should be in.


Regarding the problem here: Why don't you give the HealthBonus inside the script? There you have access to all the data you need.
User avatar
The Ultimate DooMer
Posts: 2109
Joined: Tue Jul 15, 2003 5:29 pm
Location: Industrial Zone

Post by The Ultimate DooMer »

Because I don't want the item to be used if the health is at it's limit.

btw, the crash:
Spoiler:
Last edited by The Ultimate DooMer on Fri Jul 08, 2005 4:33 pm, edited 1 time in total.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

The only method to do that right now is to give the health inside the script - but only inside the 'if' that sets the result to 1.
User avatar
The Ultimate DooMer
Posts: 2109
Joined: Tue Jul 15, 2003 5:29 pm
Location: Industrial Zone

Post by The Ultimate DooMer »

But if the Fail state works then the inventory hack will work. (see above for the crash log)

The item code is here:

Code: Select all

ACTOR PotionOfLife : Inventory 30041
{  
   	+FLOATBOB
   	+INVBAR 
   	Inventory.Amount 1
   	Inventory.MaxAmount 20
   	+FLOATBOB +PICKUPFLASH +FANCYPICKUPSOUND 
   	Inventory.PickupMessage "potion of life" 
   	Inventory.Icon ARTIPTN2 

   	States 
   	{ 
   	Spawn: 
      		PTN2 ABC 4
			Loop
   	Use: 
      		PTN2 A 1 A_JumpIfInventory ("HealthLimit", 1, 2)
			PTN2 A 0 A_GiveInventory ("HealthBonus", 25)
			Stop
			PTN2 A 1
			Fail
   	} 
}
The hack itself works because it gives health when you're not at full and only crashes when you are at full.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

Which version are you using. Grubber didn't update the internal version string.

I can't get it to crash. Can you post the entire DECORATE lump or does something in there need some scripts as well?
User avatar
The Ultimate DooMer
Posts: 2109
Joined: Tue Jul 15, 2003 5:29 pm
Location: Industrial Zone

Post by The Ultimate DooMer »

I was using the one dated 29.06.05 but I updated to 05.07.05 and still got the crash. I can't find any mention of the Fail state in the changelog. Can you send me your version if it's any different?
User avatar
Grubber
Posts: 1031
Joined: Wed Oct 15, 2003 12:19 am
Location: Czech Republic
Contact:

Post by Grubber »

Here is last version.
User avatar
The Ultimate DooMer
Posts: 2109
Joined: Tue Jul 15, 2003 5:29 pm
Location: Industrial Zone

Post by The Ultimate DooMer »

That's the same one I have.
Locked

Return to “Editing (Archive)”