-
Content Count
11 -
Joined
-
Last visited
-
Medals
Posts posted by Safkon
-
-
Hmm...
I think I must to try use onPlayerRespawn event handler, because it has params:Quoteparams ["_newUnit", "_oldUnit", "_respawn", "_respawnDelay"];
So, I have _newUnit which spawned by engine. All that remains is to change loadout and correct position. But I think I can get problem with default respawn logic and player position 🤔
-
Hello,
I try to create my own custom respawn template (https://community.bistudio.com/wiki/Arma_3:_Respawn) and GUI with list of squads, roles and loadouts. Also I create test mission and set respawn = "BASE"; in description.ext.
So, I write script (event handler) onPlayerKilled.sqf, which creates my dialog (GUI) where player can join/create squad, select role and respawn position. Then he click "Respawn" button.
Summary steps\flow:- Player died
- onPlayerKilled is invoked
- My GUI is being created
- Player choose his loadout and respawn position
- Player press respawn button
- My respawn script creates new unit (createUnit), wait 1 second for correct init, give selected loadout to unit and give control to player (selectPlayer)
- My GUI is closing
- Player spawned on selected position
Now I have several problems with correct player respawn on dedicated server. Here are they:
- After respawn player loses all tasks
- If someone kills player again - there is no message in system chat (like somebody kills bot/unit)
- When a player is in a group led by another player - after respawning, the new unit is controlled by the AI, but the player can shoot and look around, but cannot move
I read about last problem in comments for selectPlayer:
Quote1) If you switch to a unit that's not local, control over movement will not be given to you immediately. For example, if you switch to an AI unit whose leader is a player, you will not be able to control the movement of your new avatar, as its control remains with the leader unit. You will however be able to look around while the unit walks automatically.
but also I read about locality and multiplayer https://community.bistudio.com/wiki/Multiplayer_Scripting#Locality. In "Locality changes" topic It says:Quotelocality can also change in the event of a Team Switch or usage of selectPlayer
So, selectPlayer changes locality but it still have problem. Also I check locality by owner command, new unit is local. May be because I use createUnit on player machine.
This is my short respawn script without extra code:
Spoiler// Gets old player unit _deadUnit = player getVariable "respawn_unit"; // Creates new unit _newUnit = (group player) createUnit [_unitType, _pos, [], 5, "NONE"]; sleep 1; // delay for unit "_newUnit" init // Join new unit to player group [_newUnit] joinSilent (group player); // Switch leader to new unit if player was leader if (_deadUnit == leader _deadUnit) then { (group _deadUnit) selectLeader _newUnit; }; [_deadUnit] joinSilent grpNull; // removes dead unit (was player) from group selectPlayer _newUnit; // gives unit control to player
Also default BIS respawn logic don't know about my respawn script and try to respawn player by pre-defined scripts for "BASE" respawn type. And I use terrible hack: setPlayerRespawnTime 900; otherwise BIS default logic spawn player in one of markers "respawn_*".
Possible I can solve it by property in custom respawn config (CfgRespawnTemplates)Quote// By default onPlayerKilled and onPlayerRespawn function are spawned
// set to 1 to run in unscheduled, called functions MUST NOT return an assignment or respawn will break
isCall = 0;
I tried to find any BIS scripts with default respawn logic\functions but without success.
Is it possible to create custom respawn template and use some BIS respawn functions, which can tell to engine that I spawned player already? It would solve problems with player group (remove old unit, join new) and new unit issues (control, tasks, etc.) -
Also you can use this (if you don't know about <br/> count):
_tooltip = getText(_itemCfg >> "descriptionShort"); _tooltip = ([_tooltip, "<br />", true] call BIS_fnc_splitString) joinString "\n";
-
If someone search solution in 2k21, you can use getMissionPath:
findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", " _this select 0 drawIcon [ getMissionPath 'images\towericon1_ca.paa', [1,0,0,1], getPos Tower1, 24, 24, getDir Tower1, '', 1, 0.03, 'TahomaB', 'right' ] "];
- 1
-
Ah... problem in execVM.
Seems like onDraw = "_this execVM 'scripts\dialog\respawn\onDrawMap.sqf'"; takes a lot of time for execution and this is not acceptable for UI rendering
onDraw = "_this call compile preprocessFileLineNumbers 'scripts\dialog\respawn\onDrawMap.sqf'"; - works as expected without artifacts -
Hello!
I have problems with drawing icons (default solder icons for all units) in onDraw event handler.
Some of the icons are rendered, some are not. Some rendered icons can disappear after moving or zooming map.
My dialog:Spoiler#include "\a3\ui_f\hpp\definecommongrids.inc" #include "DefaultStaff.hpp" class RespawnDialog { idd = -1; access = 0; movingEnable = true; enableSimulation = true; Controls[] = { Background, MapFrame, }; class MapFrame : RscMapControl { idc = 1804 x = 16 * GUI_GRID_W + GUI_GRID_X; y = 2 * GUI_GRID_H + GUI_GRID_Y; w = 23 * GUI_GRID_W; h = 16 * GUI_GRID_H; sizeEx = 1 * GUI_GRID_H; onDraw = "_this execVM 'scripts\dialog\respawn\onDrawMap.sqf'"; }; class Background: IGUIBack { idc = 2200; x = 0 * GUI_GRID_W + GUI_GRID_X; y = 0 * GUI_GRID_H + GUI_GRID_Y; w = 40 * GUI_GRID_W; h = 25 * GUI_GRID_H; colorBackground[] = {0,0,0,0.8}; }; };
Map onDrawMap script:
Spoilerparams ["_control"]; { _pos = getPosVisual _x; _dir = getDir _x; _control drawIcon [ "iconman", //"respawn_background", // texture [1,0,0,1], // text and icon color in format [r,g,b,a] _pos, // position 24, // width 24, // height _dir // angle ]; } forEach allUnits; systemChat "END"; _control
Seems like I'm make some stupid mistake, but I can't figure out what exactly. 🤔
In-game dialog after creation:Spoiler
After map moving upper:Spoiler
Top-left squad with broken rendering
P.S.
Scripts and dialog code is shortened for ease of understanding -
I think you can post your mod as is. Just mark it like [demo] or [pre-alpha]
Firstly, because your time very valuable.
Secondly, real Arma community would be glad to see US buildings. Yes, may be it have problem with textures. But it still cool. A lot of people wants something like World in Conflict but in Arma.
In any case, you got at least a little experience. Both "life"-community and Arma modding.
Stay strong. 🤗 -
Hi!
It's nice work. Cool models and awesome textures without strange luminescence.
What plans do you have? I know it's really hard work. May be you need some help? In Arma 3 we don't have pretty good US maps and buildings.
Your project would be popular.
Upd.
If it's not private RP-life mod, of course 😉- 1
-
Hi!
I have problems with CT_OBJECT_CONTAINER. I try to create GUI with in-game object like tablet ("Land_Tablet_02_F") and I don't understand how to use 'class Areas'.
I read wiki: https://community.bistudio.com/wiki/DialogControls-Objects
But I think not all objects can be used with CT_OBJECT_CONTAINER. In Areas I must declare separate parts (each with his own class) with controls and set selection of object which would be used for rendering controls.
So, I use 'selectionNames object' (https://community.bistudio.com/wiki/selectionNames) and get values: ['Camo_1', 'Camo_2'], but no one works. Wiki says: "For an object with selections one can use user texture. For example "\A3\Misc_F\Helpers\UserTexture1m.p3d" has selections: usertexture, usertexture TL,usertexture TR, usertexture BL". I know that tablet has texture for display, but usertexture not working.
Is it possible?
GUI code:Spoilerclass UI_Tablet { idd = 999; // Display identification enableSimulation = 1; // 1 (true) to allow world simulation to be running in the background, 0 to freeze it enableDisplay = 0; // 1 (true) to allow scene rendering in the background class Objects // UI objects { class _CT_OBJECT_CONTAINER { access = 0; // Control access (0 - ReadAndWrite, 1 - ReadAndCreate, 2 - ReadOnly, 3 - ReadOnlyVerified) idc = CT_OBJECT_CONTAINER; // Control identification (without it, the control won't be displayed) type = CT_OBJECT_CONTAINER; // Type style = ST_LEFT; // Style blinkingPeriod = 0; // Time in which control will fade out and back in. Use 0 to disable the effect. model = "\A3\Props_F_Exp_A\Military\Equipment\Tablet_02_F.p3d"; // Displayed model scale = 6; // Model scale x = 20 * GUI_GRID_CENTER_W + GUI_GRID_CENTER_X; // Horizontal coordinates y = 10 * GUI_GRID_CENTER_H + GUI_GRID_CENTER_Y; // Vertical coordinates z = 1; // Depth coordinates xBack = 25 * GUI_GRID_CENTER_W + GUI_GRID_CENTER_X; // Horizontal background coordinates yBack = 12 * GUI_GRID_CENTER_H + GUI_GRID_CENTER_Y; // Vertical background coordinates zBack = 1; // Depth background coordinates enableZoom = 0; // Allow foreground/background transformation zoomDuration = 0.5; // Speed of foreground/background transformation inBack = 0; // Start in back (Back coordinates are used) direction[] = {0, -0.35, 0}; // Model vector dir up[] = {0, 0.65, -0.35}; // Model vector up tooltip = "CT_OBJECT"; // Tooltip text tooltipColorShade[] = {0,0,0,1}; // Tooltip background color tooltipColorText[] = {1,1,1,1}; // Tooltip text color tooltipColorBox[] = {1,1,1,1}; // Tooltip frame color class Areas // Configurable UI areas. Normally interactive controls (buttons, listboxes, ...) are not interactive here. { class UserTexture { selection = "Camo_2"; // Model selection on which the UI will be rendered usertexture, usertexture TL,usertexture TR, usertexture BL class Controls { class _ST_PICTURE_video { type = CT_STATIC; idc = ST_PICTURE + 1000; style = ST_PICTURE; text = "\A3\Missions_F_Bootcamp\video\VR_BOOT.ogv"; sizeEx = GUI_GRID_CENTER_H; font = GUI_FONT_NORMAL; lineSpacing = 1; colorText[] = {1,1,1,1}; colorBackground[] = {1,0.5,0,1}; x = 0; //1 * GUI_GRID_CENTER_W + GUI_GRID_CENTER_X; y = 0; //1 * GUI_GRID_CENTER_H + GUI_GRID_CENTER_Y; w = 20 * GUI_GRID_CENTER_W; h = 20 * GUI_GRID_CENTER_H; autoplay = 1; loops = 1; }; }; }; }; }; }; };
P.S. this example with model "\A3\Misc_F\Helpers\UserTexture1m.p3d" and selection = "usertexture" works fine.
P.P.S. I know workaround - using picture of tablet like background, but it's less interesting
Also I have VBS dialog example, but there are not "class Areas" -
You must synchronize module and trigger. Set module to "Open".
If u want open/close your own doors/gates, use trigger with commands:
OnAct.:myGate animate ["Door_1_rot", 1];
OnDeact.:myGate animate ["Door_1_rot", 0];
myGate - name of your gate\door
Custom respawn template and GUI
in ARMA 3 - MISSION EDITING & SCRIPTING
Posted
Yes, when I started to use onPlayerRespawn it works better. Engine gives me correct unit controlled by player.
I had one problem when unit spawn before player press Respawn button, but I solve it by creating cam and attach to head of dead unit. Also for new unit I disable simulation and moved it to a height of 2000 meters
My current onPlayerRespawn script: