Sunday, January 20, 2013

Yet Another Menu Update

Hey guys,

Just a quick update, I converted all of my functions for my GenericUpgradeScreen to use the .SetText() and .GotoAndStopI() features I talked about in my last post. I've got to say, that cleared up a bunch of my code! I now have about half, maybe less, of what I had before and it works a little better I think.

Since that was all I had to say about my progress I might as well say something about a website my roommate found. It's called Challenge Accepted and it is pretty cool. It is a task management system that combines the joy of leveling up in video games with the activities of real life. You create quests for yourself that have different tasks in them. As you complete the tasks you check it off and get experience for it. Once you've completed enough tasks/quests/odysseys you'll level up. The quests can be anything you want, from get homework done to take over the world. It's still in the development stages, but it's pretty neat. Check it out!

Sunday, January 13, 2013

Update On The Menus

After looking through a mess of tutorials and forum posts I finally got my points pickup to work with my GFxMoviePlayer class for the upgrade screen. I ended up having to restructure how I was handling my points. I had originally had them declared and stored in that GFxMoviePlayer class, but I found that storing them in my Pawn class ended up being more accessible to a variety of classes when trying to adjust them. Since I could fully test the upgrade screen, since I could adjust how many points I could pick up, I was able to find a couple bugs in the system. I was able to fix all but one, and I haven't had a chance to troubleshoot the remaining one more to figure out why it's not working correctly.

If you are interested here is my code for the pickup. Not much there but this seemed to be the only way that worked for me getting the Pawn:

class PointPickup extends Actor placeable ClassGroup(GenericMenus, Placeables) HideCategories(Advanced, Movement, Display, Attachment, Collision, Physics, Debug, Mobile); var(Points) int Points; var GenericPC GPC; var GenericPawn GP; event Touch(Actor Other, PrimitiveComponent OtherComp, vector HitLocation, vector HitNormal) { GPC = GenericPC(GetALocalPlayerController()); GP = GenericPawn(GPC.Pawn); GP.PlayerPoints += Points; Destroy(); } defaultproperties { Points = 100 bCollideActors = true Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment bEnabled=true End Object Components.Add(MyLightEnvironment) Begin Object Class=StaticMeshComponent Name=PickupMesh StaticMesh=StaticMesh'UN_SimpleMeshes.TexPropCube_Dup' Materials(0)=Material'EditorMaterials.WidgetMaterial_Y' LightEnvironment=MyLightEnvironment Scale3D=(X=0.125, Y=0.125, Z=0.125) End Object Components.Add(PickupMesh) Begin Object Class=CylinderComponent Name=CollisionCylinder CollisionRadius=16.0 CollisionHeight=16.0 BlockNonZeroExtent=true BlockZeroExtent=true BlockActors=true CollideActors=true End Object CollisionComponent=CollisionCylinder Components.Add(CollisionCylinder) }

While looking through some tutorials I also found a way to change Flash elements directly from UnrealScript, which cuts down on memory overhead by eliminating redundant functions in Unrealscript and Actionscript.

Here is how to change a text in a text box:

var GFxObject RootMC; RootMC = GetObjectObject("_root.textboxInstanceName"); RootMC.SetText("Insert Text Here");

And here you can go to a frame of a movieclip:

RootMC = GetVariableObject("_root.movieclipInstanceName"); RootMC.GotoAndStopI(2); RootMC.GotoAndStop("Start");

I put two examples of how to go to a frame within a movie clip. The first one GotoandStopI() expects an integer as a parameter(that is why there is an "I" at the end) while GotoAndStop() expects a string. The string has to match a keyframe label you assigned in Flash.

Knowing how to do this now, I want to go back through the upgrade screen and optimize it more. Right now I have duplicate functions in AS3 and Unrealscript to get them to communicate all the information I needed to get through. With this I can do away with the hacky way of getting Unrealscript variables into AS3.

Thanks for reading, if you ever have any questions about my work, or suggestions on how to improve, don't hesitate to comment. I'm still new to this but will try and help as much as I can.

*On a side note: BlogTrog is a great little resource for making the code windows above. You just paste your text into the textfield on their site and select the language and it does the rest. Unfortunately they don't have Unrealscript or Actionscript 3 as languages you can select, but C# comes close in terms of highlighting.

Monday, January 7, 2013

Menu Update

Hey guys!

I finished up my menus, so now I have a main menu, pause menu, and upgrade screen that I can reference. I got them all working how I want them to, and put into a map. Now I'm working on creating a pickup to add some points to help test the upgrade screen. After I get that completed I'll most likely work on getting a functional HUD down, but I need to look a lot closer at how they have their's implemented. I hope to be able to redo my Scaleform tutorial after I get all of this figured out.

Unfortunately, I'll probably have to slow my progress on this side project because we're starting back at school this week. I'll be working on some animations for our zone and laying out some more content.

Thank you for reading!

Thursday, January 3, 2013

Another Little Update - Generic Menus

As I mentioned in my last post I've been working on some generic menus that I can use in many different situations. I've mostly been working on an upgrade screen the past couple days. It has a three items/skills that can be upgraded if you have the correct amount of money/points. I thought I had the Flash/AS3 side of it done, but as I'm working through the Unreal side of it I found a lot of ways to improve what I already had. By trying to streamline my code I figured out how to use an archetype to quickly edit variables in the editor, as well as how to call an AS3 function from Unrealscript and how to get an Unrealscript variable and use it in AS3. I figured I'd post what I've found out for you guys.

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.