Hello again, I’m working with xml data and an xml reader.
If I have an object like this:
public class RPG_Item
{
public string Name;
public bool Useable_OnField;
public bool Useable_InBattle;
public int Effect_Base;
public enum StatusEffect { Dodge, Mana, DodgeEachTurn, ManaEachTurn }
public StatusEffect statusEffect;
public int Effect_EachTurn_NumberOfTurns;
public enum Range { Close, Far, Any }
public Range range;
public enum UsedOn { OneAlly, AllAllies, Enemy, AllEnemies, Everyone }
public UsedOn usedOn;
public List<string> AnimationEcmds = new List<string>(); //example will be like: PlayAni(40,pos goes here) where 40 is ID and pos could be a battle character or o_object on the field.
}
Is there a way to fill all of these values with empty data when initializing the object? Here’s an example:
RPG_Item rpg_TestItem = new RPG_Item ();
I then have to populate it for it to show up in the xml file, which means I have to create dummy values like so:
rpg_TestItem.Name = "Potion";
rpg_TestItem.Useable_OnField = true;
rpg_TestItem.Useable_InBattle = true;
rpg_TestItem.AnimationEcmds.Add ("Ani_Play(PotionAnimation1,LocationGoesHere,DoWait)");
rpg_TestItem.AnimationEcmds.Add ("Wait(150)");
rpg_TestItem.Effect_Base = 10;
rpg_TestItem.statusEffect = RPG_Item.StatusEffect.Mana;
rpg_TestItem.Effect_EachTurn_NumberOfTurns = 1;
rpg_TestItem.range = RPG_Item.Range.Any;
rpg_TestItem.usedOn = RPG_Item.UsedOn.OneAlly;
After creating these values I can then save the file, then open my xml editor and add new entires, remove entries etc… to make the basic data for the game.
I’m wondering if I can do something like:
RPG_Item rpg_TestItem = new RPG_Item ();
rpg_TestItem - > Fill all entires with null/blank data
Just to make it simpler, so that when I add a new entry to the class itself I don’t have to keep going back and forth and add values to the initial dummy item.