Download

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”)
}

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



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.

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")

}

When you’re declaring


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.

i tried adding

local int XP;

but it says its a bad definitin

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

}

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?