#enfusion_scripting
1 messages · Page 6 of 1
There are no changes on this regard there
If it eas, whole game would be presenting similar issues
So there is a wrong ref usuage somewhere, at least for what you want to do
yeh I think its in EPF
but still, would love to see EPF in base game one day (hint hint)
For example, my name would cause the ref to go crazy
It would cause a mem leak or the jnstance to die when you do not expect
I only ever create refs as class members and null them on ~deconstructor()
No need to null them
really?
When you destroy the class, they become null
even in workbench?
And it is not a pointer, so you do not need to reset memory content
Everywhere
well thats a time saver
maybe you can code review Overthrow for me before MANW lol
Chrck the what not to do ref wise there
I provided examples of everything that ypu should not do with refs
It's an attribute on the game mode entity. Don't remember whether it is on a component or the entity itself. Basically a list of resource types for which global supply usage should be off.
I did look at it but can't figure out which one
GameMode_Campaign
Hello, my respects, I have a question: how can we make a red and white barrier indestructible? My request is for a passionate developer and mapper modder. Thank you very much.
by not adding/disabling any destruction component on it
Is FileHandle::WriteArray() faster than calling FileHandle::Write() multiple times?
Basically I'm asking, does it make sense to put my data into an array for writing, or should I just write it directly?
I tested it by writing integers using a) WriteArray() and b) a foreach loop of Write().
10 integers (40b): 0.05ms vs. 0.02ms
100 integers (400b): 0.06ms vs. 0.15ms
1000 integers (4kb): 0.06ms vs 1.5ms.
10000 integers (40kb): 0.08ms 15.4ms.
It appears that yes, it is much much faster, and should always be used when you're writing more than 100 bytes.
The only place where you wouldn't use it is with less than 100 bytes (<25 integers) because WriteArray seems to come with a static cost of ~0.05ms (on my system).
Hi everyone, hope you're all doing well!
I'm trying to figure out how to link a script to my scenario.
I have the script in my core mod, which is listed as a dependency for my scenario mod.
Now I want that script to be active and running in the scenario — how should I do that?
What does the script do and when should it be called?
It’s a script that allows players to spawn with their custom loadout at capture points, and it costs 50 supply to do so
any idea how to prevent the animations from playing when a weapon is bipod-deployed and then reloaded in reforger? It is annoying to have to reset the bipod and re-acquire a target when using a bolt-action rifle. I tried looking into bipod methods and deployment but it looks like thats all internalized.
the only other janky work-around i could think of is keeping track of the player's camera and re-orienting it once they redeploy the bipod
it doesn't make sense to me though that a player would pick up a large rifle, orient up in the air, rack the bolt and then redeploy the weapon 🙂
Thank you, this was it.
Hi guys, is **version ** of the mod required?
I don't want to manually update version each time when some mod is updated.
I need to keep mods in config file instead of addon.gproj
{
"modId": "5F0913BAAC69ABF5",
"name": "Garbage Collector Patch",
"version": "1.1.2"
}
no, you can remove it and server will download latest version on each start
You only specify a version if you want to lock it to a specific one.
I'm trying to create a standalone mod that overwrites all other mod server start time , game time multiplier, random weather every 4 hours and random start dates .```modded class SCR_BaseGameMode
{
protected float m_fNextWeatherCheck;
protected const float WEATHER_INTERVAL = 14400; // 4 in-game hours in seconds
override void OnGameStart()
{
super.OnGameStart();
Print(">>> [TimeWeatherMod] Starting custom time and weather script...");
SetRandomStartDateTime();
SCR_Global.SetTimeMultiplier(1); // 1 real minute = 1 game minute
GetGame().GetCallqueue().CallLater(UpdateWeatherLoop, 1000, true);
}
void SetRandomStartDateTime()
{
SCR_DateTime dt = new SCR_DateTime();
dt.SetHour(4);
dt.SetMinute(2);
dt.SetSecond(0);
dt.SetDay(Math.RandomInt(1, 28)); //safe for all months
dt.SetMonth(Math.RandomInt(1, 12));
dt.SetYear(Math.RandomInt(1950, 1995));
GetGame().GetWorld().SetWorldTime(dt);
m_fNextWeatherCheck = dt.ToSeconds() + WEATHER_INTERVAL;
PrintFormat("[TimeWeatherMod] Set time to %1/%2/%3 %4:%5",
dt.GetDay(), dt.GetMonth(), dt.GetYear(), dt.GetHour(), dt.GetMinute());
}
void UpdateWeatherLoop()
{
float now = GetGame().GetWorld().GetWorldTime().ToSeconds();
if (now >= m_fNextWeatherCheck)
{
ForceRandomWeather();
m_fNextWeatherCheck = now + WEATHER_INTERVAL;
}
}
void ForceRandomWeather()
{
Weather w = GetGame().GetWorld().GetWeather();
if (!w) return;
float clouds = Math.RandomFloat01();
float fog = Math.RandomFloat01();
float wind = Math.RandomFloat(0.1, 1.0);
w.SetOvercast(clouds);
w.SetFog(fog);
w.SetWindSpeed(wind);
PrintFormat("[TimeWeatherMod] Weather changed: Clouds %.2f, Fog %.2f, Wind %.2f", clouds, fog, wind);
}
}```
does this code look right??
Thank you
I'm sorry my English is not perfect, I'm French, I have a configuration problem on the server that I manage, I would like to make a modification of Montignac (this is an example) to change the city to a city that gives a point to the team that captures it but I can't do it and I depend on help on this subject if someone could help me ?
Is there a quick way I can completely duplicate an existing entity into a clone? (if a weapon, include all attachments it has, or any other combo such as children/slots)
Where's base ownership managed? Need to be able to check when there are no more INDFOR/FIA owned control points
Whats the trigger?
How do I fire a weapon using a script? Do I just use a signal name in the signals suffix field?
In the FactionAffiliationComponent
Cheers. got there eventually
Is player name safe for logs?
I take player name from "PlayerManager.GetPlayerName" and print it in logs, but is it safe, can player use specific unicode or smf in own name to make some issue by logs?
I am fairly new to modding within enfusion. I noticed some mods store most of its data within a json file. Is there capabilities to storing data to a cloud backend database? I haven’t navigated myself just yet, figured I’d ask first. And if it is possible, is it as simple as implementing a database in common practice or is a bit more complex?
You can either roll your own persistence layer or use Enfusion Persistence Framework. There's no direct DB bindings/drivers but the engine has support for making HTTP requests so all you need for DB storage is a HTTP API to pass data back and forth between DB and game server and script your server to store and retrieve data through that instead of local FS
I need help - I am trying to make a script to show slide images on a screen in-game, I keep getting bad types or undefined functions. can anybody help??
Current file structure:
│
├── Config/
│ └── CfgMod.c
│
├── Scripts/
│ └── Game/
│ └── REDCoats-TacBrief/
│ ├── SlideManagerComponent.c
│ └── SlideTriggerUserAction.c
│
├── UI/
│ ├── Layouts/
│ │ └── TacBriefScreen.layout
│ └── Images/
│ ├── slide_1.edds
│ ├── slide_2.edds
│ └── slide_3.edds```
That helps, thanks!
Here's my script files - any help would be greatly appreciated.
My layout is just a Overlay widget with an ImageWidget Child
The script is to be attached to an in-game screen placed within the server's map
Is it possible to make an override so that the WCS mod works in third person?
third person is just a server config setting
It's possible to get index of array element in attribute from BaseContainer of this element in BaseContainerCustomTitle?
Hey, have you figured out what was causing the error 422 ?
@pliant ingot Democracy - Map Voting is it functional for the version? It seems that as soon as you change the map, an error is displayed for some players and others are able to enter the server, I don't know if it's too many players trying to connect at the same time and they can't allocate some to the queue or something like that.
Those kinds of errors are just things you work through resolving one at a time. Look for the correct type or function to use where these occur
container.GetVarIndex("Prefab"); (replace Prefab with attribute you want the index of) should do it
would be sick if BI gave us generic types in scriptland so we could have some type safety on stuff like container keys/values
It's not me
oh ok i'm sorry for the ping then
Currently there are some random JIP error after previous patch and I can't reproduce it, because looks like it requires too many players and source somewhere on BI's side. But for my small server it works fine.
Hey sorry to bother you but have you figured out what was causing the error 422. I'm running into the same problem
I need not index of attribute, but index of element in array attribute
And prefer to get this in BaseContainerCustomTitle of this element, because I need to show index of element in front, because it's important and users can be too stupid to find this info in tooltip
hello, nop, i didn't solve the problem, docummentation on REST is kinda non existent, only GET method have some docs, nothing about POST https://community.bistudio.com/wiki/Arma_Reforger:REST_API_Usage
Yeah that's also what's making me lose my mind..
Am I right to assume that FactionManager factions list is hardcoded? There are only proto getters and the editable list in world editor is not referenced in the scripts.
There was a get faction by ID so just iterate until you get null lmao
Not editable by script, configured at loadtime through the prefab on the map. You may request script api via feedback tracker if you can present a usecase that shows the need for it
Maybe I can help, yes the base context url is combined with the individual calls. Uncommon design, I agree, but it was desinged so you make a context per endpoint and then do rest actions which should usually only mention the resource name and or action and not the whole URL again. post, put, delete work mostly the same as get, but there are inconsistencies in the default headers and body set. some are form encoded by default, some are just text, some give accept user header, some not. We have already a plan internally to remove all those inconsistencies and do a quality of life update to the API, but it is awaiting implementation, so it is not coming within the next 1 or 2 major updates probably.
The _now variants are all just giga bugged, do not use them. It is bad design to hard freeze the server until a response anway. Only perhaps valid usecase is blocking actions during startup or shutdown, but for those we will try to offer callback friendly ways to tell the game to stop until you had time to do something.
The callback variants do all 4 work.
is there any negative impact of having like several dozens of factions configured in the manager? I’m having in mind a case in which actual 2-3 factions to use are selected by the player on a pre-game screen within a scenario, so all possible options need to be already predefined.
If my memory serves me right it should not be an issue. They are already known to client and server because of the shared map, so not much sync happening. We also have 4 factions configured usually but often only use 2
how can i do a nested json like this:
SCR_JsonSaveContext jsonPosition = new SCR_JsonSaveContext();
jsonPosition.WriteValue("x", playerPosition[0]);
jsonPosition.WriteValue("y", playerPosition[1]);
jsonPosition.WriteValue("z", playerPosition[2]);
SCR_JsonSaveContext jsonPlayer = new SCR_JsonSaveContext();
jsonPlayer.WriteValue("player_name", playerName);
jsonPlayer.WriteValue("position", jsonPosition);
string s_jsonPlayer = jsonPlayer.ExportToString();
this is not working: SCRIPT : [JRDX] POST http://127.0.0.1:8000/players/552cd222-9ecd-45ff-8363-b3900ab4f74c -> {"player_name":"JasonREDUX"}
It is even easier than this code. The save context supports nearly all possible ways of scripted classes, including array, set, map and other complex members. only needs manual handling when you reference other instances on your members so you do not do recursive writes etc. Just pass your own struct instance to the serializer and it will handle it. Also for position you can just send the vector directly, no need to manually pick it apart into x, y, z
i think we have a missunderstanding there, my api is waiting for position > x,y and z, i did designed it liks this
{
"player_name": "string",
"position": {
"x": 0,
"y": 0,
"z": 0
}
}
so i need to compose the payload to fit
i know it is easier to save the raw position and done, but that's not fun :p
you mean something like:
JRDX_PositionStruct pos = new JRDX_PositionStruct();
pos.x = playerPosition[0];
pos.y = playerPosition[1];
pos.z = playerPosition[2];
JRDX_PlayerPayloadStruct payload = new JRDX_PlayerPayloadStruct();
payload.player_name = playerName;
payload.position = pos;
class DataStruct
{
string playerName;
vector position;
}
would be ideal. Trust me you will not want to store it as xyz named keys, it adds a lot of overhead. [cord, cord, cord] is perfectly fine to parse by your backend application.
If you refuse to listen, then
class NonGoodVecotor { float x, y, z; }
class DataStruct
{
string playerName;
ref NonGoodVecotor position;
}
Either way you can just do context.WriteValue("", dataStructInstance) to write it nicely as root object. Rest is auto handled.
i will listen, ok, and then how to serialize it?
I just gave you the line ...
DataStruct struct();
struct.playerName = "Jason";
struct.position = "1 2 3";
auto context = new SCR_JsonSaveContext();
context.WriteValue("", struct);
string playerJson = context.ExportToString();
Which you can then send off to your rest api or what ever
kk, let's test, thx
class JRDX_PlayerSyncComponentClass : ScriptComponentClass {}
class JRDX_PlayerPayloadStruct
{
string player_name;
vector position;
}
// Component responsible for syncing local player data to an external REST API
class JRDX_PlayerSyncComponent : ScriptComponent
{
protected float m_TimeAccumulated = 0; // Tracks time between syncs
protected float m_Interval = 10.0; // Sync interval in seconds
protected ref JRDX_PositionSyncCallback m_Callback; // Callback handler for REST response
override void OnPostInit(IEntity owner)
{
// Enable OnFrame() execution every frame
SetEventMask(owner, EntityEvent.FRAME);
// Initialize the REST callback handler
m_Callback = new JRDX_PositionSyncCallback();
}
override void EOnFrame(IEntity owner, float timeSlice)
{
// Accumulate time and wait until interval is reached
m_TimeAccumulated += timeSlice;
if (m_TimeAccumulated < m_Interval)
return;
// Reset timer
m_TimeAccumulated = 0;
// Get the local player controller
PlayerController playerController = GetGame().GetPlayerController();
if (!playerController)
return;
// Get player's internal numeric ID
int playerId = playerController.GetPlayerId();
// Get player's display name (from PlayerManager)
string playerName = GetGame().GetPlayerManager().GetPlayerName(playerId);
// Get globally unique player identity ID from backend (e.g., Steam ID)
string playerUid = GetGame().GetBackendApi().GetPlayerIdentityId(playerId);
// Get the currently controlled entity (i.e., the player's avatar)
IEntity player = SCR_PlayerController.GetLocalControlledEntity();
if (!player)
return;
// Get the player's current world position
vector playerPosition = player.GetOrigin();
// Build data
JRDX_PlayerPayloadStruct playerPayloadStruct = new JRDX_PlayerPayloadStruct();
playerPayloadStruct.player_name = playerName;
playerPayloadStruct.position = playerPosition;
// Serialize to JSON
auto playerPayloadJson = new SCR_JsonSaveContext();
playerPayloadJson.WriteValue("", playerPayloadStruct);
string payload = playerPayloadJson.ExportToString();
// Configure the REST request
string contextURL = "http://127.0.0.1:8000";
RestContext context = GetGame().GetRestApi().GetContext(contextURL);
// Send the HTTP POST request to the REST API
string endpoint = string.Format("/players/%1", playerUid);
context.POST(m_Callback, endpoint, payload);
// Debug output
PrintFormat("[JRDX] POST %1%2 -> %3", contextURL, endpoint, payload);
}
}
// REST callback for handling API responses
class JRDX_PositionSyncCallback : RestCallback
{
override void OnSuccess(string data, int dataSize)
{
PrintFormat("[JRDX] Sync success: %1", data);
}
override void OnError(int errorCode)
{
PrintFormat("[JRDX] Sync failed. Code: %1", errorCode);
}
override void OnTimeout()
{
Print("[JRDX] Sync timeout");
}
}
SCRIPT : [JRDX] POST http://127.0.0.1:8000/players/552cd222-9ecd-45ff-8363-b3900ab4f74c -> {"player_name":"JasonREDUX","position":[3109.841796875,16.0,2751.820068359375]}
SCRIPT : [JRDX] Sync failed. Code: 16
WARNING: Unsupported upgrade request.
INFO: 172.18.0.1:56028 - "POST /players/552cd222-9ecd-45ff-8363-b3900ab4f74c HTTP/1.1" 422 Unprocessable Content
🤷
idk, can't make it work
it may be because of the content type? http/1.1? api is waiting for application/json
Well for starters use a website like webhook.site to see what you even get before directly tring to interface it with your webapp
WARNING: Unsupported upgrade request.
2025-05-13 12:14:22.048 | WARNING | api.player.router:debug_webhook:37 - [DEBUG] Failed to parse JSON: Expecting value: line 1 column 1 (char 0)
2025-05-13 12:14:22.048 | DEBUG | api.player.router:debug_webhook:40 - 🔎 Incoming request debug:
2025-05-13 12:14:22.048 | DEBUG | api.player.router:debug_webhook:41 - Method: POST
2025-05-13 12:14:22.048 | DEBUG | api.player.router:debug_webhook:42 - URL: http://127.0.0.1:8000/players/552cd222-9ecd-45ff-8363-b3900ab4f74c/debug
2025-05-13 12:14:22.048 | DEBUG | api.player.router:debug_webhook:43 - Path: /players/552cd222-9ecd-45ff-8363-b3900ab4f74c/debug
2025-05-13 12:14:22.048 | DEBUG | api.player.router:debug_webhook:44 - Query params: {}
2025-05-13 12:14:22.048 | DEBUG | api.player.router:debug_webhook:45 - Headers: {'host': '127.0.0.1:8000', 'accept': '*/*', 'connection': 'Upgrade, HTTP2-Settings', 'upgrade': 'h2c', 'http2-settings': 'AAMAAABkAAQAoAAAAAIAAAAA', 'user-agent': 'Workbench/1.3.0.170 (Workbench; Windows)', 'content-length': '95', 'content-type': 'application/x-www-form-urlencoded'}
INFO: 172.18.0.1:47302 - "POST /players/552cd222-9ecd-45ff-8363-b3900ab4f74c/debug HTTP/1.1" 200 OK
2025-05-13 12:14:22.048 | DEBUG | api.player.router:debug_webhook:46 - Content-Type: application/x-www-form-urlencoded
2025-05-13 12:14:22.048 | DEBUG | api.player.router:debug_webhook:47 - Raw body:
2025-05-13 12:14:22.048 | DEBUG | api.player.router:debug_webhook:48 - Parsed JSON (if valid): None
application/x-www-form-urlencoded
body: empty
@red cedar maybe this will help you, i give out until this gets modern
already done 🙂 https://feedback.bistudio.com/T189028
well that feedback is more specifically asking for the hardcoded US/USSR slots in Conflict to be replaced with dynamic references to faction manager, but I also didn't realise faction manager itself wasn't scriptable when I wrote it. Lemme update that 🙂
Looks like the client is requesting an upgrade to a HTTP2 connection but your server only supports HTTP 1.1?
why tf is anyone using HTTP 1.1 in 2025 is the real question HTTP2 has been standard for a decade now
why would i use HTTP 2 for this? makes no sense
why wouldn't you? makes no sense
exactly this JIP error, if you want to produce I can try to help you, because on our server it has presented this to some players, if you need a log of something I can send it to you
with php/symfony and c#/dotnet i had to tweak stuff since they both try to like sanitize/format the request to their standards fyi (mainly because it makes no sens to send json with a form url encoded header but we have no choice rn)
I need a log from client and server at time when JIP happens, but it requires to run server without fast validation: https://community.bistudio.com/wiki/Arma_Reforger:Server_Config#fastValidation which is not suitable for normal servers (as wiki state)
Also mb this requires to use diag exe, not sure if retail exe can provide this info
Yeah, that's why i decide to wait for this to get update and allow us to set headers in a simple way
And it would be nice at JIP time to be able to use the debug console to be able to find bad entities
So, it is very hard task
I don't know your exact use case but I have a script that gets the xyz of players and posts a json body to an api endpoint successfully
share, i may be doing something wrong then
I managed to simulate with a friend only on the server, that is, 2 players
Biggest headache was yes, the headers have to be in csv format:
headersCsv = string.Format("Content-Type,application/json,X-Auth-Token,%1", secretKey)
this is crazy xD
need to run server without https://community.bistudio.com/wiki/Arma_Reforger:Server_Config#fastValidation otherwise there are no information to understand what happened
Yea...I think its in the documentation but if you look up "API" here in discord you'll see everyone eventually learns that you have to deal with this headache
and how do you set the headers after formatting them?
I still hope to build this out at some point more completely and this was all just playing around with it. So if you make any notable progress please share 🙂
RestApi restApi = GetGame().GetRestApi(); if (!restApi) { Print("GeoTrakMod ERROR: Update - RestApi null!"); return; }
string targetUrl = GEO_TRAK_TARGET_URL; string secretKey = GEO_TRAK_SECRET_KEY;
RestContext context = restApi.GetContext(targetUrl); if (!context) { Print("GeoTrakMod ERROR: Update - Failed RestContext!"); return; }
string headersCsv; if (!secretKey.IsEmpty()) { headersCsv = string.Format("Content-Type,application/json,X-Auth-Token,%1", secretKey); } else { headersCsv = "Content-Type,application/json"; }
context.SetHeaders(headersCsv);
GeoTrakRestCallbackHandler cb = new GeoTrakRestCallbackHandler(targetUrl);
context.POST(cb, "", jsonContent);```
So the fast validation option could be a possible solution?
Finding anything in the documentation is a chore, but I think its out there. Otherwise I found this solution by spelunking in this discord. This is the only way I was able to get anything API working
No, its preventing to known what exactly is wrong in state between clients and server, and it's turned on by default on normal server. Turning off this option is required to debug JIP errors
thx alot for sharing mate
great, i guess with this way to set the headers will be enough, i read sometime ago that if u touch headers u have to set everything in headers, let's see
hmm I will try to simulate this again on the server, test this, keeping the false option (disabled) and after that try to check the client and server logs
@woeful vigil to fix it i had to
Host apache on my VPS
apache would then receive the request override the content type header and send it over to my fast api...
it was a pain but it works now
ah u also using FastAPI? uvicorn?
yes
so you also using HTTP 1.1
nevermind.. the server was still running a deprecated version that was not reading the body..
i made it work, switching to http 2, not documented anywhere i think
kinda boring stuff, forcing us to use http 2 for no reason
i tricked it, using traefik with autosigned certs and installing the cert in the Windows as a root cert, but the app is still http 1.1 running with uvicorn
so exaggerated effort to make work a simple POST request, Bohemia never changes, SQF 2.0
how is that solving the http 2?
It supports http2 by default
but this is not the problem, is making certificates and a stuff to make work a single http request
forced to do that
Ah because it only does https?
yes
So... cloudflare?
or atleast i made it work with https but not with http
dude, it's a local dev environment, testing stuff to learn
why would i go to cloudflare?
or i'm missing info or this is making things harder for no reason
could be both even 😄
yeah https is not the issue i worked locally with http with dotnet and nginx
ye
omg, so wth
i dont change headers tho
but u accepted the content type reforger is using by default so
I mean I sent a video of it using HTTP2 locally
yep, that's why i started to migrate to HTTP2
ye
ye probably more http version issue than ssl
it uses 1.1 and no ssl
Request finished HTTP/1.0 POST http://dpl.docker/publish application/x-www-form-urlencoded 442 - 200 - text/plain;+charset=utf-8 1.1830ms
uh lol
ha nvm this one is behind proxy
yep, this is how i have it now, traefik using http 2 + ssl, but FastAPI with uvicorn running http 1.1
Yeah sending post request with json content is the issue for me
As long as i’m not sending data in the body it’s fine… it’s only when i do that it gets fucked up
I’ve tried overriding the headers to no avail unfortunately
you tried with https://requestcatcher.com/ ? whats fucked up ?
POST /validate_server HTTP/1.1
Host: bleh.requestcatcher.com
Accept: */*
Content-Length: 48
Content-Type: application/x-www-form-urlencoded
{"token":"21075082-3a63-4ddc-9357-d73e77c45ab28"}
That's what's being sent from Reforger.. which should work
oh
so... it really is the header that' s simply not correct.
Yet i don't see why apache isn't managing to override the Content-Type header
This is the proper postman equivalent(disabled some headers to make it as close as possible)```
POST /validate_server HTTP/1.1
Host: bleh.requestcatcher.com
Content-Length: 50
Content-Type: application/json
Postman-Token: e8886ae3-85f4-4492-8625-31c74abde173
{"token" : "21075082-3a63-4ddc-9357-d73e77c9a8c2"}
GOT IT
What have you learned
@woeful vigil i have not followed up with the convo but yeah so on my VPS i'm overriding the request header to application/json.
to do that my apache listen for https connection, strip some of the headers then redirect it to the API
# </IfModule>
<IfModule mod_headers.c>
Header always set Content-Type "application/json"
RequestHeader set Content-Type "application/json"
RequestHeader edit Connection "(^|,\s*)HTTP2-Settings\s*(,|$)" ""
RequestHeader unset Upgrade
RequestHeader unset HTTP2-Settings
</IfModule>
The down side is that now all API call will have to be done in json, the upside is that i don't care
How can I enable this render in the game world, not in World Editor?
Hello, I would appreciate the help of someone who is comfortable enough with enfusion scripting and could check my script to make sure it is optimized and solid, It seems to work perfectly but I am not a coder so it would be good to do a check by someone who is a coder. I had it done by chat-gpt following the corresponding scripts examples available in tools. I don't know if this question is inappropriate, if it is, my apologies.
I'm not asking to send it back to me with corrections, just if you spot something that doesn't make sense, please let me know.
By calling Shape.XXX and DebugText (don't remember exact name) in OnEachFrame
If you developed it with chatgpt does it even work? GenAI is not very good with such niche domains
If it seems to work perfectly then there is nothing to optimize
That wasn't tested on full pvp server and the mod is used like this by the community, I would like to know if there is something wrong before updating the mod that's it. since i kniw almost nothing about scripting.
Chat gpt do a good job apparently
At least to make it work, but I still don't know if it will cause problem
If you want to test its behaviour in multiplayer without having to publish it and deploy to a dedicated server, try running it in WB using PeerTool
chatgpt's knowledge of enforce is minimal at best. the reason it can give you working code blocks is because the syntax is very similar to another language.
Cross that bridge when you reach it, premature optimization is the root of all evil
I'll do that, but still not same as a full pvp server right ? for performances
When you run PeerTool in WB it runs a dedicated server in the background and launches a game client to connect to it
So it should be testing the full dedicated server + MP client setup
yeah, I copy the exemple of course, i know where to find what he need
but don't know how to write
All right, Ill do that thanks
You can even set it up to launch multiple PeerTool clients so you can simulate multiple players connected to your server at once, great for debugging RPL/networking issues
if you have api specific questions/a method doesn't exist that it's giving you, you're better off searching for it in the script editor... wiki is also helpful but can be outdated on a decent amount of stuff
Yeah that's how I did, then i ask chat gpt questions, took me days but I'm glad know I have something
Just searching everywhere in the components that are exposed in loitering and swim script and some other too
Yeah that's the way, documentation is pretty minimal atm so Ctrl+Shift+F is your best friend learning tool
I did looked at the wiki just for modded class thing but I'll read the rest, just hard to be motivated to read all that
If it breaks in the future, which it probably will, that's normal. Reforger is basically testing grounds for BI. Things are expected to change a lot.
If what you have works as expected then it sounds like you have a solid foundation for your mod, by going through the logic and reasoning about it you should start to build a bit of an understanding of how it all works until eventually you understand enough to feel comfortable writing your own code from scratch too w/o relying on LLMs
I don't think I'm that smart haha but yeah I'll probably learn more
Animation is my thing
you'll notice it's quite easy to learn, it's just a lot of reading and educating yourself. you will learn something new every day. all of us do.
Just take your time and reason your way through the code piece by piece, you'll get more familiar and comfortable with how everything works over time until eventually when you wanna implement something you'll already have a pretty good idea of how the scripts for it should work
Thanks for the tips guy's!
is it possible to replicate maps with RplProp()?
Good morning, are there any known issue with RestAPI - GET and GET_now? i tryed both but can not receive any data.
No. You'll have to write custom functions for setting your key value pairs and manually rpc them from server to client or vice versa.
please scroll up a bit, we discussed it yesterday
notnull have any disadvantages in use? (for example, in performance)
Some scripts have comments like:
//! \param component must not be null
Instead of just writing notnull in definition...
I'm more about what is already built into the components, but for some reason it only works in the world editor and is not shown if you run a mission 😦
is not shown if you run a mission
because it's written to draw only in WB. Looks like you need to mod to do that:
modded class SCR_ResourceComponent {
override void OnPostInit(IEntity owner) {
super.OnPostInit(owner);
SetEventMask(owner, EntityEvent.FRAME);
};
override void EOnFrame(IEntity owner, float timeSlice) {
super.EOnFrame(owner, timeSlice);
if (m_bEnableDebugVisualization)
DebugDraw();
};
};
Hello, I'd like to create and modify cities, for example, set them as capture points or move them around the map. However, my game must remain vanilla, and the only modification option I have is in the config.json file, so I'd like to create this line, but I can't do it.
I really need someone to help me, please.
Cannot be done without modding
Then it’s no longer vanilla
So how can I do this with a line of code or a direct creation on the map?
No one is going to hand hold you through this. Look at conversations here or other mods for inspiration. You should also look at what can/can’t be done on the scenario side: https://discord.com/channels/105462288051380224/976159829628444682
Header was the issue 😭 Could be added to the RestAPI comments in Script editor
I’d love an update on that documentation in general. It was hard to track down the solution to the header problem
Wait, there's documentation? 
Dang and here I was thinking we were all just flinging shit at the wall to see what sticks
my bet's on the mashed potatoes
it's better to have notnull, better for performance as it is a static check (It gets done compile time) and leads you to catch issues beforehand
People not using it, and doing an if check later on is probably due to lack of forethought on the lifecycle of the instance and tried to band aid it without refactoring.
I do a null check because I want to print some message instead of a stack trace
Which might tell the end user what to do to fix it
Is there any function like Lua's pcall? (If any non-critical error occurs in the called code, the calling code is simply notified of the error and continue to execute)
In Reforger is there a way to see when a player joins?
I need to call a function on join and trying to located where it might be. Like I guess on spawn or even the continue menu when they press the continue button.
BaseGameMode.OnPlayerConnected
Is there any resources where I can find this stuff or are you just digging to learn?
are you just digging to learn?
it's reforger modding process, there are almost 0 really useful guides for scripting, you just open script editor and search
Appreciate it, I figured! I was looking on the docs but couldn't find it! Saved me time!
Any chance we could get an inverse of nullable for types that are not nullable by default like ResourceName? Checking for empty string is 🤢🤮
Ypu should call IsValid on ResourceName
Is there any case that would return false aside from it being an empty string?
If so then it's not really a good substitute
Yes, when the resource does not exist
Ok well then it's not sufficient for my use case
What is the use case then?
I want to allow "unsetting" a property typed as ResourceName, currently I have to check if it is an empty string which feels wrong. If the prefab is "unset" in workbench then the value should be null not an empty string
It should be empty as it is a string
Which default is empty
Use a custon object then
Its like wanting int to be null if not set
They are not objects
Specifically this check comes immediately before a call to IsValid which handles the error case of prefab not being found, but I want to intentionally allow unsetting the vale with some specific behaviour in that case
Maybe it's just because Enscript is based on C# which I despise but most typed languages allow you to specify a type as being nullable or optional
There is a semantic difference between null and a falsy value
You seem to understand the attributrs wrong
They are for exposing variables to configs
Design is that these values should always have the default from scripts
Or the def from the attribute declaration
They are always set in one way or another
If not defined in config, then they take the default value
There is no concept of unset value on them
I guess it's the fact that prefab attributes default to an empty string rather than null which I found jarring then
I just wanted to add some logic to handle when a prefab attribute is "unset" in workbench and comparing against an empty string felt icky
You can but you have to deal with the base container api
If you get it from the script instancd created by it then ypu get the instance from said data
I've already had to deal with it a bit for managing Loadout slots. If that's the alternative then comparing against an empty string suddenly sounds great 😃
Is this accurate / the full story? I did a quick test, and it seems to init entities from the "default" layer first.
Or maybe there is a test mission where we could understand how the supply system works?
Does someone know how to determine where these errors are coming from? I believe this error is preventing me from testing my mod currently. The error is in the base files, so I get it even when I only launch the Reforger addon
Because a search on m_sCommandDisplayText yields 0 results in the code
is there some way to determine how to find that offset?
It is inside the file EmoteMenu.conf, at offset 279, so open some software like notepad and you can see the offset
unfortunately, it will not give you from which mod if it is overriden by some mods
It's just the base addon that I have loaded atm
and I can't open it in notepad, as it's a base game file, so I can't navigate to the folder
how to check if GenericEntity is active? ScriptComponent has IsActive but there is no equivalent for GenericEntity
Why would you need to check that? What are you trying to accomplish?
because there is deactivate method on it, so in theory entity can be deactivated, and based on this you can do or not do something, which make sense for my system
and it's strange thing - you can deactivate and activate entities and components, but you can check its state only for components
Well if you deactivate an entity, you most likely can't check if it's enabled or disabled anymore, as the disabling makes it inaccessible maybe?
no, entity continue to existing
you can activate it again
there are EOnActivate and EOnDeactivate events for this
Of course I can make my own "enable" methods and flags, but why when it's already exist in engine?
And ACTIVE flag on entity doesn't change when you Activate/Deactivate it (and based on comments it's used for different thing)
Hmmm. then I don't think I can help you any further on this 😦 Sorry man
My thought would be to check to see if a component on the entity is deactivated and if so you could assume the entity itself is deactivated as well.
I'm not sure about GenericEntity but one of the classes for ambient patrol AI has some logic that deactivates the AI characters when no players are nearby you could maybe reuse
Does anyone have an alternative mod for the V30 Voting Map, as we don't have a mod for map rotation today?
V30 Voting Map is still giving JIP error with 100+ players 😦
I don’t think that you can actually do a mod like that until BI fixes the underlying issue. At least not a mod to move players into the new map/scenario.
The real solution is to automate the process with Python or batch
in my vision
You can always do console log trailing to do that. You’d still need something to print out the next scenario
in python an automation to understand the closing of the map or victory of some time and change the scenario of config.json
looks good, right?
Switching a scenario from script is 10000% doable.
You just can't do it on a per player basis.
With custom modding yes, just relying on the server shutdown to go smoothly is really inconsistent these days
Not sure why we're talking about it in a scripting channel if you're not wanting a scripted solution.
It was discussion about a mod replacemement and yes the inconsistencies with how servers are shutting down/starting up post game do relate to scripting
I'd say if that functionality is engine side and not script side, then it isn't script related. lol
Again, the inconsistencies with how servers shut down post-game (even with the new startup parameters) can impact scripting. This was mod was pretty useful and can't be used consistently now
It can't be used because of engine side functionality, not scripted functionality meaning it has nothing to do with scripting. Impact scripting != scripting related. lol
Engine side can't be touched by scripts. Still meaning it has nothing to do with scripting.
No one is trying to police anything. I stated a simple fact. Not sure why it's being discussed in the scripting channel if it has nothing to do with scripting.
Everything discussed is indeed scripting
This or a http API that is called. Happy to help over dm if you would prefer
Always interested to learn how people are solving problems like this
I don't suppose you know, the correct type and function I need to achieve my goal?
Nobody is gonna debug your script for you, if you have specific errors then post them + the specific code triggering them and maybe someone can give advice
Also if you're trying to "vibe code" using an LLM to generate Enforce Script for you, you're gonna have a bad time. If you want to do any scripting in Enfusion you're gonna have to learn how to write code yourself
but you can deactivate components separately, so deactivated component doesn't always mean that entity is deactivated 🤣
Yes, but for your use case, Is that actually gonna happen.
?*
that debug is gone since 1.2 afaik.
(Some updates to it made it unusable)
Mario, is there no way to determine if a GenericEntity is "Activated"?
yes, deactivating entity also deactivate component. looks like I need to work on entity, but check state on component...
Note that it is bitwise AND (&), not logical AND (&&)
if (entity.GetFlags() & EntityFlags.ACTIVE)
// Entity is active!.
but it doesn't change when you call Activate and Deactivate...
It does
It's just depending on what
Otyher things might also deactivate or activate the ent
Remember that your mod is not isolated, other things might be managing the instance you are messing with
Physics itself might activate it too
@pliant ingot On what entity are you using it?
I use it on my own GenericEntity for tests now
Yes but what does it have?
Components on it might cause side effects that activate or deactivate it
Things in game logic itself might as well
It's not if it's just GenericEntity or not
Also, what is the idea for checking this?
It might be that the design is wrong to begin with (Like, misusing the Active flag)
It's not a flag to express that an entity is to not be touched or disabled or whatever
It's a flag that controls if the entity is actively ticked by the engine update loop
Which is why you should also not abuse it for (Some hackaround for "telling an entity is to be disabled or enabled"), as you would cause it to be processed without need, lowering available resources without need, not to mention possibly causing unintended issues.
Very rarely you need to mess with Active flag unless you are doing something very low level .
Can resource/supply system sluggishness (having to wait 10/20/more seconds before interactions are possible on live Conflict servers) be solved by simply say doubling frame update budgets? Or is this already solved well in some mod and I'm just wasting my time trying to take a dive into it?
(Dropping this question since Mario is here)
Are you asking about for example the delay on the vehicle load/unload actions?
If so, that is by design (I also do not like it)
Supposedly to make people not abuse the action
Actions, using resources in newly built buildings, everything
This is simple GenericEntity, I just call Deactivate on it and Flags doesn't change
Don't do Deactivate
Do ClearFlags(...)
Could you show me an example?
Hmm, maybe I misunderstood your question. I meant the delay before resources become interactable:
- You drive a truck to supply cache, having to wait 15s before you can load anything
- You built an arsenal at base, having to wait 20s before you can buy anything
etc.
But this doesn't call EOnDeactivate
Ah, so a sort of wait period. mmm
This was added outside of what I did.
I will ask.
It was probably to avoid people abusing it (What is called as supplies barbies)
Yes, it gets worse as the game goes on, its instant in first hour of Confict but becomes half a minute or even more after many hours of play
Yeah, I will ask where to change it.
It's on supplies side, so not resources. Meaning the update budgets have nothing to do
I thought you were talking about some processing lag of sorts
(Might be that too tbh)
As the budgets are there due to them being physical entities and quite complex
Sorry for the wrong terms, meant resources as in SCR_ResourceSystem and SCR_ResourceComponent, so supply system
The bigger the server pop and their behavior, the different those budgets have to be
So it could also be that if you differ a lot from our vanilla servers
What is your server setup in terms of player and gameplay with supplies?
Talking about vanilla Conflict too actually
(Like a lot of compositions being built, a lot of dropped supplies, etc)
I just asking for getter for Activate/Deactivate methods on GenericEntity, like IsActive on ScriptComponent for same functionality Activate/Deactivate on it 
128 players, vanilla Confict
On SCR_ResourceSystem, increase SUBSCRIBED_INTERACTORS_MAX_FRAME_BUDGET if you want more responsiveness to state updates of the interactors (Services, actions, etc)
It will come at cost of server FPS but that is hard to predict. Higher values might just work fine for you
Also
For replication, if you want to increase how often things get replicated
Go to SCR_ResourceSystemSubscriptionManager
Then increase the REPLICATION_MAX_FRAME_BUDGET const
I would say, try maybe twice per each
Got it, wanted to try playing around with these values too, gonna try to reproduce this delay first somehow to see if these values fix/make it worse.
There is a better handling of all this already implemented by me, but it has not made it's way into stable yet
There is a bug that causes it to become worse over time, which is what you are experiencing
That is fixed there, I can tell you how to fix it if you need it ASAP
(It can be fixed in a normal modded class mod)
Please do, could be useful to others who have features that rely on supply system as well
(No rush for ASAP though)
up to you
I get a lot of complaints about slowness with supply system
Yeah it is that bug
It deteriorates the whole thing over time, the more that people use it, the worse it gets
The reason is quite stupid as well (on me tho)
It usually is man
Not exactly scripting specific but thought I'd ask since Mario is around and we're on the topic of Supply:
I have an issue with this SCR_ResourceComponent on a deployable radio backpack, it can access supply from nearby vehicles just fine initially, but if you place the backpack inside a vehicle's cargo it permanently breaks then can only access supplies by dumping them out of the vehicle into pallets on the ground.
I kind of threw the kitchen sink at it just trying to get it half-working and have avoided debugging this issue until now because it was already a pain and I still don't really understand how supplies work so it's probably just some config issue that will be obvious to someone else. Anyone experienced supply system got any ideas what I've done wrong?
(I have free build mode enabled for this prefab, so want players to be able to access nearby supply with it to use for building)
Do you also have a container on it?
I ask, as that would make it to get encapsulated by default by the vehicle's encapsulator
Making it so that it is managed by the vehicle then
Also
MilitaryBase consumer is for bases
Use the normal consumer
You will get "weird" behavior with the one you have
(As things might suddenly connect to it think it's a base. then other bases might merge with it)
If you want your radio to be stand alone
Then normal consumer and generator
Ah ok I incorrectly assumed there had to be a 1:1 setup of containers and consumers, so in this instance where the prefab doesn't store any supplies itself I should have no containers added?
If you want it to connect to bases and use a base's shared supply if available
Then use the ServicePoint one
If you want it to behave like bases (Pool of supplies and comms with other pools) then use the MilitaryBase one
It seems you wanted either normal one or servicepoint one
Correct
Ah yep I think I used the building service prefab as an example which is probably why it's using the militarybase consumer, will give the regular one a try, cheers mate 👍
How do I specify an optional value for SCR_JsonLoadContext? Or a default value if a field is missing?
If a key is missing it just fails reading the whole class
I usually do something like: ```c
class ConfigStruct
{
string version;
void BuildDefaultConfig()
{
version = "1.1";
}
}
ConfigStruct m_jConfig = new ConfigStruct();
m_jConfig.BuildDefaultConfig();
and assign default values on file creation, or maybe you can justc
SCR_JsonLoadContext configLoadContainer = new SCR_JsonLoadContext();
if (!configLoadContainer.ReadValue("version", m_jConfig.version))
m_jConfig.version = "1.1";
Give me an example and what you expected. Read process will likely return false but your data was read anyway. i could perhaps add some options and also a ReadDefault(key, value, defaultValue) method, but I would need to know exactly what you are doing. Give me a minimal code example please as feedback ticket
It is possible to check by script if entity has or not Hierarchy component? Because it's essential for one of my entity I want to add debug check in script
Hierarchy doesn't presented in scripts as type
ok, back to the REST API stuff, i solved the problem(error 422)
FastAPI
normally we do use uvicorn with FastAPI, but the Reforger REST API requires HTTP2 or h2 connection(i'm not expert on that, don't khow what the hell is h2c or h2) and uvicorn does not support that.
here is the header sent from reforger to the api:
{
'host': 'localhost:8000',
'accept': '*/*',
'connection': 'Upgrade,HTTP2-Settings',
'upgrade': 'h2c',
'http2-settings': 'AAMAAABkAAQAoAAAAAIAAAAA',
'content-type': 'application/json',
'content-length': '92'
}
Then what i did is switch from uvicorn to hypercorn, ofc, normally http2 requires certificates but since we only need that the connection is type h2/h2c here is a trick:
# hypercorn.toml
bind = ["0.0.0.0:8000"]
insecure_bind = ["0.0.0.0:8000"]
h2 = true
loglevel = "debug"
then run the app like this:
hypercorn main:app -c hypercorn.toml
and it is finally fixed
sending the content as JSON from reforger works just fine, just modify the headers
// configure Headers
string headersCsv = string.Format("Content-Type,application/json");
context.SetHeaders(headersCsv);
mentioning ppl who was involved or curious about --
@coarse pasture @red cedar @vernal moat @ocean kernel @serene fox
And it's not visible by ent.FindComponents(Managed, arr);
I just use sanic without non-http (cgi, wsgi, whatever) nonsense and dont have this kind of issue
but u using certificates and stuff? https?
if this entity has child/parent try to get them and verify its not null
There is a problem - many of these entities may have only a parent and only a few will have childrens. So for second one I can check that, but not for first one
if all of your entities have at least one of them (one parent or one child), receiving null on both means hierarchy is not there, would that work ?
in my case - no, because some of them can have nothing
ha add getsibling check maybe ?
so looks like I need to force all these entites to be inherited from specific prefab and check this...
Root entities doesn't have siblings
then force inheritance from specific prefab...
and believe that very "not intellectual" users of this will not disable/override it...
Sure, in Nginx. Sanic is a web server not some 1995 cgi app so there are no hacks.
How do I make input manager consume action and not pass it to lower priority contexts?
Setting Exclusive doesnt do anything
This doesnt do anything
Hierarchy component is nothing else than a wrapper for calling AddChild for some entity when spawned through a prefab
Its practically irrelevant outside of that
Glad to hear you made some progress and thanks for sharing the follow up
FastAPI is newer and modern than sanic, at the end u using nginx, is doing the "hacks", so idk what u talking about xD
also, forced to use a certificate, which i think is overkill for a dev environment, could be good for production
HTTP to HTTP is a bit more sane to me than HTTP to 1985 CGI
Sanic being a web server can do ssl out of the box but we're getting a bit offtopic here
FastAPI also doesn't support HTTP2 which was standardized in 2015 so yeah nah while it might be slightly new I don't think it's that "modern"
Also you can get a free SSL certificate from let's encrypt, it's not a huge deal
dude, but why in the hell would u use a certificate in a local dev environment?
That too, I wouldnt
not fastapi, uvicorn is the problem
Idk if the enfusion REST API requires them to be signed by a cert authority, if not then you can even just generate your own on the fly as part of your dev server startup
not, is not required, just required to have h2 connection protocol
Please make this a thread instead or stop it. Topic can develop a lot and clutter the channel
you can have also self signed certs, not a problem at all, but i found a way to avoid certs, much better for my pov
http2 is not required for the restapi calls in script
Hey guys! Does anyone know how to set a vehicle spawn timeout for the whole team? I.e. no matter who spawned a jeep, whole team will wait to spawn for another one?
The question is how to set it team wise 🙂
@minor agate Anyway to enable debug trajectories like this video through a script on the normal game version? There isn't any reference to it on the exposed debug menu
https://www.youtube.com/watch?v=Y5GAeLI5Xk8
No the diag menus are only in the diag exe
damn, thanks. Any ideas how hard it would be to create this functionality in the base game? Mainly tracing the line with changing colors?
The diag shapes (like the line you see) can also only be done in diag. if you wanted something comparable in vanilla it would need to be done with a lot of hacks and would likely not perform well. Just don't.
dang :(, thanks for the response 🙂
I have doubts about how to automate the change of scenario, in this case, to rotate scenarios.
This is not good... So you can't easily draw projectile trajectories for spectator mode, firing ranges, replayes and etc, which is common for A3
Does anyone know if I can insert a sound on the loading screen?
I can now change it on the pause screen, but loading screen no
literally why i was asking
helloo doo yoo have anie solution for this
bool class doesn't contain those functions. You need call them from the proper class
doncwhat is need change
what y nned call from proper
That code is completely nonsense LLM slop, if you wanna write mod scripts you're gonna have to learn to write code yourself
YES IS GOOD TINX MYS SCRITP NOW FONCTIONNEL


when can we have multiple screens for the script editor... I have 3 screens to use up...
I'm trying to create a script where some players (using the bohemian id) can open their respective arsenal boxes, these boxes are only opened by these players, does anyone know how I can do it?
If you can live without global namespace typing/autocomplete most editors/IDEs can handle it pretty well when interpreted as C#
Zelik's Persistent Storage mod has claimable storages that might be suitable for your needs or at least give you a good example
I’m going to be developing a vscode plugin that re-uses my VFS work on https://github.com/landaire/enfusion_tools to read data directly out of game files
Hoping to have a proof of concept script parser + LSP server to make editing in vscode match the experience of the workbench (minus debugging)
my post here describes that repo and the site a bit better #enfusion_external_tools message
Is there any simple or built in ways to display debug info above an entity?
Is there any scripts out there for making items visible in pouches when they are in your inventory similar to rhs?
Did you just answer your own question 
is there a way to force ragdoll on hit over script?
You can force ragdoll by creating a custom animation command for it. Make sure to execute it on the owner rather than server: https://github.com/acemod/ACE-Anvil/pull/217/files
would that still work while i also force them in uncon state for a short time ?
just making sure it wont f eachother 😛
You dont think its maybe a little overkill for me to use all of RHS as a dependancy for one script? Thats been how i’ve been doing it but if there was a script out there doing it i wouldnt need RHSs 6gb
If you want them uncon, don't use this approach, but rather just damage their resilience hit zone to below 33 HP.
i already have a system to uncon them without dmging them at all. no need for dmg , but i hate how they fall and i want to make them ragdoll more
Force ragdoll won't change that, as it behaves the same as uncon ragdoll. You would rather want to overhaul the ragdoll physics. I think there are already mods out there that do this.
as you can see this kinda looks dumb lel
Feel free to to copy pasta my toggle ragdoll mod to suit ur needs
I just toggle it on a button press
Not really, unless you prefer unrealistic Hollywood-style knockbacks.
would you be up to help me with it to see if we can get it to work ?
nah i just want them to move a lil its a high pressure water blast to the body , you dont just drop on the same spot XD
If I was near a computer I would, currently away at work in the jungle haha
Could set up a on contact event or something from the players side 🤷🏻
no worrys im working atm aswel so can jump later in a chat if you up 🙂
Back home in a couple weeks, if you are still working on it then lemme know I'll be happy to help where I can 🫡
all good :P, can you dm the mod link to your ragdoll mod ?
I just now noticed that it is meant to be a water canon 😅
yep 😛
kinda started as a joke and then i made it lel
bruh that shit is mad funny lel
i somehow broke it 5 sec into testing it lel
Yeah haha, I got annoyed while I was working on something else, so I decided to entertain myself
im broken XD
Yeah, there is a bug that doesn't let you up 😂
But if you are paralyzing people with a water cannon, it'd make for a good laugh
if i find a fix for that ill let ya know 🙂
when yoiu get hit in the neck and break your spine uff
🌟 Just french riot things 🌟
While I've been away, I've thought about adding a GM action so admins can abuse more powers 
i notice that the bug happends when the weapon is dropped , if it is not dropped and stucks to the body (as how uncon in the vid was aswel) the bug does not happen
so ill have a look into that 🙂
Appreciate it, hope it helps 😬
ill keep ya updated thanks 🙂
I had uncon and freeze commands tested out once for fun, should revisit them. Good for slowing down the trolls in game
perfect I'll take a look, thank you very much
Please stop
Has anyone here had any experience with changing pip optic HDRs during play time? I am able to make the swap, but the reticle on the second HDR doesn't appear. I can make it appear if I set the priority higher, however this then causes the reticle to be duplicated
modded class SCR_EditBoxComponent
{
// This is to disable forced focusing on 1 edit box for PC players
// It will affect all menus
override void UpdateInteractionState(bool forceDisabled)
{
if(System.GetPlatform() == EPlatform.WINDOWS)
return;
super.UpdateInteractionState(forceDisabled);
}
}
The way the text edit/input widget locks focus is terrible on PC. I quick fix if anyone needs it ^^
Can anyone help me? I made a script for an arsenal box that identifies the player's UID and enables opening if the UID matches, I see in the console that this logic is working, the only problem is that it is not opening the arsenal interface that used SCR_OpenStorageAction and it worked, despite my script extending it, for some reason it does not work.
If I can send the script and someone can analyze it, I believe it is just one line of code that should not follow the logic.
does ```c
AIWaypointCycle.GetWaypoints();
It gives you the waypoints to be cycled, not related to randomness
yeah it always seemed to pick a random waypoint to spawn the ai on, even when I chose waypoint[0] every time. I just had the idea to use the origin of the ambient patrol spawnpoint component though, should work much better.
now im wondering if waypoint[0] is the cycle waypoint, would make sense lol
if i'm making a custom class to use in my component (state pattern), and need to replicate it, what do i need that class to inherit from in order to have the replication ability without creating a component?
You don't need to inherit it, you need to create codec for it: https://community.bistudio.com/wiki/Arma_Reforger:Multiplayer_Scripting#Network_Modding then you can use this class for replication (for RplProp for example)
the brain is not pleased
Anyone familiar with container API know what esoteric incantation must I invoke to get the AreaType of a slot in BaseLoadoutManagerComponent?
slot.Get("AreaType", slotType);
slot.Get("Prefab", slotPrefab);
Gets the slot prefab fine but the type is always NULL
All class's variables start at least with m_ prefix, also there are methods to get all available names, so check them first
how do you know what sizes to make the packets? like for instance, I'm looking at SCR_RespawnTimer as an example for the moment. how do they know that a WorldTimestamp is 64 bytes?
I can get the slot name as a string fine via slot.GetName() but I specifically need the typename so I can pass it to charStorage.GetClothFromArea(slotType)
Maybe I'll just have to create a map of slot name -> slot typename
I think AreaType should be the correct key for that attribute as it's what I got by copying name from the component in WB but it always returns null 😦
Because WorldTimestamp is literally defined as int64
Don't think, print all it's names from container
And you should be able to get typename by getting to Managed/Class var and call Type on it (if it's class)
seems AreaType is the correct var name
how do you do type comparisons if you don't have access to Cast again?
// inside of my component:
void ChangeState(ACE_MedicalDefibrillation_DefibrillatorState_Base newState)
{
if (/* same type as current state in m_DefibrillatorState */)
return;
// do other stuff
}
my custom state class does not inherit from any component or script class to get Cast
Your class is inherit from Managed or Class class by default
So you can use Cast, Type and IsInherited methods
Then check it's type, out var should be compatible type
my whole problem is out var of slot.Get("AreaType") always returns null
What type of out var?
typename slotType;
slot.Get("AreaType", slotType);
Is how I'm trying to read it
read value of what? Isn't slot.Get meant to return the value of specified var?
You try to read typename which isn't type of "AreaType"
It should be some sort of class
I must be confused, I thought typename is some kind of generic type that matches any class? The AreaType var gets set to a class e.g. LoadoutArmoredVestSlotArea, I want to be able to read whatever class is set in here
like I wanna dynamically get the class assigned to the current slot I'm processing, not a specific slot's class
Attribute is instance of some class, typename is generic type that describes other types, BaseContainer.Get returns instance of class, to get typename you should first get attribute value - instance of class, and then call Type on it
And according to this screenshot - it's of LoadoutArmoredVestSlotArea class
Actually it may be some parent class, but current value is of this class
So your var should be of this class or any parent class to successfully get value
Just try to use Managed or Class for var type if you want just a typename from it - this should work
Your suggestion to use .Type() led me searching for how I can get that as I couldn't find anything I can get from the basecontainer with that method, found a jank work-around that is really not ideal but it does the job - I just said screw container API and spawned item of the currently processed slot to look up its slot as InventoryStorageSlot so I can just call .Type() on that directly then delete it again on conditions where I wanted to avoid inserting it originally
IEntity item = GetGame().SpawnEntityPrefab(variantResource, GetGame().GetWorld(), itemParams);
InventoryStorageSlot slot = storage.FindSuitableSlotForItem(item);
// don't insert if slot would already be blocked e.g. armored vest with rig blocks rig vest slot
if (!slot || storage.IsAreaBlocked(slot.Type()))
{
SCR_EntityHelper.DeleteEntityAndChildren(item);
return;
}
Thanks for the help Vlad, appreciate it! 🙂
getting type of var from container should be like this:
[BaseContainerProps()]
class MyBaseClass { ... };
[BaseContainerProps()]
class MyClass1 : MyBaseClass { ... };
[BaseContainerProps()]
class MyClass2 : MyBaseClass { ... };
...
class MyComponent : ScriptComponent {
[Attribute()]
ref MyBaseClass MyVar;
...
};
...
void SomeFunc(BaseContainer container) {
MyBaseClass myVar;
container.Get("MyVar", myVar);
typename myVarType = myVar.Type();
... // myVarTyoe can be MyBaseClass, MyClass1 or MyClass2
};
So in my case I would have to type myVar as LoadoutArmoredVestSlotArea? That's kind of the whole thing I'm trying to avoid because I'm looping over every slot and wanted to just get a dynamic reference to the type to avoid needing manual handling of every class used in the slots
Better to find actual base class (I think ArmoredVest is like MyClass1 - it's inherited from some base class, which is real type of AreaType attribute)
But for current value this will work
AAAAAH gotcha, so I need to type slotType as the base class all the classes used inherit from rather than typename which seemed to be casting it to null. This works perfectly, thanks Vlad!
ResourceName slotPrefab;
LoadoutAreaType slotType;
slot.Get("AreaType", slotType);
slot.Get("Prefab", slotPrefab);
now I can get rid of the unnecessary spawning and deleting of items that shouldn't be inserted in the first place 😄
are there any good resources for learning enforce?
Learn object oriented programming
i know C++
and from what ive heard enforce syntax is very similar to c++ syntax
but i dont know any of the functions in the workbench for scripting
That's as good as it gets.
Just invest time in the tools. You'll learn the important functions as you experiment.
https://www.youtube.com/watch?v=Fgl_mAHReP4&list=PLfUcrRpCM_fKjkTrkV-bqnknVbFCPA3YU
Watch videos 1, 2, 4, 5, 6, and 10. They cover a wide landscape of scripting topics.
https://reforger.armaplatform.com/news/modding-boot-camps-introduction
This Modding Boot Camp seminar was originally held on the Arma Discord Server on November 20th, 2024.
Join Modding Supervisor Mario Enríquez for our first Modding Boot Camp, where he gives a quick overview of the Arma Reforger Tools and Workbench.
00:00 - Modding Boot Cam...
is it possible to let AI walk out of a rock but not into one from the outside? so surface settings for obstacle-like or static map assets.
maybe just disable the collision for 2 - 3 sec.
that could work at spawn time, I want to make sure they can get out if they get stuck despite tracing and other checks
Wouldn't there be a risk that they would walk and end up inside the rock sometimes? Not sure if the rocks should be "fixed" or smth.
The work around is to move all AI spawns away from non terrain meshes then give them waypoints to defend where you actually want them to be
I assume BI will fix it eventually so any further effort for now seems overkill
can we set static map marker to be visible to specific faction through script?
Hi! I'm looking for Stack or Queue data structure implementation, do you know is there any of those implemented in Arma already?
I can't find such. Maybe you have an idea how regular array, set can be used to achieve the same behavior?
search scriptcallqueue
irrelative.
hey guys, does anyone know how to setup a size (as in amount of items the vest/belt can hold)
currently working on gun slings based on RHS Weapon Holster system, but can not find that, what will allow me to store slot 1 guns in inventory
Thanks for answer but as I said above I'm looking for a "DATA STRUCTURE" not script call queue...
Please read the question carfully.
Data structure like array, map
but with methods Push(...) Pop(...)
Algorithm fi-fo and fi-lo.
"fi => First In"
"lo => Last Out"
Hi folks this is a bit of an open question, am drifting into enfusion coding after 20 years of ofp/arma coding and am starting a long path of coop mission design template creation, which i want to create without any dependencies for addons My question is after creating the subworld what cannot be initialised, created with code that MUST be in the subworld.
For example I presume the AI navigation mesh must be created in the editor (or can it be loaded via code)?
Such things as Player role selection and loadouts, I know can be initialised and controlled by code, but may require a spawn point creating in the editor?
My end aim is to create a template for my community where the mission makers basically only need to edit some json config files, add ai and waypoints and maybe some triggers for win/lose conditions.
So
WHAT MUST be in the world that I cannot initialise/configure from code
Such as maybe some elements of the scenario framwork
TIA
Check SCR_Stack<T> .. probably this is what you're looking for .. my bad
Thank you god! This is it! 👍
Guys, any idea why is this happening?
Why in my broadcast method score = 1 ?
This is a GamemodeComponent
Here is log
interesting that string factionKey passes but int score doesn't...
Log is from Workbwnch
You have it typed as bool in the broadcast method which casts int to 0 or 1
oh my god thou bro! Thank you )))))))))))))))))))))))))))
Yeah! Thats funny... I forgot that RPC thing doesn't really checking types what you are consuming as this calls happens only in runtime and it is not possible to detect type inconsistency at a compile time...
My bad. Thank you for rapid answer brother. You are my god! 🔥
You can use a type of search for this as well, let me see if I can find what it is called, think it's a search predicate.
Nvm, you are searching for slots, not items, my bad.
Anyone able to help me with this issue?
How can i handle swimming? I want change swimming parameter, but cant find where is it.
fwiw I think bools and ints implicitly convert. I saw what I think was a bug in one of the SCR_* scripts where they were using something == something_else and used it as an ID to lookup, which I do not believe was intended in that case #enfusion_scripting message
hoping that if I actually manage to successfully create a language parser maybe I can build a linter that catches these sorts of things
https://github.com/simonvic/tree-sitter-enforce
Built for DayZ by a community member but you could fork it for new enforce script
still debating if i want to use tree-sitter or hand-roll something using https://github.com/zesterer/chumsky
if someone's already done most of the tree-sitter work I may as well use that though
From his videos (You can see in DayZ modders), seems pretty functional
you have a link handy by chance?
I have a full grammar for ANTLR and one full implemented for C# Visitor Pattern. I can put it on GitHub later
Is there something I can do to track server memory leaks better?
Mario
Is Supply system causing memory leak in Conflict?
I see Conflict servers always leaking
Even vanilla
Does that have anything to do with the slow supply system updates?
When it slows down over time
And if you can't find it using "find symbol" then it doesn't exist.
Is there an option in the Reforger scripting editor or Enfusion that tests to see if your mod will conflict with other mods?
You'd have to load up tools with the other mods and see
has anyone got the script for dr*gs mod on arma reforger?
You could track the memory use by just tracking the process of the server.
Thanks but I want to know it in good enough detail to see WHAT is occupying the memory specifically
Like how much memory allocated by scripts, resource system, AI, etc
Either Enfusion Engine needs to provide something .. (something I am not aware of anyway) or you would need to add your own kind of debug mode inside your scripts .. which will only execute if in Workbench. (Or log everything in sections .. Memory, Cpu etc etc)
The supply system definitely fills up our logs with errors, so wouldn't be shocked if there's something going on there under the hood vanilla
We've been working on a script to print out null references on specific functions that seem to be a poblem
I understand your pain tho .. in a different game .. it was pain in the ass before they finally added profiling xD
Would love if this was added to the debug version of the game. Getting memory leaks from a TryInsertItem operation in one script but not the other. Would be great to be able to actually see what's happening there
so ive created a custom map and is ready to go besides not having a scenario id. Where can i add that?
That has nothing to do with scripting. All you have to do is create a new SCR_MissionHeader conf file.
Do you mean something like strace(Linux)/perfmon? There might be something for Windows you can tweak to see what Arma is doing to catch a leak.
ok I apologize. thank you for the help
No worries.
It's not going to capture rich allocation data about types though
you'd need to instrument the allocator based on runtime type info
The issue was not a leak, just bad heuristic for the actual player usage
About vanilla, from what I know no mem leaks on that.
About modded, idk. Hard to say based on how modders mod things
Like for example
Someone using a call later on a strong reference, if the call later is not ended then the instance is kept alive
Even tho if the system wanted it gone
Which is why call laters should alway be avoided
It's not so much of an architecture issue only, but also memory usage and lifetime issue
Specially even if you pass a system on the arguments
Even for us, those leaks are super hard to figure out as the connection to things with call later is gone
Hard to debug even with visual studio debug
vs debug 
not vs code
No I know, still puke.
it can be CLion, or whatever
Just the attach to debug process thing
I personally prefer CLion
I have an unhealthy amount of debuggers but mostly for nefarious purposes.
I created a generic entity in the world and a class searches for it but ends up not finding it
IEntity vpManagerEntity = GetGame().GetWorld().FindEntityByName("VPManagerEntity");
if (!vpManagerEntity)
{
Print("[VPUtils] VPManagerEntity entity not found!");
return null;
}
For some reason I can't start this entity, I've done everything
Right click on that, then set the name you are using in the script "VPManagerEntity"
Named entities are for those that you have manually named like that in the world file, hence why you have the method in the world class
It's not for prefab name or anything like that
I actually think I already understood the problem, it's that I created the entity but I didn't instantiate it in the world, but I had a doubt in this case... which world would it be? because I want the mod to work for all world conflict
Do not use FindEntityByName then
Register the entity somewhere in script upon init of itself, or a component on it
can i basically register when i start gamemode?
Get the entity, on it's init or whatever from scripts
Then call SetName("VPManagerEntity"); on it
You could also do that
(It can be anywhere, just easier to do it on init of the entity or a component on it as you get it right away)
Has anyone had items from arsenals disappearing after moving farther than the networkviewdistance parameter?
We're spawning gear on entities when they initialize, but if they move past a the server networkviewdistance, the items disappear from the player inventory.
Likewise, we also noticed teleporting players long distance causes server fps to nearly crash.
It honestly seems like the rpl bubble isn't updating or the player controller isn't attaching to the entity somehow.
Gonna try to replicate in the dedi server tools with debug up, but it's honestly super odd.
Did you fix this problem?
Yes
"m_bCustomBaseWhitelist": true,
True should be 1 or 0 not true or false
Oh, thx
No problem!
Why memory usage doubles over 6 hours for vanilla conflict servers?
It will eventually run out of memory but (un)fortunately it crashes before that happens
Anyway I need to know how to find what is leaking memory on servers
Or at least how much memory is allocated by category
With scripts I would expect to see memory allocation by mod

6h also means more content/items/data laying around
Could be anything
I know some memory optimizations have been done recently overall game wise. But that is not even on exp currently
Does conflict clear memory on round end now? Assuming it doesnt freeze the whole server like it usually do
Also on an offtopic can you improve the speed of printing to log? If something is log spamming it's immediate frame drop
Or do something clever like group log messages
'My error (message repeated x15 times)'
How high is the memory usage? Curious.. One of the scheduled restarts missed and had an instance run for 24h at 15GB memory usage 
Disable logs for better performance, same story as in any previous arma title. Log file writing is never for free. And no we will not add any accumulation
It's fine usually, but sometimes there is huge log spam, even from vanilla
Disabling logs is not a solution because it increases risk of losing some valuable logs, even if most of them are garbage
Just print all logs in game chat 
It doesn't work for me. Maybe something else is needed?
"m_bCustomBaseWhitelist": true,
"m_aCampaignCustomBaseList": [
{
"m_sBaseName": "TownBaseMontignac",
"m_bIsControlPoint": true,
"m_bCanBeHQ": false,
"m_bDisableWhenUnusedAsHQ": false,
"m_fRadioRange": -1
}
]
You didnt do the thing the guy said to do lol
Haha jep
It doesn't work for me. Maybe something else is needed?
"m_bCustomBaseWhitelist": 1,
"m_aCampaignCustomBaseList": [
{
"m_sBaseName": "TownBaseMontignac",
"m_bIsControlPoint": true,
"m_bCanBeHQ": false,
"m_bDisableWhenUnusedAsHQ": false,
"m_fRadioRange": -1
}
]
thx
Is postframe not a thing on components attached to AI characters?
I have a component that does something in postframe on the character and it doesnt work when its controlled by AI
Actually nvm it seems like it's for players as well in multiplayer, only works on the character of the local player
You have this specific method to create if you want to receive it on remote proxies, let me find it
OnTicksOnRemoteProxy
This is only for entities type inheriting from BaseGameEntity
And you do something like :
bool OnTicksOnRemoteProxy() { return true; }
Does anybody know what script to edit to make more of these?
ECommonItemType in InventoryConstants.c ?
Tyvm will try when I get home
What do I need to call to appear a notification on the hud for the player?
Ty man
I've found it a bit tricky to work with but the documentation is surprisingly OK
I was close to doing it correctly, but I was trying without documentation, now I believe it will help
Let me know how it goes. I've been playing around with an expanded notification mod with an easier api for other mods to use
Hi guys! I'm trying to implement a bullet hit animation, something like in battlefield, so the instigator has a feedback when bullet hits the target.
Is this right place to do so?
DamageEffectEvaluator
Actually I need to display hud on the center of the screen and play sound when bullet hits the target. This explanation is more accurate.
But thats GameComponent and I have ScriptComponent, I need PostFrame specifically
I'm still having trouble, I can't get a simple notification to appear on the player's screen when interacting with a box LOL
You'd have to create overwrite the notifications.conf, add your custom notification type, and then pass the compatible notification type to that speicfic notification
But yea its tricky lol
ScriptGameComponent
Why isnt script component working tho
Good question, I imagine it should still run on server if it owns it
Buttt scriptgamecomponent will let you do the remote tick, was mostly reading that part. Not sure why frame not running at all
So like
Anything I can do for script editor freezing for 5 seconds every time I click it?
Happens when I have quite a few mods loaded
Something i happened to notice in my testing is that if you neutralize an ai group in GM, it stays in the GM budget. It only adjusts the budget if the ai group is deleted. So maybe when you kill an ai group, its neutralized and still in memory?
Just a wild guess from an amateur!
lol the other night I had like 60 mods loaded and it took about 15 sec everytime i switched to the script editor
I do wonder about the lingering/phantom AI
Active AI will often report out as 0 but they still exist and hold a location in the world
Does anyone know how I can disable bacon loadout on a specific box?
hi im new and im wishing to get into making mods/scripts, im trying to make a item respawn after been taken i tried to google on howto but i cant seem to find anything, also how do i hook a script upto them item?
Still having this problem. If zeus moves, say, a vehicle with a bunch of infantry in it, the infantry get moved to their spawn location or debug corner and their RPLs fluctuate massively. They also lose control of their player controller.
The server thinks I'm still in the vehicle as well, and if we move the vehicle back to the rpl bubble location, it teleports the player back into the compartment and returns the server fps back to normal.
We're also seeing items disappearing from player inventories if they take them out of arsenal and move outside the rpl bubble size. As soon as you move back towards the arsenal or drag the vehicle back towards the original location, everything syncs back up.
I am almost certain this is how we're initializing the player entities/controllers:
Original post here: #enfusion_scripting message
It doesn't care about GameComponent or ScriptComponent it is for every component, just GameComponent have the base method defined
Ok, but is this a suitable replacement for postframe?
Oh wait lol I misunderstood that method
I think I get it now
It doesn't replace PostFrame, it just tells the game that your component should tick on remote proxies
If you are doing custom, I would try in vanilla and see if the issue is there, if not then it is probably something that you do, but it just looks like that you TP at incorrect place the infantry inside, so you end up in a bug where players inside are not close to where the vehicle is
Or just simply character don't get teleported as well
last time i had some lag/freeze in workbench a green guy told me to exclude workbench and reforger folders in windows defender, it did help
there is also onedrive and alike folders issues but you already know about it i think
I am "Green guy" now I guess 
Yeah that doesnt help for me, when I open like 30 mods script editor takes 5 seconds to focus
lol i think it was someone else maybe lou or nirroz ^^
Just put him on ignore like you put me
For me capping the frame rate(for the wb) using the nvidia control pannel helped tremendously.
It works fine once it has focus, but it takes 5 seconds for it to get focus
Does Reforger support multi class inheritence and if so, what is the syntax?
Example in C++
class C: public A,public B
{
... ... ...
};
No
Thanks for the answer. Is there something else that can some close?
Yes, composition pattern
or aspect oriented design/programming
Btw what is the correct way to override a e.g protected function? Or does it even matter?
I know there was a discussion about this some time ago.
override protected void Foo()
protected override void Foo()
override void Foo()
And same for event where does it go and do we need it?
override event protected void EOnInit()
Does anyone know how I can disable bacon loadout on a specific box?
when you override everything matters even the attributes (is what i understood)
i think event is just decorative tho not sure
dunno about the order tho
@ocean kernel 😄
Disable the action in the actions manager component?
this box can only have default and native action of SCR_OpenStorageAction
Is there a separate action just for bacon loadout? Because I don't see it here and even so the bacon loadout appears lol
Of course there is. You can disable it if you wish.
Or use a prefab that doesn't inherit the base arsenal entities.
I was using ArsenalBox_FIA and CIV but overriding the Arma prefab, in this case if I duplicate it without overriding, would I be creating a new box without inherit?
I'm sorry but I am not here to teach you how to use Workbench, I gave you options you can use to disable
and that...
Ty for all
I suppose ItemPreviewManagerEntity.SetPreviewItemFromPrefab only works for entities with inventory item component? I wanted something similar to workbench thumbnails for prefabs
I believe I read previously that if you override a protected function and do not mark it as protected again, it impacts the visibility of the function to mods loaded after yours
They are doing it back in forth in vanilla.
override first protected first i think it doesn't matter at all.
For overriding vanilla just do it like in vanilla, if its protected do protected I guess
Currently yes in the future no. Override and return type are needed. None of the other keywords
What’s the rationale for dropping the requirement going forward? Too much friction from people unaware?
it does more damage than it helps. it could also accidentially make things unstatic
Is garbage system config supposed to automatically insert and remove my entity class or do I have to do it?
AFAIK you do have to script it somewhere if it's a custom entity
Ok
e. g. CharacterController OnDeath:
auto garbageSystem = SCR_GarbageSystem.GetByEntityWorld(character);
if (garbageSystem)
garbageSystem.Insert(character);
The garbage system config determines how the inserted entity is treated
How many bytes can you safely broadcast in one go via Rpc?
I know this depends on multiple factors, I'm wondering at what order of magnitude (roughly) this is something to worry about.
@teal vapor that behavior is not being changed
What changed was the static one
The rest will be kept
@late locust
You can use it to make methods public that were private or protected
Its the aspect of the modding of method signatures
Before you were able to also mod a function from.being static
That was dropped due to it not making sense and causing more damage than good
oooh i see. yeah that sounds pretty problematic.
Lol wtf unstaticing your statics
do these work yet or not?
@coarse pasture I finally managed to apply the HUDmessage to the player, but now I'm not able to set a cooldown, have you tried?
What are you trying to cooldown specifically?
I want the message on the screen to appear every 10 seconds when the player is in the arsenal box, but it is sending spam every second lol
You'd have to share more of your code honestly. Sounds like an upstream thing that you're doing not the actual notification itself (since it sounds like its sending)
Anyone able to point me in the right direciton in terms of getting clothing to be effected by GM Ent Clearing? I have searched high and low, but can't seem to find anything.
What's the deal with super with multiple overrides? Ctrl+Click in script editor suggests it works as expected but running the scripts it seems no many how many nested supers I use it always calls the super of the "closest" override
I'm trying to override EPF's override for SCR_SpawnRequestComponent.OnPostInit to call the vanilla version e.g.
super is EPF's override and super.super is the original vanilla one from SCR_SpawnRequestComponent but at runtime it seems to effectively just be calling super.OnPostInit(owner), the logic in SCR_SpawnRequestComponent.OnPostInit to bind components is not called
override protected void OnPostInit(IEntity owner)
{
super.super.OnPostInit(owner);
}
Is there any easy clean way to do what I'm trying to aside from removing the super calls entirely and copy-pasting code from the super call I want (which only works if that class is scriptable)?
super is idempotent
super.super...nth-super => super
If you want vanilla behavior of the class, then you must use vanilla
vanilla.OnPostInit(owner); in your example
in this case, super is resolving to this, so you are doing this.super (Yes, super returns this)
wtf I didn't know vanilla keyword existed how did I miss that 😄
Is there still a way to make a static methode none-static?
There is one static vanilla which i would like to have none-static the methode is in the class where it get's called from and everything else fit's as well.
No clue why it was made static in the first place only thing the static does in this case is taking away all the functionality of the class to be used with the methode.
This seems to have worked perfectly, thanks Mario! What is kind of confusing is I expected Ctrl+Click on the method in script editor to resolve the same as it would at runtime. Using vanilla.OnPostInit works at runtime but ctrl+click in script editor takes me to the EPF override that it's skipping, while doing ctrl+click on super.super.OnPostInit took me to the vanilla method which it wasn't running
Could you show me?
Could have been done to cause inlining
I asked/posted it in enfusion_ai a long time ago now i can't find it anymore...
Will have to look up the exact name when i'm on PC tomorrow.
Thanks for checking. 🙂
Found it!
#enfusion_ai message
What's the most efficient way to call a method that checks if something is complete? Right now we're using callLater(), but isn't that essentially spawning a new thread every x amount of ms we pass into it with the loop parameter to true?
I feel like there's gotta be a better way to call a waited method rather than spawning a new thread over and over.
Set a bool to true once it completed and check the bool periodically somewhere/wherever you need it.
What exactly do you need to be checked for completed state?
So what are you doing to check the bool? Onframe?
You still need a way to check the bool in an organized manner
Yes you could use this.
I always check if there already is something looping in vanilla like Update() which i can use to check so i don't have to add additional code.
Guess everything is better than using callLater().
Is there a way to get fire an event every time a chat message is received? I know I can send one, but I don't know how to hook into it to fire an event that executes my own code.
Send message:
PlayerController pc = GetGame().GetPlayerController();
SCR_ChatComponent chatComponent = SCR_ChatComponent.Cast(pc.FindComponent(SCR_ChatComponent));
chatComponent.SendMessage("Hello", 1);
So we want to keep e.g protected to not change visibility but does the order of override and protected and eventetc.. matter?
no
The order can be whatever as long as they are before the method identifier
void static ref private
and do we need to add everything including event when overriding? Or just simple override and done
I meant no to the order
If you do not include protected in your override then you made it public
Same deal for normal inheritance
Yeah but what if I dont include event for e.g EOnInit
Like override event protected void EOnInit(IEntity owner) if that is even needed
Cause vanilla game code sometimes does it and sometimes not
Because most devs do not know
Arkensor learnt it the hard way as well, i had to point it out to an error he had
In his case it was the static one
Technically all modifiers could be modded
With event, it still somewhat works because the class that was created before yours still has it
Modding works as in creating a class with the original name that inherits from original with different name
It does that literally
But this old renamed class does not show up to you when referencing it anymore
So the logic of the new class having the things overriden this ways follows, making the feeling like the original became that
So not adding event doesnt delete the event modifier
I guess best to just add override in front and add everything after that 1:1 (If you dont want to change visibility)
Technically it does
That is what i was getting into
Event is fake anyway, it's just a hint for some backend I guess
Its for the property editor scrpting
Ah, not losing anything of value when overriding it then
Also
Validation should fail if your scripts have no tag for class names
Unless it's modding a class name
Also x2
It should fail for tag that says "TAG"
Also x3
Script errors on servers should print which mod the script is from
Thanks for coming to my ted talk
Oh also x4
Namespaces
Or something
My Class names are almost as long as java constructors now

When you need to write it three times in one line 💀 ||(one for variable type for autocomplete, one for cast and one for FindComponent or similar function)||
I don't know, I think some of it was done but that was already released as 1.3 patch. I think the current 1.4 did nothing specifically more. you have to try it out
#reforger_servers message
website guy is slackin 😄
how can I let an ai group move to an entity like a ConflictMilitaryBase (basePosition)?
I tried it like this:
AIWaypoint waypoint = AIWaypoint.Cast(GetGame().SpawnEntityPrefab(resource, null, GenerateSpawnParameters(basePosition.GetOrigin())))
group.AddWaypoint(waypoint);
that is already the right idea. perhaps your ai is not yet activated, so call activateai() on the group. then they will go there (if you used e.g. waypoint move prefab)
Also make sure to have SCR_AIWorld Entity with all Navmesh assigned in your world.
Not sure if you need it for waypoints but PerceptionManager aswell.
*If you are in a empty debug world
Thx, I will check that as well 🙂 I get null for waypoint, can I evaluate certain statements while debugging like in other IDEs? My assumption is that GenerateSpawnParameters could be the cause.
How would you properly replicate data from an array list to be fetched by a client?
I am using restapi and a callback to call a method that will populate data. It is populated on the server side of things but when I go to use it via the client it doesn't work.
[RplProp()]
ref array<string> m_PlayerData;
if (Replication.IsServer()) {
if (!m_PlayerData)
m_PlayerData= new array<string>();
}
Doing this within SCR_BaseGameMode's class.
You need to call Replication.BumpMe() each time you modify RplProp
Hi, is there any problem to do a modded class of SCR_CharacterControllerComponent and modify it like in BootCamp 10 with the custom WeaponAnimationComponent ?
I added the constructor but took the same name as the original component because it's not a custom one, then I do anim event registering, and after that, DropLiveGrenadeFromHand function.
I figured out It's working but I literally don't know if what I'm doing won't cause issues with something I couldn't spot by myself
So I am doing that (I believe), still learning the scripting...
modded class SCR_BaseGameMode {
[RplProp()]
ref array<string> m_PlayerData;
void SetPlayerData(string identityId, array<string> p_Data)
{
if (!Replication.IsServer())
return;
string dataLine = identityId + "|";
for (int i = 0; i < p_Data.Count(); i++)
{
dataLine += p_Data[i];
if (i < p_Data.Count() - 1)
dataLine += ",";
}
for (int i = 0; i < m_PlayerData.Count(); i++)
{
array<string> parts = {};
m_PlayerData[i].Split("|", parts, true);
if (parts.Count() > 0 && parts[0] == identityId)
{
m_PlayerData[i] = dataLine;
Replication.BumpMe();
return;
}
}
m_PlayerData.Insert(dataLine);
Replication.BumpMe();
}
// This will be used client side.
array<string> GetDataFromPlayer(string identityId)
{
if (!m_PlayerData)
{
Print("[DEBUG] m_PlayerData is definintely null.");
return {};
}
foreach (string entry : m_PlayerData)
{
array<string> parts = {};
entry.Split("|", parts, true);
if (parts.Count() == 2 && parts[0] == identityId)
{
array<string> p_Data = {};
parts[1].Split(",", p_Data, true);
return p_Data;
}
}
return {};
}
override void OnGameStart() {
super.OnGameStart();
if (!Replication.IsServer())
return;
if (!m_PlayerData)
m_PlayerData = new array<string>();
}
override void OnPlayerAuditSuccess(int iPlayerID) {
super.OnPlayerAuditSuccess(iPlayerID);
PrintFormat("MB_Utils | Player (%1) connected. Caching data...", iPlayerID);
MB_Utils.GetPlayerData(iPlayerID);
}
override void OnPlayerDisconnected(int playerId, KickCauseCode cause, int timeout) {
super.OnPlayerDisconnected(playerId, cause, timeout);
PrintFormat("MB_Utils | Player (%1) disconnected. Removing cached data...", playerId);
MB_Utils.RemovePlayerFromCache(MB_Utils.GetPlayerIdentityId(playerId));
}
}
Then my callback will call this:
array<string> p_Data = MB_Utils.GetPlayerData(playerIdentityId);
SCR_BaseGameMode gameMode = SCR_BaseGameMode.Cast(GetGame().GetGameMode());
if (gameMode && p_Data && p_Data.Count() > 0)
{
gameMode.SetPlayerData(playerIdentityId, p_Data);
}
But not seeing the data on the client at all. Appreciate any help! 😄
your data may not be replicated yet
That's what I am thinking as well.. any recommendations on timing it for use?
Depends on you architecture, but you can use onRplName in RplProp to call class method when it's replicated to client
I am pulling data from a backend and trying to have it replicated on the client's end. Server side is perfect.
btw, why are you replicating entire array? you can use RplRpc granularly for sending data to specific client using it's player controller
Not sure what the best use case for this would be but some of the data includes custom user roles and statistical data. I originally had a map but I learned they cannot be replicated to client.
Just create your own class, define encoder/decoder for it (https://community.bistudio.com/wiki/Arma_Reforger:Multiplayer_Scripting#Network_Modding) and send it in player controller or component on it by calling Rpc
On server side when controller/component is created retrieve info and send it in Rpc
on client side in function save this data and now you can work
I don't see the need to replicate an entire array to every player when the player controller could just store the data for its player.
I mean, unless players actually need to know the data of the other players.
Highly doubtful though.
anyone know what script prevents moving inventory items while under water?
been searching and cant find anything obvious
Hey, is there a smart method to get all spawned Characters with a specified faction in the world?
Player and A.I. characters?
Hi Atim, only AI
Hi, 🙂
Well i use:
array<AIAgent> agents = {};
SCR_AIWorld aiWorld = SCR_AIWorld.Cast(GetGame().GetAIWorld());
aiWorld.GetAIAgents(agents);
which will give you all A.I. agents.
and then you have to sort them by faction like:
string factionKey;
IEntity agentEntity;
SCR_ChimeraCharacter chimeraCharacter;
foreach (AIAgent agent : agents)
{
if (agent)
{
agentEntity = agent.GetControlledEntity();
if (agentEntity)
{
chimeraCharacter = SCR_ChimeraCharacter.Cast(agentEntity);
if (chimeraCharacter)
{
string factionKey = chimeraCharacter.GetFactionKey();
if (factionKey == "US")
Print("Do US Stuff");
if (factionKey == "USSR")
Print("Do USSR Stuff");
}
}
}
}
May you would need/like to put them in faction arrays.
So far the only way i'm aware of to get it sorted like this.
Thanks mate
@pseudo merlin the array also contents Groups?
SCRIPT : AIAgent agent = <0x000002003513D5C0> SCR_AIGroup
SCRIPT : AIAgent agent = <0x000001FFB3642230> SCR_ChimeraAIAgent
SCRIPT : AIAgent agent = <0x000001FFB72BEBB0> ChimeraAIAgent
SCRIPT : AIAgent agent = <0x000001FFB3642430> SCR_ChimeraAIAgent
SCRIPT : AIAgent agent = <0x000001FFB3642630> SCR_ChimeraAIAgent
Do you know if i need to check all members from such groups also?
Oh yeah no you don't.
Yes AIGroup and AIAnimal does inherit from AIAgent as well.
So you may need a cast check like:
if (agent.IsInherited(AIGroup) || agent.IsInherited(AIAnimal))
continue;
Right after the if (agent) condition of the foreach loop.
@serene fox
I think this is how it's supposed to work with the IsInherited() methode.
is there a way to get multiple entities by type ("prefab?") instead of name?
GetGame().GetWorld().FindEntityByName("Base_1"); for instance I want to get all ConflictMilitaryBases
- Create your component and add it to
{37578B1666981FCE}Prefabs/Characters/Core/Character_Base.et. - Create your system and add it to
{86E953538A28A98D}Configs/Systems/ChimeraSystemsConfig.conf - In your component:
- check for
FactionAffiliationComponenton owner - check for player presence in
SCR_CharacterControllerComponenton owner and add event handler tom_OnControlledByPlayer - if all conditions meet call function on your system which will save component's entity to array or even map with faction key
Thanks, but working fine with aiWorld.GetAIAgents(agents);
I just don't like methods like "iterate over everything and add 9000 ifs"
Why can e.g CallLater(func fn..) use func as argument but I cant?
func arguments are not supported in script methods
Because they are engine-based methods. You can't do it in pure enforce script atm.
Same as methods that accept arguments of type void.
Not allowed, sowwy
Is there an easy way to always make an entity upright? in terms of pitch and roll angles, I only want it to be able to rotate around the yaw axis
I made a script for removing sand bags how do I actually add it to the editor
When do you want to execute it? When the game starts?
Wait do you want to delete existing sandbags from the map when the game starts or just prevent players from placing them?
Prevent people from placing
The placeable prefabs for the building mode are registered in EditorModeBuilding.et on the SCR_CampaignBuildingPlacingEditorComponent. So try to replace it with your own custom whitelist of placeable objects.
I’ll try that
Actually a better place is Compositions_FreeRoamBuilding.conf. Also after you created the override, you can use right click to open the context menu to clear the array in your override:
Is there a helper function that will delete all null values from array?
I don't think so
Okie
A RemoveAll (and RemoveAllOrdered) method could be useful, even though it's trivial to implement yourself
Right
does Remove(null) work?
No, it's RemoveItem(null) 😉
Seems like PointInfo's GetWorldTransform does not actually return world transform
Aha I have to call Init I guess
This sounds familiar
Yeah this is the correct answer, I did not consider that RemoveItem removes all occurrences and not just one
More or less I am storing a custom leveling system for the player that can be seen by all players in the server. (e.g. [LVL 1] PLAYER NAME) then eventually the playerData will be used for more statistical data such as kills, deaths, time played, etc. that can be pulled by players in-game.
Would you still recommend this approach if I am trying to achieve the above?
yes, and also - don't send stats that the player doesn't see 24/7 on the screen until the player opens the stats screen. For constantly visible statistics, you can use the component on game mode or on the character itself. And don't send entire array, only changes.
Is my system with frame point lying about time delta or am I tripping? I have a simple float for a timer and 15 seconds elapse in 5
I think I'm going crazy
Okay I was using GetFixedTimeSlice instead of GetTimeSlice
Whew
Not crazy
Any way to force stream out an entity?
Not sure if it work but: RplComponent.EnableStreamingConNode(rplIdentity, enable)
I tried that but I think that just enables streaming in general
mb need to disable spatial relevancy first



