Results 1 to 6 of 6
  1. #1

    Unhappy Please HELP!!!!! Unable to call ActionScript function from UnrealScript and ...

    Hi everyone

    ScaleForm is driving me insane (of course I suppose it's not scaleform's fault! ). I can't just can't get it working. Here I have two problems:

    1.The call to the action script function doesn't work. I got it working once, but I can't get it to work again, and it had also the problem number 2

    2. When I finally got it working one way or the other, the updated text in the HUD was behind the initial values and it was like it's transparency had been reduced.

    I've attached an image, and also have included the code in my GFxMoviePlayer Class.

    The function UpdateItems calls the function asChangeItems which calls the actionscript function. but it just doesn't work. The thing that's working here is the "txtPoints.SetString("text", "NEW");" statement which as I said has problem number 2.





    See!??? The new value that I've set is "NEW" and the previous and initial value is "0". I have no clue whatsoever why this happens!!!



    WHAAAAAAAT'S WRONG???? HEEEEELP ME PLEASE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!! and thank you all.


    Code:
    class PuzGFxHudMovie extends GFxMoviePlayer;
    
    var GFxObject parentMC;
    var GFxObject txtPoints, txtItems;
    
    function UpdateItems(int amount)
    {
    	asChangeItems(amount);
    	txtPoints.SetString("text", "NEW");
    }
    
    function UpdatePoints(float amount)
    {
    	asChangePoints(amount);
    
    }
    
    function UpdateLevel(string LevelName)
    {
    	asChangeLevel(LevelName);
    }
    
    function asChangeLevel(string param1)
    {
    	ActionScriptVoid("root.TheirParent.ChangeLevel");
    }
    
    function asChangePoints(int param1)
    {
    	ActionScriptVoid("root.TheirParent.SetPoints");
    }
    
    function asChangeItems(int param1)
    {
    	//ActionScriptVoid("IncreaseObjectiveCount");
    	local array<ASValue> Params;
    
    	Params[0].Type = AS_Int;
    	Params[0].i = param1;
    
    	Invoke("root.TheirParent.SetItems", Params);
    }
    
    function bool Start(optional bool StartPaused=false)
    {
    	super.Start();
    	Advance(0);
    	return true;
    }
    
    
    function Init(optional LocalPlayer player)
    {
    	super.Init(player);
    
    	start();
    	Advance(0.f);
    
    	parentMC = GetVariableObject("root.TheirParent");
    	txtItems = GetVariableObject("root.TheirParent.txtItems");
    	txtPoints = GetVariableObject("root.TheirParent.txtPoints");
    }
    
    function TickHUD()
    {
    	//information will be updated here
    }
    
    DefaultProperties
    {
    	MovieInfo = SwfMovie'myHUD.myHUD'
    	bDisplayWithHudOff=TRUE
    	TimingMode=TM_Real
    	bPauseGameWhileActive=false
    	bCaptureInput=false
    }

  2. #2

    Default

    Good news guys! I solved problem number 2, though problem number 1 still persists.

    The thing is, until a few hours ago, the HUD just wouldn't show up. And I had to load the movie from Kismet. But now Kismet loads it, and US loads it too. So I deleted the Kismet events.

    PS. I think I've screwed up! I think I should've posted this thread in the Questions And Comunity Answers. If so, Sorry!
    Last edited by mnvoh; 07-12-2012 at 12:39 PM.

  3. #3

    Default

    First of all, you don't need both a Start() and Init() function. This is likely causing conflicts. Combine the two into one Start() or one Init() function. Do you have a hudwrapper class? If so, does it fire the Init() function? If so, then delete Start() entirely.

    Second...

    Be sure that parentMC, txtItems, and txtPoints do not return Accessed None errors in your Unreal Log window. If they do, then they aren't being cached, and are therefor unusable. If that is the case, then either your paths are wrong, or these display objects do not exist when you try to cache them.

    Third...

    Do you have a function: SetItems() in your ActionScript inside root.TheirParent?
    Put a trace statement in that function:

    Code:
    trace("SetItems: " + nameofargument);
    Then, enable Scaleform log messages in your Unreal log, and look for this trace statement to see if it fires at all, and if it has the correct value. (See this link: http://forums.epicgames.com/threads/...8#post27947388)

    If the function does not fire at all (you don't see the trace statement), then your path is wrong, or the object it lives in (TheirParent) does not exist when you try to use the function.

    If the value is wrong, then try a `log statement in your UnrealScript function just before the invoke, and look to see what the value is in Unreal.

    Code:
    `log("My Value = " @ Params[0].i);
    Last edited by Matt Doyle; 07-12-2012 at 01:50 PM.

  4. #4

    Default

    Thanks buddy, I solved it. Really appreciate it. I removed the Start() function (since I've called the init() from somewhere else) and replace the whole local array<ASValue> arams; Params[0].... with ActionScriptVoid("root.TheirParent.SetItems"); and now it works like a charm. Thanks again.

    Well actually I got one more problem, and this one has been hanging around much longer. I have derived a class from the "Volume" class of UDK. What this class does is when you enter it, it starts showing a particle system. But It just doesn't wanna work. Here's the code:

    By the way, this is all from WildICV's(I think that was his name!) tutorial from ContagionEntertainment. But it's given me a headache! I think the tutorial is for earlier versions.



    Code:
    class PuzVolume_Portal extends PuzVolume
    	placeable;
    
    var ParticleSystemComponent PortalParticle;
    
    simulated event touch(Actor other, PrimitiveComponent OtherComp, vector HitLocation, vector HitNormal)
    {
    	local PuzPawn puzp;
    	local PuzPlayerController PuzPC;
    
    	super.touch(other, OtherComp, HitLocation, HitNormal);
    
    	puzp = PuzPawn(other);
    	PuzPC = PuzPlayerController(puzp.Owner);
    PortalParticle.SetActive(true);
    	if(puzp != none)
    	{
    		if(PuzPC != none)
    		{
    			PortalParticle.SetActive(true);
    			PuzPC.bInPortal = true;
    		}
    	}
    }
    
    
    simulated event untouch(Actor other)
    {
    	local PuzPawn PuzP;
    	local PuzPlayerController PuzPC;
    
    	PuzP = PuzPawn(other);
    	PuzPC = PuzPlayerController(puzp.owner);
    
    	if(puzp != none)
    	{
    		if(puzpc != none)
    		{
    			PortalParticle.SetActive(false);
    			puzPC.bInPortal = false;
    		}
    	}
    }
    
    defaultproperties
    {
    	Begin Object class=ParticleSystemComponent name=ParticleSys1
    		Template=ParticleSystem'PuzzleGameContent.Particles.P_WP_ShockRifle_Ball'
    		bAutoActivate = false
    	End Object
    	PortalParticle = ParticleSys1
    	Components.add(ParticleSys1)
    
    	bStatic = false
    	bHidden = false
    }

  5. #5

    Default

    Sorry. Can't help you with that one. It's not Scaleform specific, so I would try posting your issue in the programming forum.

  6. #6

    Default

    Of course, you're right. But I just thought that you might be able to help and I avoid posting a new thread. still thanks a lot. You were of great help tonight.


 

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.