Page MenuHomeFeedback Tracker

Broken OnStoreLoad in CarScript
Assigned, UrgentPublic

Description

Example:

override bool OnStoreLoad( ParamsReadContext ctx, int version )
{
    if(!super.OnStoreLoad(ctx, version));
        return false;

    int test_load0 = 0;
    int test_load1 = 0;
    int test_load2 = 0;
    int test_load3 = 0;
    int test_load4 = 0;

    if (!ctx.Read( test_load0 )) return false;
    Print(test_load0);

    if (!ctx.Read( test_load1 )) return false;
    Print(test_load1);

    if (!ctx.Read( test_load2 )) return false;
    Print(test_load2);

    if (!ctx.Read( test_load3 )) return false;
    Print(test_load3);

    if (!ctx.Read( test_load4 )) return false;
    Print(test_load4);

    return true;
}

For example, this code leads to the fact that each check is performed and approximately following lines appear in the log.

SCRIPT    (E): [EntityAI::OnStoreLoad] :: [WARNING] :: Scripted variables corrupted upon "CivilianSedan".
SCRIPT       : int test_load0 = 60
SCRIPT       : int test_load1 = 1065353216
SCRIPT       : int test_load2 = 1065353216
SCRIPT       : int test_load3 = 1065353216
SCRIPT       : int test_load4 = 1065353216

Details

Severity
None
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
General

Event Timeline

Mortan created this task.May 5 2023, 5:44 PM
Geez changed the task status from New to Assigned.May 10 2023, 11:27 AM

@Mortan, are you also writing the 5 variables in the correct sequence in OnStoreSave?

@mdc, I didnt write any variable into seq because this method should return false in this case since stream for this object should be at EoF