If dynamic create object in game (createvehicle) and set variable for this object, after reconnect player cannot get variable. For static object - all good. Arma 2 not have this problem.
{F23229}
Description
Details
- Legacy ID
- 1333747908
- Severity
- None
- Resolution
- Duplicate
- Reproducibility
- Always
- Category
- Scripting
- Load MP-mission (see attache) on server and start: setvar.rar
- Connect to mission.
- In Debug console insert code:
obj = createVehicle ["C_Hatchback_01_F", [14851.6,16415.8,0.00144196], [], 0, "NONE"]; obj setvariable ["myvar","test",true];
- Execute on server side only
- Get var in debug-console (watch): cursorTarget getvariable "myvar"; and nove cursor on created car.
- Result: "test" - it's good!
- Disconnect from server and connect again
- Retry get var in step 5.
- Result: "" - not good!
if after reconnect all good with variable, retry step 3.
Event Timeline
obj variable will obviously be "undefined" when you reconnect. You have to broadcast it if you want to have its value on reconnect:
obj = "C_Offroad_01_F" createVehicle (position player);
publicVariable "obj";
variable "obj" can be replaced on cursortarget or using publicvariable "obj"; - but this not resolve trouble.
I trying using script on server:
while{true}do{
publicvariable "obj";
sleep 1;
};
- this not resolve trouble.
You're right, I was assigning variable manually and it worked. The problem seems to do with the assignment in the same frame. I have made ticket explaining this better http://feedback.arma3.com/view.php?id=17240
in short, this works every time:
- spawn {
obj = createVehicle ["C_Offroad_01_F", position player, [], 0, "NONE"];
sleep 0.1;
obj setvariable ["myvar","test",true];
publicVariable "obj";
}
Same thing. Pls fix this as soon as possible! We can't complete the mission until u fix this bug. Tnx in advance!