Announcement

Collapse
No announcement yet.

Function in a Function

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

  • replied
    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);   
    }

    Leave a comment:


  • replied
    How would this altar the script?

    Leave a comment:


  • replied
    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.

    Leave a comment:


  • started a topic Function in a Function

    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?
Working...
X