Announcement

Collapse
No announcement yet.

Function in a Function

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Function in a Function

    How to spawn a Function in a function like for Instance


    This is my code :

    exec function HerosOn()
    {
    bHerosEnabled = True;
    return;


    function RestartPlayer( Controller aPlayer )
    {
    if (aPlayer.PlayerReplicationInfo.Team.TeamIndex==0)
    {
    aPlayer.PawnClass=Class'CCAliens';
    }
    else
    {
    aPlayer.PawnClass=Class'CCMarines'; }

    Super.RestartPlayer(aPlayer);
    } }


    ^ Gives me Error

    ERROR FUNCTION NOT ALLOWED HERE

    or some sort like that. Anyone know how too do this?

    #2
    Why would you want to define a function in another function? You need to write two seperate functions and then call one from the other.

    Comment


      #3
      How would this altar the script?

      Comment


        #4
        Re: Function in a Function

        Code:
        exec function HerosOn()
        { 
            bHerosEnabled = True;
            return;
            //Even if this does complie the code is going to return form the function right here because of the return call, so you're gonna wann put it after
            RestartPlayer(aPlayer);
        
            //Here's where return should be
        }
        
        function RestartPlayer( Controller aPlayer )
        {
        if (aPlayer.PlayerReplicationInfo.Team.TeamIndex==0)
        {
        aPlayer.PawnClass=Class'CCAliens';
            }
             else
            {
        aPlayer.PawnClass=Class'CCMarines'; }
         
        Super.RestartPlayer(aPlayer);   
        }

        Comment

        Working...
        X