Jump to content
Far East Lieutenant

Major problem after adding sqf script

Recommended Posts

Hey guys,

 

So the bottom line is: I added two sqf files to my mission folder, and Arma3 itself went wrong.

 

Add-on

Add-on : 3den enhanced only.

 

Background

1. I am currently making a coop MP mission.

2. I wanted to disable stamina.

3. Instead of unchecking 'enablestamina' box at the character attributes page(I guess this is 3den feature)

4. I created initPlayerLocal.sqf and onPlayerRespawn.sqf

5. Each file contains this sentence only : player enableStamina false;

 

Problems

After I added these 2 sqf files, I test-ran the mission as multiplayer and thats when the problems occured.

1. When my player respawns after being killed, customized loadouts disappear.

2. When my player respawns after being killed, tasks are stopped and won't progress further.

3. Even if I play other missions, problem 1 & 2 recur.

    This is strange because those missions were downloaded from Stream Workshop straight and are untouched.

    Loadouts disappear, and task progress is halted.

 

Solutions I Tried-out

1. Checked Multiplayer Attribute section

2. Deleted sqfs and re-ran the mission

3. Checked unbinarized mission.sqm

4. re-installed Arma3

 

Those solutions didn't work out either.

Help me out guys... thanks for reading.

Share this post


Link to post
Share on other sites

There is no reason to respawn with customized loadouts if you didn't script anything for that. (Customizing are not persistent).

Tasks should depend on how do you propagate/attribute them (modules/scripts/ owners).

  • Like 1

Share this post


Link to post
Share on other sites
1 minute ago, pierremgi said:

There is no reason to respawn with customized loadouts if you didn't script anything for that.

 

First, Thanks for the reply :)

 

1. Just yesterday, when I play other co-op missions downloaded from Steam workshop, I respawned with the customized load-outs on my position of death.

2. Today after what's happened, when I play the same mission, I respawn with the basic load-out.

 

My English is quite limited, I hope you understand my message :)

Share this post


Link to post
Share on other sites

BI didn't change anything on Arma since yesterday. So, the question is what did you change in your mission? Try to recover the previous version and modify it step by step. Be more precise in you want help here.

  • Like 1

Share this post


Link to post
Share on other sites
7 minutes ago, pierremgi said:

Tasks should depend on how do you propagate/attribute them (modules/scripts/ owners).

 

Regarding tasks, I only used Editor Modules/Triggers, and their connections are fine.

So I even made a new scenario, and added 2 task/trigger(fire at Blufor present) and it won't progress upon respawn...

What's wrong..T.T

Share this post


Link to post
Share on other sites
10 minutes ago, pierremgi said:

BI didn't change anything on Arma since yesterday. So, the question is what did you change in your mission? Try to recover the previous version and modify it step by step. Be more precise in you want help here.

 

Thanks, I will try to write down more... So here's the list I changed today.

1. Added CreateDiary Modules (Total 5)

2. Added 2 sqf files regarding stamina as written above

3. Test-ran the mission as multiplayer.

 

Two problems pop up when my character dies and respawn at the position of death.

1. Loadouts disappear, even when I checked the box 'Save Loadouts' section at the Attributes-Multiplayer(Guess this is 3den enhanced feature).

2. Mission Tasks won't progress, when all the nodes connecting the trigger and modules are fine.

 

These two problems keep recurring at any mission I play, which worked out just fine  yesterday in terms of tasks & loadouts. So I tried out above solutions which didn't work.

Share this post


Link to post
Share on other sites

Verify your respawn parameters in editor (or description.ext), respawn type (base or else) respawn position....

 

For loadouts:

in initPlayerLocal.sqf:

 

player enableStamina false;
player setCustomAimCoef 0;
player setVariable ["ldout",getUnitLoadout player];
 

 

in initPlayerLocal or init.sqf:

 

addMissionEventHandler ["EntityRespawned", {
  params ["_unit", "_corpse"];
   _unit setUnitLoadout (_corpse getVariable ["ldout",getUnitLoadout _unit]);
   if (isPlayer _unit) then {
     _unit enableStamina false;
     _unit setCustomAimCoef 0;

  };
    {deleteVehicle _x} forEach nearestObjects [(getPosATL _corpse),["WeaponHolderSimulated","groundWeaponHolder"],5];
    deleteVehicle _corpse;
}];

 

EDITED

  • Like 1

Share this post


Link to post
Share on other sites
15 minutes ago, pierremgi said:

in initPlayerLocal.sqf:

Thanks I will try this right away...

 

I will try adding below script in initPlayerLocal or init.sqf: separately and tell you the results

15 minutes ago, pierremgi said:

in initPlayerLocal or init.sqf:

 

addMissionEventHandler ["EntityRespawned", {
  params ["_unit", "_corpse"];
   _unit setUnitLoadout (_corpse getVariable ["ldout",getUnitLoadout _unit]);
   if (isPlayer _unit) then {
     _unit enableStamina false;
     _unit setCustomAimCoef 0;

  };
    {deleteVehicle _x} forEach nearestObjects [(getPosATL _corpse),["WeaponHolderSimulated","groundWeaponHolder"],5];
    deleteVehicle _corpse;
}];

 

Share this post


Link to post
Share on other sites
55 minutes ago, pierremgi said:

For loadouts:

in initPlayerLocal.sqf:

 

player enableStamina false;
player setCustomAimCoef 0;
player setVariable ["ldout",getUnitLoadout _unit];

 

When I put this scrip in initPlayerLocal.sqf, errorbox pops up at the start of the game

55 minutes ago, pierremgi said:

in initPlayerLocal or init.sqf:

 

addMissionEventHandler ["EntityRespawned", {
  params ["_unit", "_corpse"];
   _unit setUnitLoadout (_corpse getVariable ["ldout",getUnitLoadout _unit]);
   if (isPlayer _unit) then {
     _unit enableStamina false;
     _unit setCustomAimCoef 0;

  };
    {deleteVehicle _x} forEach nearestObjects [(getPosATL _corpse),["WeaponHolderSimulated","groundWeaponHolder"],5];
    deleteVehicle _corpse;
}];

I've also tried pasting the scripts into either of initPlayerLocal or init.sqf, but they also come with an error box. But it does help me with keeping the loadouts I've applied at the Virtual Arsenal during mission play. This means that players will keep the loadout they changed in-game, but they will have to sustain errorbox popping up.

 

However I googled up and tried this:

Quote

on onPlayerKilled.sqf :

[player, [missionNamespace, "inventory_var"]] call BIS_fnc_loadInventory;

on onPlayerRespawn.sqf:

[player, [missionNamespace, "inventory_var"]] call BIS_fnc_loadInventory;

 

So this enabled me to keep the loadouts that I've applied at the mission editor without an errorbox popping up. However, this won't bring up the changes I've made at the virtual arsenal during mission play. That means players will have to pick the guns up from other corpses which will get irritated.

 

Second part it has not yet been solved either.

If I die and respawn, when I finish the currently assigned task, next task won't pop up.

If I don't die, the task assignment progresses just fine.

 

Thanks for helping me out here pierremgi :) I wish I have the ability to do scripting like you and everyone else.

Edited by Far East Lieutenant
Test results after a few more tries

Share this post


Link to post
Share on other sites

Alright, I managed to address the issues, but I still have some problems still:

 

1. To solve "I want to have players keep all custom loadouts from Virtual Arsenal in-game": apply the methods in this link:

On 2016. 2. 22. at 4:28 PM, jakes said:

It is, adding an extra checkbox which enables gear saving is done in few minutes. However, it would require a mod. You can still do it the old way for now.

 

create two files in your mission root

 

onPlayerRespawn.sqf


[player, [missionNamespace, "inventory_var"]] call BIS_fnc_loadInventory;

onPlayerKilled.sqf


[player, [missionNamespace, "inventory_var"]] call BIS_fnc_saveInventory;

 

But I still have an issue, that is when I start the game, I get two errors:

A) [BIS_fnc_loadInventory] Inventory "inventory_var" Not Found. - This pops up at the start of the game.

B)  [BIS_fnc_baseWeapon] not found in cfgweapons- This happens when I enter the Virtual Arsenal

 

 

2. To solve "I tasks won't progress further after respawn since my newly spawned character is not the same guy from the start"

I was using "createtask Module", so all I had to do was set the owner from "Groups of synchronized units" to "All playable units".

 

But this also has a problem, that all players can find other BLUFOR squad's tasks, and even assign it as their own task.

 

So I hope this last post gives some clue to anyone, and thanks to @pierremgi for helping me out here.

Share this post


Link to post
Share on other sites

Sorry, i missed a _unit instead of player. Here is something working with your last loadout:

 

player enableStamina false;
player setCustomAimCoef 0;
player setVariable ["ldout",getUnitLoadout player];
 addMissionEventHandler ["EntityRespawned", {
  params ["_unit", "_corpse"];
   _unit setUnitLoadout (_corpse getVariable ["ldout",getUnitLoadout _unit]);
   if (isPlayer _unit) then {
     _unit enableStamina false;
     _unit setCustomAimCoef 0;
   };
    {deleteVehicle _x} forEach nearestObjects [(getPosATL _corpse),["WeaponHolderSimulated","groundWeaponHolder"],5];
    deleteVehicle _corpse;
}];
addMissionEventHandler ["Entitykilled", {
  params ["_victim"];
  removeAllActions _victim;
    _victim setVariable ["ldout",getUnitLoadout [_victim,true]];

}];

 

For tasks, sides of sync units should work.

 

  • Like 2

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×