Archetypes:
These took me a little bit to figure out how to get them to actually affect my variables, but thanks to some help from Andrew Talarico I figured out a clean way to use them.
For instance I am using an archetype of my GUSProperties class which holds my variables for my GenericUpgradeScreen class. This way all my variables are in their own class(extending from Object) to avoid excess clutter when making the archetype.You can create an archetype by finding the class in the Actor Classes window(Usually next to the Content Browser tab in the Content Browser window.) and right clicking, and selecting 'Create Archetype'. Once you click on the archetype you just made, it will bring up a window showing all the variables that you have declared as editable in the editor. Making them editable can be done by adding () after var, for instance var() int Currency; If a word is put in the parentheses this will put the variable under a category of the same name in the archetype. For example, var(Inventory) int Currency; would make an int variable named Currency in the Inventory category. See below for examples:
If you are making a separate class to hold your variables, then the easiest way to make them work in your main class is by a variable of the properties class, and declaring what archetype is used in the default properties. See below for another code excerpt:
Calling an Actionscript Function:
This gave me a lot of trouble trying to find a way to do this that worked. I tried following the examples given on the UDN(More specifically Here) and I kept running into error after error, even after scouring the Unreal forums. Thanks to a tutorial by Lucas-Williams I was able to figure it out the rest of the way. I found that unless you know what you are doing with AS3 packages/classes/constructors you will have a lot of difficulties with just copying the code on the UDN. What Lucas-Williams did was strip the function down in AS3 and called it like they did in the UDN tutorial. I found that in order to get the Unrealscript call working for me I had to add root. before the AS3 function name in the Unrealscript ActionScriptVoid() function(Shown below).
Getting an Unrealscript variable:
This is pretty much directly taken from the UDN page on it, so not really any original work from me. Good info regardless. I recommend taking a look at the link above if you are interested. The one thing I would like to add to it is if you are trying to get multiple variables of the same type, in the switch(VarName) you can just add both names of the variables. You don't have to add another one to the switch(VarType) since they will both share a type.
I hope this helps you with your own projects.
No comments:
Post a Comment