Page MenuHomeFeedback Tracker

Not work GetVariable after reconnect
Closed, ResolvedPublic

Description

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}

Details

Legacy ID
1333747908
Severity
None
Resolution
Duplicate
Reproducibility
Always
Category
Scripting
Steps To Reproduce
  1. Load MP-mission (see attache) on server and start: setvar.rar
  2. Connect to mission.
  3. In Debug console insert code:

obj = createVehicle ["C_Hatchback_01_F", [14851.6,16415.8,0.00144196], [], 0, "NONE"]; obj setvariable ["myvar","test",true];

  1. Execute on server side only
  2. Get var in debug-console (watch): cursorTarget getvariable "myvar"; and nove cursor on created car.
  3. Result: "test" - it's good!
  4. Disconnect from server and connect again
  5. Retry get var in step 5.
  6. Result: "" - not good!

if after reconnect all good with variable, retry step 3.

Event Timeline

Patriot edited Steps To Reproduce. (Show Details)Feb 8 2014, 2:01 PM
Patriot edited Additional Information. (Show Details)
Patriot set Category to Scripting.
Patriot set Reproducibility to Always.
Patriot set Severity to None.
Patriot set Resolution to Duplicate.
Patriot set Legacy ID to 1333747908.May 7 2016, 5:55 PM

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

Patriot added a subscriber: Patriot.May 7 2016, 5:55 PM

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

Updated description and added attache

UP UP решите проблему!

makbeth added a subscriber: makbeth.May 7 2016, 5:55 PM

Same thing. Pls fix this as soon as possible! We can't complete the mission until u fix this bug. Tnx in advance!

Nevsky added a subscriber: Nevsky.May 7 2016, 5:55 PM

Same problem!

Iceman added a subscriber: Iceman.May 7 2016, 5:55 PM
Iceman added a comment.Apr 2 2014, 3:15 PM

Primary issue of this problem is: 17240.