Bug #26022

clearVehicleInit only clears setVehicleInit code that was not yet "processInitCommands'ed" (aka still pending)

Added by kju almost 4 years ago. Updated almost 3 years ago.

Status:Feedback Start date:10/31/2011
Priority:Normal Due date:
Assignee:Xeno % Done:

0%

Category:Scripting: Problem
Target version:-
Affected ArmA II version:1.63 Beta First affected build:
Reproduced by another DH user:No First affected ArmA II version:
I am using some Mods:No Single / Multi Player?:
I am using: BIForumURL:
Reproducible for you:Yes NGUrl:
Related to content of DLC: WIKIurl:

Description

Repro
  1. DS
  2. Join as client and load demo mission
  3. Select dude1 slot
  4. Start mission
  5. Notice the three info messages in chat
  6. JIP with 2nd client as dude2
  7. Notice the three info messages in chat

JIP still sees the message from dude1 despite it was clearVehicleInit'ed and processInitCommands'ed.

Exp
If clearVehicleInit'ed and processInitCommands'ed, remote clients joining afterwards should no longer receive the former sVI code.

Ref:
http://community.bistudio.com/wiki/Talk:clearVehicleInit

Code

 1 //init.sqf
 2 sleep 1;
 3 
 4 if (isServer) then
 5 {
 6     _groupLogic = createGroup sideLogic;
 7     DEV_RemoteCodeLogic = _groupLogic createUnit ["Logic",[-10,-10,10],[],0,"CAN_COLLIDE"];
 8     publicVariable "DEV_RemoteCodeLogic";
 9 
10     dude1 setVehicleInit
11     '
12         [] spawn
13         {
14             waitUntil {!(isNil "DEV_RemoteCodeLogic")};
15             sleep 5;
16             DEV_RemoteCodeLogic globalChat "dude1 is alive (again)";
17             diag_log "dude1 is alive (again)";
18         };
19     ';
20     dude2 setVehicleInit
21     '
22         [] spawn
23         {
24             waitUntil {!(isNil "DEV_RemoteCodeLogic")};
25             sleep 5;
26             DEV_RemoteCodeLogic globalChat "dude2 is alive (again)";
27             diag_log "dude2 is alive (again)";
28         };
29     ';
30     processInitCommands;
31     clearVehicleInit dude1;
32     processInitCommands;
33 };

1 //mission.sqm - dude3 unit init:
2 init="0=[] spawn{waitUntil {!(isNil ""DEV_RemoteCodeLogic"")};sleep 5;DEV_RemoteCodeLogic globalChat ""dude3 is alive (again)"";diag_log ""dude3 is alive (again)"";};";
//description.ext
respawn = 3;
respawnDelay = 3;

clearVehicleInitDemo.Desert_E.pbo (3.3 kB) kju, 10/31/2011 08:47

sVI_still_active.Desert_E.pbo (2.8 kB) kju, 10/11/2012 15:26


Related issues

related to ARMA2 Community Issue Tracker - Bug #25994: Even if the target object is deleted, the setVehicleInit ... Closed 10/30/2011
related to ARMA2 Community Issue Tracker - Bug #2341: The Sky is on Fire Assigned 06/27/2009
related to ARMA2 Community Issue Tracker - Bug #63988: Disable Processing of Init Commands for a Unit Feedback 11/10/2012

History

Updated by kju almost 4 years ago

Comment by Suma

clearVehicleInit only clears sVI code that was not yet "processInitCommands'ed" (aka still pending)?

The command was added by VBS and I do not know what their design for it was. However, I do not know how one would "remove" an init code which was already executed - it was already executed, would you expect the game to create a magic script which would reverse the effects of the code, or what?

Comment by Sickboy

If you'd clear the vehicleInit, I think it would be expected that following JIP players would not receive the vehicleInits for that object.

Updated by kju almost 4 years ago

  • Description updated (diff)

Updated by kju almost 4 years ago

The local execution can not be reversed, right.

From what I understand what people suggested was:

clearVehicleInit cleans the "init line" (sVI code) of the given object.

So if the "init line" has been flagged to be sent over network (via processInitCommands),
clearVehicleInit also stops the "init line" to be processed on remote clients,
that connected after the clearVehicleInit was applied (aka JIP clients).


I think Sickboy explains it better and more precise.

In the current state I cannot see much use in clearVehicleInit.
Normally you apply processInitCommands directly after you set the sVI code.
So I cannot use a meaningful use case for clearVehicleInit right now, but maybe there is some?

Updated by Suma almost 3 years ago

  • Assignee changed from Suma to Dwarden

The command was added by VBS and I do not know what their design for it was.

Same here. I will not be fixing it. I do not know who would.

Updated by Xeno almost 3 years ago

@Suma
Could you at least check if the SVI code is still executed for already deleted objects on JIP clients ?
Because it might trigger problems like the old "The sky is on fire" bug, see #2341
(removing the SVIs from the airdestruction scripts and replacing it with another method fixes it)

Updated by kju almost 3 years ago

  • Due date deleted (02/01/2012)
  • Affected ArmA II version changed from 1.60 BETA to 1.63 Beta

Well most experienced scripts would be happy to see sVI gone altogether anyway.

If it is still kept, the issue Xeno notes should be still looked into at least.

Updated by kju almost 3 years ago

hm tried to make a demo mission for that - sVI is not/no longer triggered for deleted objects
Xeno can you please check - is my code/sample wrong, or can you confirm sVI no longer active for deleted objects?

Repro
  1. DS
  2. Join as client and load demo mission
  3. Select any slot
  4. Start mission
  5. Notice the info messages in chat
  6. JIP with 2nd client
  7. No more message shown

When you JIP as long as the tank is not removed, you still get the message.

Code:

sleep 1;

if (isServer) then
{
    _groupLogic = createGroup sideLogic;
    DEV_RemoteCodeLogic = _groupLogic createUnit ["Logic",[-10,-10,10],[],0,"CAN_COLLIDE"];
    publicVariable "DEV_RemoteCodeLogic";

    tank setVehicleInit
    '
        [] spawn
        {
            waitUntil {!(isNil "DEV_RemoteCodeLogic")};
            sleep 5;
            DEV_RemoteCodeLogic globalChat "sVI on tank is still active";
            diag_log "sVI on tank is still active";
        };
    ';
    processInitCommands;

    sleep 5;

    tank setDamage 1;

    sleep 5;

    deleteVehicle tank;
};

Updated by Xeno almost 3 years ago

I'm not sure if it executes for deleted objects too, I was just guessing.

Anyway, the best would be to get completely rid of SVI (the command is not needed at all).

Updated by bebul almost 3 years ago

Xeno wrote:

I'm not sure if it executes for deleted objects too, I was just guessing.

Probably wrong guess, I guess.
(There are two ways to avoid it inside code: the message is removed for deleted objects and when such message is received, but object is not found (deleted), it is not executed.)

Also available in: Atom PDF