Object doesnt spawn ?

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

zupafly

New Member
Aug 13, 2004
147
0
0
Ive made a karma ball which works fine if i put it into a map in unrealed.
I coded it to use it as a powerup: (the powerup spans this class underneath, but it doesnt work...)

this is my code for the ball itself
Code:
class RcBal extends KActor
placeable;

var() float MaxNetUpdateInterval;
var float NextNetUpdateTime;

var KRigidBodyState KState, KRepState;
var bool bNewKState;
var int StateCount, LastStateCount;

replication
{
    unreliable if(Role == ROLE_Authority)
        KRepState, StateCount;
}

function Tick(float Delta)
{
    PackState();
}

//Pack current state to be replicated
function PackState()
{
    local bool bChanged;

    if(!KIsAwake())
        return;

    KGetRigidBodyState(KState);

    bChanged = Level.TimeSeconds > NextNetUpdateTime;
    bChanged = bChanged || VSize(KRBVecToVector(KState.Position) - KRBVecToVector(KRepState.Position)) > 5;
    bChanged = bChanged || VSize(KRBVecToVector(KState.LinVel) - KRBVecToVector(KRepState.LinVel)) > 1;
    bChanged = bChanged || VSize(KRBVecToVector(KState.AngVel) - KRBVecToVector(KRepState.AngVel)) > 1;

    if(bChanged)
    {
        NextNetUpdateTime = Level.TimeSeconds + MaxNetUpdateInterval;
        KRepState = KState;
        StateCount++;
    }
    else
        return;
}

//New state recieved.
simulated event PostNetReceive()
{
    if(StateCount == LastStateCount)
        return;
}

//Apply new state.
simulated event bool KUpdateState(out KRigidBodyState newState)
{
    //This should never get called on the server - but just in case!
    if(Role == ROLE_Authority || StateCount == LastStateCount)
        return false;

    //Apply received data as new position of actor.
    newState = KRepState;
    StateCount = LastStateCount;

    return true;
}

defaultproperties
{

     MaxNetUpdateInterval=0.5
     Physics=PHYS_Karma
     StaticMesh=StaticMesh'RcStatic.bal'
     bAlwaysRelevant=True
     RemoteRole=ROLE_SimulatedProxy
     bNetNotify=True
     Begin Object Class=KarmaParams Name=KarmaParams0
         Kmass=2.5000000
         KStartEnabled=True
         bClientOnly=False
         bKAllowRotate=True
         KFriction=1.000000
         KRestitution=1.000000
         KImpactThreshold=1.000000
         Name="KarmaParams0"
     End Object
     KParams=KarmaParams'RcRacing.RcBal.KarmaParams0'
     drawScale=0.5;
}

The code above the defaultproperties are for multiplayer, something has to be wrong in my defaultproperties I think...

I dont know if this coding is right but I cant even summon the ball.
 
Last edited by a moderator:

zupafly

New Member
Aug 13, 2004
147
0
0
there is no error or warning about it in my log file. Maybe its because its spawned at location of the pawn ? Can anyone tell me how I spawn it behind the pawn so it doesnt get stuck into it or something ?
 

zupafly

New Member
Aug 13, 2004
147
0
0
Thx alot ! Ur right !

It spawns my ball now but in front of my spawn
This is my code line to spawn the ball

Spawn(class'RcRacing.RcBal', self,,,self.Rotation);

I know I left out the location, it was set to self.location (was standing before self.Rotation but u probably know all this) which comes down to the same. I looked up Spawn and found the location works with a vector
so I tried to make a variable to set it to a different location but it didnt seem to work.

Can u tell me how I can give x,y,z of the vector other values ?