Results 1 to 8 of 8
  1. #1
    MSgt. Shooter Person
    Join Date
    Feb 2011
    Location
    Java
    Posts
    55
    Gamer IDs

    Gamertag: godzab

    Default Unreal KismetAction help

    Hello it has been a long time since I have used UDK, so I am a little rusty with unrealscript. I am trying to make a Unrealscript code that checks if the InputLinks(1) has a impulse, and if it does then it will display a message saying it worked. Here is the code:

    Code:
    class SeqAction_1 extends SequenceAction;
    
    //whats gonna happen when a input is triggered
    event Activated()
    {
    	if(InputLinks[1].bHasImpulse)
    	{
    		WorldInfo.Game.Broadcast(self, "Well the node worked"); 
    	}
    }
    
    defaultproperties
    {
    	ObjName="SeqAction_1"
    	ObjCategory="UnrealScript Actions"
    
    	InputLinks(1)=(LinkDesc="Input")
    }

    The problem is this error comes:
    Code:
    C:\UDK\UDK-2010-07\Development\Src\Eat3dUnrealScript\Classes\SeqAction_1.uc(9) : Error, 'WorldInfo': Bad command or expression
    How do I fix this?
    Thanks, godzab
    Last edited by Godzab; 07-06-2012 at 11:06 PM.
    godzab

  2. #2
    Redeemer
    Join Date
    Dec 2008
    Location
    Germany
    Posts
    1,237

    Default

    Only Actors have direct access to the WorldInfo. Kismet classes all extend from Object and can only get a reference to the WorldInfo either from an Object variable (casted to Actor), the static GetWorldInfo() function (WorldInfo.uc) or the function GetWorldInfo() in the base class of all kismet stuff (SequenceObject.uc).
    2B || !(2B)

  3. #3
    MSgt. Shooter Person
    Join Date
    Feb 2011
    Location
    Java
    Posts
    55
    Gamer IDs

    Gamertag: godzab

    Default

    So how would i make a object then cast it to actor, then use the worldinfo function?
    godzab

  4. #4
    Banned
    Join Date
    Feb 2011
    Location
    BXL/Paris
    Posts
    2,169

    Default

    Just call GetWorldInfo().Game.Broadcast(None, "Well the node worked");
    Last edited by VendorX; 07-08-2012 at 06:12 AM.

  5. #5
    MSgt. Shooter Person
    Join Date
    Feb 2011
    Location
    Java
    Posts
    55
    Gamer IDs

    Gamertag: godzab

    Default

    Thank's for the help, but now i am getting another error:
    Code:
    C:\UDK\UDK-2010-07\Development\Src\Eat3dUnrealScript\Classes\SeqAction_1.uc(9) : Error, Type mismatch in Call to 'Broadcast', parameter 1
    here is the new code:
    Code:
    // extend UIAction if this action should be UI Kismet Action instead of a Level Kismet Action
    class SeqAction_1 extends SequenceAction;
    
    //whats gonna happen when a input is triggered
    event Activated()
    {
    	if(InputLinks[1].bHasImpulse)
    	{
    		GetWorldInfo().Game.Broadcast(self,"Well the node worked");
    
    	}
    }
    
    defaultproperties
    {
    	ObjName="SeqAction_1"
    	ObjCategory="Eat3dUnrealScript Actions"
    
    	InputLinks(1)=(LinkDesc="Input")
    }
    godzab

  6. #6
    Banned
    Join Date
    Feb 2011
    Location
    BXL/Paris
    Posts
    2,169

    Default

    Change Self to None.

  7. #7
    MSgt. Shooter Person
    Join Date
    Feb 2012
    Posts
    265

    Default

    The 1st parameter of Broadcast asks for a Controller value, as you're working in a class that inherits Object, you're giving the function the wrong value by casting "self".

  8. #8
    MSgt. Shooter Person
    Join Date
    Feb 2011
    Location
    Java
    Posts
    55
    Gamer IDs

    Gamertag: godzab

    Default

    Thanks guys, now it works.
    godzab


 

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.