View Full Version : UIScenes and Unrealscript
02-11-2010, 05:05 AM
Im trying to make a UIScene that takes variables from an array in my Pawn, and displays them next to appropriate labels in the scene. I understand that its possible to do with datastores and I tried to read the UDN article on the topic but Im having trouble figuring it out. I think I want to use datastores because I eventually may have to implement a saving feature but understanding an Unrealscript.
So Im looking for a tutorial or some easier documentation about how to integrate the UIScene and the script. The UDN article looks like it is complete enough but I really need a better starting point.
02-11-2010, 05:26 AM
It's really, really easy to get a variable associated with a player into a datastore, since one already exists for this purpose. Simply declaring a variable as "databinding" in the PlayerReplicationInfo is enough. For instance, here is the code of my PRI which makes health available to the UI:
class SPlayerReplicationInfo extends PlayerReplicationInfo;
/** Health of player's current Pawn. */
var databinding private int Health;
function SetHealth(int NewHealth)
Health = NewHealth;
SetHealth needs to be called by the pawn every time its health changes. A widget can then access the value of health with this markup:
02-11-2010, 06:52 AM
Thanks! That helps alot. Ill probably be back when I attempt saving!
02-11-2010, 07:31 AM
Actually Im having an issue with updating the variables while the UIScene is open. Im basically trying to update a message attached to the widget. Is there a tickbox to keep the widget dynamic?
02-11-2010, 07:58 AM
That's something I wanted to find out myself. The UDN suggests that it is possible, but I have no idea how. Currently I'm using a brute-force solution of refreshing the value every tick (set bShouldPerformScriptTick=true for a UIScene to be ticked).
02-11-2010, 02:51 PM
Im having trouble locating bShouldPerformScriptTick in the UIScene. Or do I have to create a class that references the UIScene? If so how do I do that?
02-11-2010, 03:11 PM
It's one of those things that must have been added specifically for UT3, because it's in UTUIScene. If you don't want to extend from that class, you'll have to have an actor do the ticking for you, or come up with a different solution.
p.s. you can make life much easier for yourself if you have a quick way to search through the source (http://forums.epicgames.com/showthread.php?t=715150).
02-11-2010, 03:52 PM
The trouble lies in creating a class that subclasses UTUIScene because I cant figure out how to connect the subclassed object with the UIScene that I made in the editor. I found where to set the bShouldPerformScriptTick by searching through the API. I just need to connect the class to the scene.
02-11-2010, 04:17 PM
To get a uiscene from a subclass you programmed you have to make a new one (i think that's the only way sadly) and selecting your subclass as the scene class.
So, in the content browser, you right click, select new uiscene, and in the UIScene class select your subclass.
In your subclass you can acces almost anything if you just call getworldinfo() :S
I don't really know abour datastores though...
Hope this solves your problem, and sorry for my english.
02-11-2010, 06:06 PM
Thanks chess thats exactly what I was looking for.
As for the script tick prob I currently have this as my menu class:
class BioGUI_Crafting_Menu extends UTUIScene;
I made a cheap-o workaround in kismet where I close and reopen the scene after each button click and it seems to be working but I want to make sure Im grasping the UIScene Unrealscript stuff.
Am I supposed to use the TickScene event to refresh my datastores? So I basically call my Update functions in my PlayerReplicationInfo class every tick?
02-11-2010, 08:24 PM
Well, like i said i don't know about datastores since i'm fairly new to udk and i never really had to use them... the way i work with dinamic UIScenes is contacting the worldinfo and getting the variables i need (variables changed by events, functions, whatever, if it is on the gameinfo or the player controller or anywhere you can acces it, you can use it). And of course the OnClicked properties of the buttons and the SetValue and SetImage functions.
02-11-2010, 08:48 PM
...Am I supposed to use the TickScene event to refresh my datastores? So I basically call my Update functions in my PlayerReplicationInfo class every tick?
Well, you're not supposed to. Doing it this way is terribly inefficient, and I'm only doing it to get things working until I can find a better solution. But until then, I just call RefreshSubscriberValue every tick on whatever widgets need it.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.