I am trying to create a bush that the player can pick berries from. Sadly I run into several problems.
This is my code:
Code: Select all
class Bush : Actor
{
	//$Category "DecoNature"
	//$Arg0 Has Berries
	//$Arg0Type 11
	//$Arg0Enum falsetrue
	int HealingPower;
	property HealingAmount: HealingPower;
	
	Default
	{
		Bush.HealingAmount 10;
	}
	
	override bool Used (Actor user)
	{
		if (user && args[0])
		{
			if (user.health < 100)
			{
				HealThing(Bush.HealingAmount,200);
				//HealThing(HealingAmount,200);
				//HealThing(10,200);
				args[0] = false;
				return true;
			}
		}
		return false;
	}
}
class BushSmall : Bush
{
	Default
	{
		Radius 8;
		Height 16;
		Bush.HealingAmount 10;	
	}
	
		
	States
	{
	Spawn:
		BUS1 A -1 NoDelay
		{
			if(args[0]) {return ResolveState("HasBerries");}
			else {return ResolveState("NoBerries");}
		}
	HasBerries:
		Bus1 A -1;
		Loop;
	NoBerries:
		Bus1 B -1;
		Loop;
	
	}
}
The custom property "HealingAmount" I define in the class Bush does not work when trying to address it in the "Used" function.
If I use "HealingAmount", I get the error "Unknown Identifier "Healing Amount"". If I use "Bush.HealingAmount", I get "HealingAmount is not a member of BUSH"
If I use an int (i.e., 10), the script compiles. However, I would like to have bushes of different sizes and being able to just change the HealingAmount would be great. Also not getting custom properties to run, might be an issue I will run into again, so I thought to better ask now^^
Issue 2: If I get the script to compile, I do not seem to be able to interact with the bushes. Do I have to give them some special flag or set a specific option in the map editor? I got the Used function from here: https://zdoom.org/wiki/Used. None of the "actor specials" seem to do what I want them to either.
Thanks in Advance!
