Announcement

Collapse
No announcement yet.

slot machine not working (HasXp SeqCond)

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

    slot machine not working (HasXp SeqCond)

    hi i wrote some code for a slot machine where its a simple kismet trigger then it fires off a seqcond (sequence condition)has xp but the has xp isnt working can someone tell me what im doing wrong?the weirdest part of all is tha compare integers wasnt even working but the add xp code works.

    here is the video clip explaining it

    class SeqCond_HasXP extends SequenceCondition;


    //royces added code below
    const MAX_XP = 50;
    const XP_INCREMENT = 1; // Amount of XP that is added to the amount of XP required for a level, after each level progression
    var int Level; // Current level
    var int XPGatheredForNextXP; // Amount of XP gathered for the next level
    var int XPRequiredForNextXP; // Amount of XP required for the next level
    var() int Amount; // Amount of XP this action will give
    var int CalculateLevelProgress;
    var Actor TargetActor;
    var int UnitActor;
    var int XP;



    event Activated()
    {
    /*
    local XP XP;
    XP = HasXP(TargetActor);

    if (XP != none)
    {
    if (XP.m_arrInteractPoints.Length == 1)
    {
    OutputLinks[0].bHasImpulse = true;
    }
    else
    {
    OutputLinks[1].bHasImpulse = true;
    }
    }
    */
    }





    simulated function SlotMachineGambleXP()
    {
    local pawn pawn;

    pawn = Pawn(TargetActor);
    if (pawn != none)
    {
    return XP(pawn.GetXP());
    }
    else
    {
    return XP(TargetActor);
    }
    }






    defaultproperties
    {
    Name="Has XP Points"
    ObjCategory="CryoSoldier Custom codes"
    ObjName="Has XP Points"
    Level = 1; //royces custom xp code
    XP = 0; //royces custom xp code

    VariableLinks(0)=(ExpectedType=class'SeqVar_Object',LinkDesc="Target Actor",PropertyName=TargetActor)

    OutputLinks(0)=(LinkDesc="True")
    OutputLinks(1)=(LinkDesc="False")
    }


    Click image for larger version

Name:	111y.jpg
Views:	75
Size:	171.2 KB
ID:	1750987
    Last edited by RoyceVagner; 04-26-2020, 01:17 AM.

    #2
    RoyceVagner Your SlotMachineGambleXP() function is not declared to return a type. Declare the XP type in the function definition:
    Code:
    simulated function XP SlotMachineGambleXP()

    Comment


      #3
      Originally posted by Coldscooter View Post
      RoyceVagner Your SlotMachineGambleXP() function is not declared to return a type. Declare the XP type in the function definition:
      Code:
      simulated function XP SlotMachineGambleXP()

      i tried adding it but i think i smessed up where do i put that? im not the worlds best programmer.

      Comment


        #4
        class SeqCond_HasXP extends SequenceCondition;
        //royces added code below
        const MAX_XP = 50;
        const XP_INCREMENT = 1; // Amount of XP that is added to the amount of XP required for a level, after each level progression
        var int Level; // Current level
        var int XPGatheredForNextXP; // Amount of XP gathered for the next level
        var int XPRequiredForNextXP; // Amount of XP required for the next level
        var() int Amount; // Amount of XP this action will give
        var int CalculateLevelProgress;
        var Actor TargetActor;
        var int UnitActor;
        var int XP;



        event Activated()
        {

        local XP XP;
        XP = HasXP(TargetActor);

        if (XP != none)
        {
        if (XP.m_arrInteractPoints.Length == 0)
        {
        OutputLinks[0].bHasImpulse = true;
        }
        else
        {
        OutputLinks[1].bHasImpulse = true;
        }
        }

        }





        simulated function XP SlotMachineGambleXP()
        {
        local pawn pawn;

        pawn = Pawn(TargetActor);
        if (pawn != none)
        {
        return XP(pawn.GetXP());
        }
        else
        {
        return XP(TargetActor);
        }
        }






        defaultproperties
        {
        Name="Has XP Points"
        ObjCategory="CryoSoldier Custom codes"
        ObjName="Has XP Points"
        Level = 1; //royces custom xp code
        XP = 0; //royces custom xp code

        VariableLinks(0)=(ExpectedType=class'SeqVar_Object',LinkDesc="Target Actor",PropertyName=TargetActor)

        OutputLinks(0)=(LinkDesc="True")
        OutputLinks(1)=(LinkDesc="False")
        }
        Click image for larger version

Name:	Untitled2-copy.jpg
Views:	47
Size:	149.3 KB
ID:	1752349

        Comment


          #5
          When you're declaring
          Code:
          local XP XP;
          , you're saying that XP is of type XP, but based on the compiler error, you haven't declared the XP type.

          Just a guess, but should the XP type just be an int instead?

          Btw, you should use the code tags when posting code here, which makes it a little easier for others to read.

          Comment


            #6
            i tried adding

            local int XP;

            but it says its a bad definitin



            Originally posted by Coldscooter View Post
            When you're declaring
            Code:
            local XP XP;
            , you're saying that XP is of type XP, but based on the compiler error, you haven't declared the XP type.

            Just a guess, but should the XP type just be an int instead?

            Btw, you should use the code tags when posting code here, which makes it a little easier for others to read.
            Click image for larger version

Name:	Untitled2-copy.jpg
Views:	42
Size:	527.1 KB
ID:	1752501

            Comment


              #7
              so far ive been able to recmompile if the two return lines are removed so im assuming everything else is good?

              simulated function XP SlotMachineGambleXP()
              {
              local pawn pawn;

              pawn = Pawn(TargetActor);
              if (pawn != none)
              {
              return XP(pawn.GetXP());
              }
              else
              {
              return XP(TargetActor);
              }
              }

              Comment


                #8

                var int XP; global in class
                If you define it globally in the class. You can not use that define in a local function in that class.

                you can't define 2 types of
                XP
                in same file, not Globally and locally(only locally). Your saying the global type is an int but the local your saying it is a XP Class. That will not work.

                local XP XP; use just in this function local (AS LONG AS NOT DEFINED GLOBALLY)

                XP = HasXP(TargetActor);

                wheres this function at?
                HasXP(TargetActor); what does it return?

                Comment

                Working...
                X