Results 1 to 10 of 10
  1. #1
    Marrow Fiend
    Join Date
    Jun 2009
    Posts
    4,479

    Default Fetching a UC variable to kismet

    Hello!

    Currently in my project, the variables I define in my Unreal Script and the variables I define in my kismet are two entirely different enteties.
    This makes me constantly having to do a lot of workarounds and practically double everything I do.

    I know how to modifiy a variable defined in unrealscript in kismet by making custom kismet nodes. But what I need is a way to just refer to the variables in kismet. Just like the int variables we already have, but instead of being any number you put in there, it gets the variable that's in a class. It would make life a lot more easier for me.

    Here's an example:
    Say the variable I have class goes to 1000 during the game, displaying it on the hud, like a score for instance.
    Now I am using a kismet based savesystem, and in order to save the number I have to use a kismet based variable, rather than the one the class, simply because there is no way to fetch it.
    That means that every single time something can happen to the class variable, it also has to happen to the kismet variable, effectively doubling the work time.

    So, is there a way to simply, get the variable defined in a class, into kismet?
    I don't mean a way to modify it, but just simply a way to fetch what it says.

    I tried making a variable where it just refers to the class variable instead of the input, but it didn't seem to do anything, and still acted the same as the normal one in kismet.
    Last edited by Graylord; 03-25-2011 at 01:16 PM.

  2. #2
    Marrow Fiend
    Join Date
    Jun 2009
    Posts
    4,479

    Default

    Doing something like this seems to work, I am not sure:
    Code:
    class SeqVar_Wood extends SequenceVariable;
    
    
    var(Resource) int WoodTest;
    
    
    DefaultProperties
    {
        ObjName = "Wood"
        ObjCategory = "Resources"
        ObjColor=(R=0,G=255,B=255,A=255)
    }
    But I have to get a remote variable, instead of defining it in the same class, but I am not that versatile with UScript, at least not yet.
    I am trying to call this variable:
    SRGame(GetWorldInfo().Game).Wood
    Last edited by Graylord; 03-28-2011 at 06:51 AM.

  3. #3
    Prisoner 849
    Join Date
    Apr 2010
    Posts
    891

    Default

    Instead of a separate action, to "get" the value use the existing "Object Property->GetProperty, Modify Property" action. They can basically "fetch" most simple script types (i had problems with arrays) by name.

    Since getting the current gameinfo class is not a default action, try this:

    1: Get a local player or whatever actor
    2: for this actor try the kismet GetProperty with "WorldInfo", output to a normal "Object" variable
    3: on this "Object" than again GetProperty "Game"
    4: on the resulting Object again call GetProperty "MyVarName" for the variable u need and set the output kismet variable to a matching type like int/float

    This should give u the value your variable holds.

    Now u just need a way to handle updates, either with a timer or u hook this seq. right before u want to save something.

    bye Andy

    PS: I never used this much, but maybe there is a way to directly define the name to "WorldInfo.Game..." so u don't need separate chained class.

  4. #4
    Iron Guard
    Join Date
    Sep 2009
    Location
    England
    Posts
    734

    Default

    This would be easy to do if only we could create custom data stores (hint, hint)
    Knowledge should be shared with everyone. Technique however, is your own thing.

    My UnrealScript Lessons
    My Blog

    I'm working full-time, so I'm not available for freelance work, sorry.

  5. #5
    Marrow Fiend
    Join Date
    Jun 2009
    Posts
    4,479

    Default

    Quote Originally Posted by AndyPandy View Post
    1: Get a local player or whatever actor
    2: for this actor try the kismet GetProperty with "WorldInfo", output to a normal "Object" variable
    3: on this "Object" than again GetProperty "Game"
    4: on the resulting Object again call GetProperty "MyVarName" for the variable u need and set the output kismet variable to a matching type like int/float
    Doesn't seem to work.

    Have I set it up right?
    This Image Was Automatically Resized by using the Screenshot Tag.  Click to view the full version
    When the game starts, the player get 1000 wood, and it saves it (I have put in an active delay, so it doesn't try do both at once, after I took the screen).
    I also have a loading sequence, which I do know works, that loads the named variable "Wood" on game start.

    So, the next time the player starts the game, he should get 1000 wood, load another 1000 wood, then save it. And so on.

    But it doesn't seem to work. =\
    "0" is added to the variable. The variable is saved, but it's zero.

  6. #6
    Marrow Fiend
    Join Date
    Jun 2009
    Posts
    4,479

    Default

    Any other ideas then?

  7. #7
    Prisoner 849
    Join Date
    Apr 2010
    Posts
    891

    Default

    Quote Originally Posted by Graylord View Post
    Any other ideas then?
    Your first WorldInfo starts with nothing as target, connect a "Player" variable to "target". It always needs a target to get the property.

  8. #8
    Marrow Fiend
    Join Date
    Jun 2009
    Posts
    4,479

    Default

    Ah, I'm not at the computer right now, but I'll try that when I get home.

  9. #9
    Marrow Fiend
    Join Date
    Jun 2009
    Posts
    4,479

    Default

    Sorry, still nothing.

    I still believe it would be easier to just have the variable node and be done with it.
    The saves are done automatically by the actions the player does, so it would be preferable.
    Last edited by Graylord; 04-03-2011 at 06:03 PM.

  10. #10
    Prisoner 849
    Join Date
    Apr 2010
    Posts
    891

    Default

    Sure, if nothing "default" works than u have to write your own kismet action that pulls the variables from script and output it to kismet vars, so u can save those.
    If its just for saving u can simply let the Actor via script handle the output links. What i mean is that by default a kismet action is handled by the target objects handler function. So as example "Toggle" will try to call a "OnToggle" function inside the actor. So u might be able to just call a "OnSave" function on the actor and the actor logic just adds whatever data it want to save, than all those are handed to the save function.

    bye Andy


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.