Results 1 to 5 of 5
  1. #1
    MSgt. Shooter Person
    Join Date
    Mar 2010
    Location
    Germany
    Posts
    292

    Default access Kismet Variable from Unrealscript (player controller)

    hi
    im trying to access a variable kismetvar from my playercontroller script but i get som errors....
    i tryed it this way after i saw something like this in some tutorials

    Code:
    	
    var SequenceVariable A;
    foreach AllActors(class'SequenceVariable', A)
    {
    	if(A.ObjName == "Speed")
    	{
    		 //Test
    	}
    }
    i think the problem is that SequenceVariable isnt a subclass from Actor, please correct me if im wrong
    anyway can someone help me plz

  2. #2
    MSgt. Shooter Person
    Join Date
    Sep 2009
    Location
    Arlington, TX
    Posts
    394

    Default

    You could use something like this, I am assuming "Speed" is a float...

    Code:
    var SequenceVariable A;
    var int i, Index;
    var Sequence GameSeq;
    var array<SequenceObject> AllSeqOBJs;
    var string NAMEofA;
    
    
    function findspeedanddostuff()
    
    		GameSeq = WorldInfo.GetGameSequence();
    		if(GameSeq != None)
    		{
    			GameSeq.FindSeqObjectsByClass(class'SequenceVariable', true, AllSeqOBJs);
    			for(i=0; i<AllSeqOBJs.Length; i++)
    			{
    				Index = i;
    				if (Index != INDEX_NONE) 
    				{	
    					A=SequenceVariable(AllSeqOBJs[i]);
    					NAMEofA = string(A.Name);
    					if (NAMEofA  == "Speed")
    					{
    						if (A.Float != 12345)
    						{
    							loginternal("Speed:  " @ A.Float);  
    						}
    						A.Float=9001;  //yes. that's the joke.
    					}
    					
    				}								
    			}		
    		}
    If this is the only kismet object you need from your playercontroller, I believe you can find the SequenceVariable subclass with your FindSeqObjectsByClass, to remove excess lines. Something more like:
    var SeqVar_Float A; ...
    GameSeq.FindSeqObjectsByClass(class'SeqVar_Float', true, AllSeqOBJs); ...
    A=SeqVar_Float(AllSeqOBJs[i]);...
    You would still want to find it by name if you have other floats in your kismet, and there may be a shorter way to compare the name than what I use...
    Just what is it you are doing, by the way?

  3. #3
    MSgt. Shooter Person
    Join Date
    Mar 2010
    Location
    Germany
    Posts
    292

    Default

    my aim is to setup my hud with kismet since its very hard (in my opinion) to create buttons and something with script... and what i need to say is its for a mobile game

    thanks anyway i will try it out now


    Edit:

    i've tested it but i get an error

    PHP Code:
    ....MobileVehiclePlayerController.uc(53) : ErrorUnrecognized member 'Float' in class 'SequenceVariable' 
    im sure that the .Float conversion dont work here

  4. #4
    MSgt. Shooter Person
    Join Date
    Sep 2009
    Location
    Arlington, TX
    Posts
    394

    Default

    Thats not a conversion, that is variable access. The compiler is right, of course, SequenceVariable does not contain a variable called Float, I was just going pseudo. SeqVar_Float has one called FloatValue and not "Float", so you could declare a float in your playercontroller:
    var Float B;
    and to make it match your kismet's float value, you would use:
    B = A.FloatValue
    You would also have to declare and iterate to "A" as SeqVar_Float rather as mentioned before.
    Is your game going to be ok doing it this way with different screen resolutions? Something to think about. This is the UT3 scripting forum, BTW.

  5. #5
    MSgt. Shooter Person
    Join Date
    Mar 2010
    Location
    Germany
    Posts
    292

    Default

    ok think i understand it...
    and it works now ... thanks@all


 

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.