Results 1 to 5 of 5
  1. #1

    Default Delegate Assignment Failed?

    God this error is getting so annoying...............
    Keeps saying XInterface.GUIButton: Delegate Assignment Failed.

    Kinda getting on my nerves.... the Menu works 100% perfectly... i change a value of the Name of a button... then it brings up that error... ctrl+z to undo that name change... and it still gives me that error... Where does the error come from?

    The error is hooking at OnClick=InternalOnClick

    I never even changed the Onclick, only thing i changed was the Name of the button.

    Code of one of the buttons:
    Code:
    	Begin Object Class=GUIButton Name=ExitMenu
    		Caption="Exit Menu"
    		WinWidth=0.2
    		WinHeight=0.04
    		WinLeft=0.65
    		WinTop=0.75
    		bBoundToParent=true
    		OnClick=InternalOnClick
    	End Object
    	Controls(3)=GUIButton'ExitMenu'
    Heres my internalonclick
    Code:
    function bool InternalOnClick(GUIComponent Sender)
    {
        P = PlayerOwner().Pawn;
    	if (Sender==Controls[1])
    	{
           P.GiveWeapon("xweapons.RocketLauncher");
           P.ClientMessage("You have bought Rocket Launcher");
    	}
    	if (Sender==Controls[2])
    	{
            P.GiveWeapon("xweapons.flakcannon");
    	    P.ClientMessage("You have bought Flak Cannon");
    	}
    	if (Sender==Controls[3])
    	{
            P.GiveWeapon("xweapons.SniperRifle");
    	    P.ClientMessage("You have bought Sniper Rifle");
    	}
    	else
    	Controller.CloseMenu(false);
    
        return false;
    }
    But im pretty sure that code is correct
    Last edited by caudex; 05-10-2007 at 11:27 PM.

  2. #2
    MSgt. Shooter Person
    Join Date
    Jul 2006
    Location
    Inna Jungle
    Posts
    255

    Default

    It looks correct on first glance.

    This from UnrealWiki:
    Delegate assignment failed
    You tried to assign a function to a delegate property, but the function's parameters and/or return value don't match the delegate's parameters and/or return value.
    But, I see your return value is there, those are the OnClick arguements. Hmm...

    The only thing I see that's different from what I work with is you've set the button to "Controls[x]", instead of defining a separate GUIButton variable name, like
    Code:
    var GUIButton Button1, Button2, Button3;
    . Maybe try that. The only other thing I can think of is to double-check the other buttons.

  3. #3

    Default

    Sometimes the compiler simply refuses to assign delegates in defaults for no obvious reasons. In such a case you could assign the delegate in InitComponent(), which should always work.
    Wormbo's UT/UT2004/UT3 mods | PlanetJailbreak | Unreal Wiki | Liandri Archives

    <elmuerte> you shouldn't do all-nighters, it's a waste of time and effort
    <TNSe> nono
    <TNSe> its always funny to find code a week later you dont even remember writing
    <Pfhoenix> what's worse is when you have a Star Wars moment
    <Pfhoenix> "Luke! I am your code!" "No! Impossible! It can't be!"
    Note that your questions via PMs will be ignored if they actually belong in the forum.

  4. #4

    Default

    If i assign the delegate in InitComponent how would i be able to declare the Control()?

  5. #5
    MSgt. Shooter Person
    Join Date
    Oct 2006
    Posts
    153

    Default

    Isn't having numbers in variable names a no-no?
    All my mods can be found HERE


 

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.