#enfusion_scripting
1 messages · Page 9 of 1
i am down a rabbit hole at this point lol. how do you send a global message in-game chat
so each Player controller has a component named SCR_ChatComp, you can use it quite easily use it to display messages on a single clients on or all clients. Here is a quick example that you can use
void MyServerRanMethod()
{
[...]
Rpc(RpcDo_BroadCastMessageInChat, "Welcome to my kinda cool game mode");
[...]
}
[RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
void RpcDo_BroadCastMessageInChat(string message)
{
PlayerController playerController = GetGame().GetPlayerController(); // There are multiple way to get the player's playercontroller, this is used when running client sided code.
if(!playerController){return;}
SCR_ChatComponent chatComp = SCR_ChatComponent.Cast(playerController.FindComponent(SCR_ChatComponent)); // Getthe chat component
if (!chatComp){return;}
chatComp.ShowMessage(message);
}
hmm and what about this?
found it in 'BaseChatComponent Interface Reference' and i was fixated on the idea that once i get an instance of the class i can use the function to send a chat message.
Does anyone know how to remove the WCS primary and launcher configuration to carry 2 primaries?
No, you misunderstand the purpose of this method. It displays a message for the given channel on the local client.
I’m unsure, this is a random guess but it might be to send a message as the client??
All i know is that the showmessage works great
I am still a bit confused. I am basically trying to send a message in global chat to everyone irrelevant of their faction.
For example, "player joined server" "player left server"
I thnk the game already does that, it says "bad2chad joined the fight" when a player joins..
Now if for some reasons you want to do it then you can do it this way using a gamemode component.
// (the RpcDo_BroadCastMessageInChat method is the same as before)
override void OnPlayerConnected(int playerId)
{
Rpc(RpcDo_BroadCastMessageInChat, "yourMessage");
}
i would able to help a bit better if you have an actual snippet of code.
@rotund kraken
override void OnPlayerConnected(int playerId)
{
ProcessConnection(playerId);
string name = GetGame().GetPlayerManager().GetPlayerName(playerId);
Rpc(RpcDo_BroadCastMessageInChat, "Welcome " + name);
}
Also keep in mind that broadcasting sends a message to every client BUT the server. and the version running inside of the workbench is running as both the server and a client, therefore he will not receive any broadcast call.
To test it out properly you will need to either also call the function on the server side or use a peertool client.
thanks @red cedar . i dont have much in terms of code, i am still trying to wrap my head around the docs and how things work.
modded class SCR_BaseGameMode {
override event protected void OnPlayerConnected(int playerId) {
super.OnPlayerConnected(playerId);
string playerName = GetGame().GetPlayerManager().GetPlayerName(playerId);
string message = playerName + " joined the server";
Print("printwhatever i want here")
}
}
So basically i was just printing that a player connected to ensure it worked. then it occured to me that i want to send this in global chat (even though it has no real usecase, but for learning purpose).
are you running a peertool client ?
i dont know what that is, i am googling
Ok, well peertool allows you to run multiple instances of the game, and currently it's the only way i know to properly test network interactions.
so as I said the broadcast do not send the call to the server version, and since you're only running the game with the enfusion instance of the game you ARE the server.
So what you can do is that
modded class SCR_BaseGameMode {
override event protected void OnPlayerConnected(int playerId) {
super.OnPlayerConnected(playerId);
string playerName = GetGame().GetPlayerManager().GetPlayerName(playerId);
string message = playerName + " joined the server";
Rpc(RpcDo_BroadCastMessageInChat, message); // Display the message to all clients.
RpcDo_BroadCastMessageInChat(message); // Display the message to the server only
Print("printwhatever i want here")
}
}
[RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
void RpcDo_BroadCastMessageInChat(string message)
{
PlayerController playerController = GetGame().GetPlayerController(); // There are multiple way to get the player's playercontroller, this is used when running client sided code.
if(!playerController){return;}
SCR_ChatComponent chatComp = SCR_ChatComponent.Cast(playerController.FindComponent(SCR_ChatComponent)); // Getthe chat component
if (!chatComp){return;}
chatComp.ShowMessage(message);
}
thanks mate. ill give that a go.
Sorry but i need help to understand some basic conzept i guess:
I have something that's giving me a headache, specifically the GetOnPlayerKilled() method from the SCR_BaseGameMode class. This method returns the ScriptInvoker for onPlayerKilled. However, when I search through everything, I see that inPlayerKilled is never invoked; instead, new functions are only inserted or removed.
Are there certain invokers that are constantly being checked, like in an update loop, i found the declaration of the "OnPlayerKilled" Methode in the BaseGameMode class, there its declared as an event, i guess all events are processed hidden in the engine? Or where exactly is the "player dies" event triggered? Where does the invoker get the necessary parameters from?
In the examples, it's always structured with a subscriber and an holder, but then the event is explicitly triggered through a method using .Invoke.
this is invoked in SCR_BaseGameMode::OnPlayerKilled, line 1049 in SCR_BaseGameMode.c
yes but where is the function called in the first place
in my mind is that i have to Call OnPlayerKilled
OnPlayerKilled itself is called from c++ by the game
event methods are usually stubs (think of it like a forward declaration in C/C++), and that keyword hints you that you can override this to react to something, and that it will be called from c++
So the Enfusion engine handles these calls for me, and everything happens automatically in the background? I can modify the logic of what happens when the event is triggered. Does the engine also provide the required parameters?
and your mixing two things here, the ScriptInvoker m_OnPlayerKilled has nothing to do itself with the event. conceptually this is a layer above the event thing. look at BaseGameMode.c (which is the parent) vs SCR_BaseGameMode (which is an "overlay" on top)
basically yes. look into BaseGameMode, all of that is happening on the game side, and all the arguments to these calls will be supplied by the game
ok thank you, i was wondering where the paramters etc. are getting provided but when the engine itself does it then you helped me a lot to understand it
no worries, glad to help
do we have a working vscode integration yet with autocomplete or nah
not being able to collapse code blocks is killing me
weird that this isnt a thing considering the editor knows where the brackets are and even highlights them
How to check if a player (the current) is a leader of a squad? (preferably returning a bool)
The only one i’ve tried were really bad, basically only offering coloring of the text.
You could not have auto completion of other files and even less from vanilla methods etc
Yeah same
if (!Replication.FindItem(jammerId))
continue;
IEntity jammer = RplComponent.Cast(Replication.FindItem(jammerId)).GetEntity();
if (!jammer)
continue;
SAL_DroneJammerComponent jammerComp = SAL_DroneJammerComponent.Cast(jammer.FindComponent(SAL_DroneJammerComponent));
float maxRange = jammerComp.m_fJammingRange;
Any ideas on why only in a dedicated server the client cant find that jammerComp
He finds the jammer just find but the component just can't be found only on a dedicated server
class SAL_DroneJammerComponentClass: ScriptComponentClass
{
}
class SAL_DroneJammerComponent: ScriptComponent
{
[Attribute("300")] float m_fJammingRange;
override void OnPostInit(IEntity owner)
{
SetEventMask(owner, EntityEvent.INIT);
}
override void EOnInit(IEntity owner)
{
#ifdef WORKBENCH
GetGame().GetCallqueue().CallLater(RegisterJammer, 100, false, owner);
#else
if (RplSession.Mode() != RplMode.Dedicated)
return;
GetGame().GetCallqueue().CallLater(RegisterJammer, 100, false, owner);
#endif
}
void RegisterJammer(IEntity owner)
{
SAL_DroneConnectionManager.GetInstance().RegisterJammer(RplComponent.Cast(owner.FindComponent(RplComponent)).Id());
}
void ~SAL_DroneJammerComponent()
{
#ifdef WORKBENCH
if (!GetGame().GetWorld())
return;
if(SAL_DroneConnectionManager.GetInstance())
SAL_DroneConnectionManager.GetInstance().UnregisterJammer(RplComponent.Cast(GetOwner().FindComponent(RplComponent)).Id());
#else
if (RplSession.Mode() != RplMode.Dedicated)
return;
if (!GetGame().GetWorld())
return;
if(SAL_DroneConnectionManager.GetInstance())
SAL_DroneConnectionManager.GetInstance().UnregisterJammer(RplComponent.Cast(GetOwner().FindComponent(RplComponent)).Id());
#endif
}
}
Said jammer component
Logs produce this so I am so confused
IEntity jammer = GenericEntity<0x0000020883268140> @"ENTITY:4611686018427387955" ('GenericEntity','Assets/Items/Equipment/Backpacks/Backpack_ALICE_Medium/Backpack_ALICE_Medium_item.xob') at <243.186005 1.000000 71.942001> @"{06B68C58B72EAAC6}Prefabs/Items/Equipment/Backpacks/Backpack_ALICE_Medium.et"
16:46:58.384 SCRIPT : SAL_DroneJammerComponent jammerComp = NULL
logs from client?
yeah
you code just work only on dedicated
It's just pulling the attribute
The registration of the bag is handled in the gamemode and that is working
Added that line sorry
The server has nothing as this is only ran on the client
Its a default alice bag
client may not have your entity
because server is not streaming it to him
how did you add your component to entity?
Restarted the workbench
Magically fixed
Enfusion is an enigma
but still it's better to do this in prefab rather in world
Yeah ofc its just for testing
This is really good https://marketplace.visualstudio.com/items?itemName=yuval.enfusion-script
BUT doesnt work with reforger flavor of the language
I’ll go ahead and give that a try thanks
How can you "connect" VSCode with all the default arma reforger scripts?
I'm not even sure that the question is correct 🥲
What are all the allowed characters in class names?
Hey everyone, I’m wondering if anyone here can help me with my scripting problem ?
The scripts themselves are compiling with no errors.
How ever iv tried everything to get them to print out messages in the console saying there working ingame etc
Is someone able to dm me to help me through troubleshooting - been stuck on it for the past 5 hours trying everything
Anyone on that can help ?
Identifiers (class name, variable name, etc) must start with _ or a-zA-Z and be followed by [a-zA-Z0-9_]*.
[HELP] Script Troubleshooting
Hello, guys.
Does anyone have a script for deleting children objects in a nested Prefab, when such prefab gets destroyed?
I have been packing some vanilla vehicles up with a bunch of "attachments" (as I used to do in Arma 3) and, although they are working relatively fine, when the Parent entity gets destroyed all the nested objects remain there. Cannot even delete them via GM.
Searching both the internet and here in Discord, I have understood that such features can only be performed by scripting, as there it seems to be no specific "Component" for such in "Edit Prefab -> Object Properties".
And I did set "response Index = No Collision" in "RigidBody" Component - otherwise, touching entities will launch airborne -, but even whether I turn them back on, will not get destroyed.
Please note that I have NOT tested them anywhere outside the Workbench yet, so do no not know how are they performing MP or even in-game editor.
are they actually part of the prefab hierarchy? do all of the entities in it have a hierarchy component on them? if not the "children" will no longer be associated with the parent after spawning. easy to tell by picking up the parent or moving it somewhere. attachments would not follow them then beyond the inital spawn position
Yes, they do 👍 .
I noticed before that several (most ) of objects under "Props" folder will not act under hierarchy. So I have just notice that missing "Hierarchy" component only a few hours ago.
Regardless, I have been using objects from "Prefab->Structures", avoiding "Props", so all current children naturally come with hierarchy, and always move together when I GM move the parent.
man i may be new to scripting but holy hell its like learning a new lang understanding the slang ahha
How can i get the children of this prefab? When i do this nothing is printed?
IEntity child = obj.GetChildren();
while (child)
{
Print("Gray.child = " + child);
child = child.GetSibling();
}
entities don't add themself to hierarchy automatically without Hierarchy component
You could create a blacklist of entities/projectiles e.x "{E789B29FBBlaBla}Prefabs/Some/Thing.et" and let the zone delete the entity from the server on collision. Should be performance friendly but you would need to do some handwork .. for that you've more control over projectiles that dont inherit from the base classes.
You could also just check for base class .. and if something is still passing the trigger zone .. you would need to destruct the entity and check for its projectile type and keep adding those into account afterwards
already solved it ^^ Tho it doesn't work for 20mm and 30mm cannons
also, hello. been quite a bit since i talked to you @toxic bear
Hey Kitty .. ye but you know .. I watch here and there still .. out of the bush
.
You do great btw
Well .. I am banned

mind dming ?
Hey everyone, is there any videos online that talk about adding scripts to prefabs ? Like already made structures etc ?
Help merging a mod from workshop to my world
would someone be able to jump in call with me and help me test my scripts out, im not understanding ai spawning at all
Ive run into something with the SCR_JsonLoadContext.
I'm trying to load my Json to an object with optional entries, if they aren't present they should take on the class default value.
So I made a test using both the automatic serialization way and manually using SerializationLoad(...), and encounter two different behaviors.
What I notice is the auto behavior instantiates an appropriate instance but never actually sets the member it was instantiated for (this is true even for the root level ctx.ReadValue("", testAuto);, where testAuto MUST be instantiated). However, the manual SerializationLoad behavior will instantiate and set the member. This makes it impossible to use nested classes or arrays where objects are missing fields using the automatic way, and theres a big disconnect between the way the two ways process data.
JSON
{
"param1": "something",
"param2": 42,
"child": {
"param1": "somethingChild"
}
}
Results
SCRIPT : Auto Constructor TestJsonAuto<0x000001AD9B7A8970>
SCRIPT : Manual Constructor TestJsonManual<0x000001AD9B7A8930>
SCRIPT : -- Auto --
SCRIPT : Auto Constructor TestJsonAuto<0x000001AD9B7A88F0>
SCRIPT : TestJsonAuto testAuto = TestJsonAuto<0x000001AD9B7A8970>
SCRIPT : string param1 = 'something'
SCRIPT : int param2 = 42
SCRIPT : TestJsonAuto child = NULL
SCRIPT : -- Manual --
SCRIPT : Manual Constructor TestJsonManual<0x000001AD9B7A88F0>
SCRIPT : TestJsonManual testManual = TestJsonManual<0x000001AD9B7A8930>
SCRIPT : string param1 = 'something'
SCRIPT : int param2 = 42
SCRIPT : TestJsonManual child = TestJsonManual<0x000001AD9B7A88F0>
SCRIPT : string param1 = 'somethingChild'
SCRIPT : int param2 = -2
Test Code
class TestJsonAuto : Managed
{
string param1 = "default in class";
int param2 = -2;
ref TestJsonAuto child;
void TestJsonAuto()
{
Print("Auto Constructor " + this);
}
}
class TestJsonManual: Managed
{
string param1 = "default in class";
int param2 = -2;
ref TestJsonManual child;
void TestJsonManual()
{
Print("Manual Constructor " + this);
}
bool SerializationLoad(BaseSerializationLoadContext context)
{
if (!context.IsValid())
return false;
context.ReadValue("param1", param1);
context.ReadValue("param2", param2);
context.ReadValue("child", child);
return true;
}
}
void Test1()
{
TestJsonAuto testAuto(); // ONLY WORKS IF ITS ALREADY INSTANTIATED. ReadValue returns false.
TestJsonManual testManual(); // WORKS EVEN IF ITS JUST A DECLARATION. i.e. `TestJsonManual testManual;`
SCR_JsonLoadContext ctx;
// Auto
ctx = new SCR_JsonLoadContext();
ctx.LoadFromFile("$profile:testOpt.json");
Print(" -- Auto -- ");
ctx.ReadValue("", testAuto);
Print(testAuto);
if(testAuto)
{
Print(testAuto.param1);
Print(testAuto.param2);
Print(testAuto.child);
if(testAuto.child)
{
Print(testAuto.child.param1);
Print(testAuto.child.param2);
}
}
// Manual
ctx = new SCR_JsonLoadContext();
ctx.LoadFromFile("$profile:testOpt.json");
Print(" -- Manual -- ");
ctx.ReadValue("", testManual);
Print(testManual);
if(testManual)
{
Print(testManual.param1);
Print(testManual.param2);
Print(testManual.child);
if(testManual.child)
{
Print(testManual.child.param1);
Print(testManual.child.param2);
}
}
}
@torn bane ^ I'll tag you to the above since I saw you talking about the serialization and can see alot more about it than I can.
Also, while writing to SCR_JsonSaveContext() we can use StartObject(string name) and EndObject(), but that does not exist for Arrays, which is an inconvenience if we don't have to /want to use WriteValue("name", arr) of an array of a complex type.
E.g. it would be nice to have
ctx.StartArray("arr");
ctx.StartObject(); // No name parameter because it does not need a key. Currently not a thing as we need a name. Using empty will give it a key of "":
ctx.WriteValue("param", 42);
ctx.EndObject();
ctx.EndArray();
->
{
"arr": [
{
"param": 42
}
]
}
Because you do not write arrays manually, you pass the whole array and we will write it. In what case do you have an array that you need to manually handle each element of?
This is going to sound idiotic. But I've made a BaseContainer to/from JSON and thats the missing link to do Object Arrays. Every other serialization container except for json has some sort of startmap or startarray.
I can do it with another Json container and then ToString it into a string array but then it escapes everything inside.
the serialization container has them too but they are not exposed, because manual handling for them usually is much slower. the context can handle all data types. if your input data does not exactly match what you actually want to write you should put it into a temporary variable and pass that into serialization.
i am testing your other scenario now and see whats up there. you expect on auto read to get a child instance with just one property set and the rest defaults yes?
Btw in a future update we have a lot of utlity for handling default properties so json only contains fields it needs. no "bool": false, for example. because false is implict
Yes, and it seems that its doing that, but auto read finds that there is a child, instantiates it, but doesnt set the child to reference the object it created.
And auto read will do the same situation with testAuto
But manual read will instantiate and set
Yeah thats exactly what I'm trying to achieve but on the read end.
yeah i think it should. might be a bug, and it might already be fixed. we did a lot of work on this whole thing over the path months and it should hopefully be included in one of the next major updates. you might be happy to hear that you can also then create scripted containers for any custom formats. you could even emulate base container format read and write with it
then you do not need to achieve it. it will ship in vanilla soon enough
nope also auto support you can configue globally for context or per variable with attributes etc
our save-games use this now and there we want the minimal amount of data to be written only
Output on our current dev build:
SCRIPT : Auto Constructor TestJsonAuto<0x000002058CAC83B0>
SCRIPT : Manual Constructor TestJsonManual<0x000002058CAC84B0>
SCRIPT : -- Auto --
SCRIPT : Auto Constructor TestJsonAuto<0x000002058CAC8530>
SCRIPT : TestJsonAuto testAuto = TestJsonAuto<0x000002058CAC83B0>
SCRIPT : string param1 = 'something'
SCRIPT : int param2 = 42
SCRIPT : TestJsonAuto child = TestJsonAuto<0x000002058CAC8530>
SCRIPT : string param1 = 'somethingChild'
SCRIPT : int param2 = -2
SCRIPT : -- Manual --
SCRIPT : Manual Constructor TestJsonManual<0x000002058CAC85F0>
SCRIPT : TestJsonManual testManual = TestJsonManual<0x000002058CAC84B0>
SCRIPT : string param1 = 'something'
SCRIPT : int param2 = 42
SCRIPT : TestJsonManual child = TestJsonManual<0x000002058CAC85F0>
SCRIPT : string param1 = 'somethingChild'
SCRIPT : int param2 = -2
SCRIPT : ScriptDebugger: remote script executed successfully.
Ahh so its fixed
seems like it was already fixed
neat ok. well then you probably need to wait for the update or do manual loading until then. i am not exactly sure what caused it for you, but honestly I lack the time to work on the older version to see if there is another workaround - not if you have "some way" to do it manually until then
I have a way... but it involves me generating the code for context.ReadValue (in SerializationLoad) for every variable in the type and then compiling that into a ScriptModule and invoking it. It works but...
If you have a struct and do ReadValue("", myClassInstance) it will read the whole json (root) into the instance
Note I am probably missing a lot of context
Yes
Ur welcome
It stops working during server runtime because it shares max buffer usage with all interactions with it
It stops working without you even interacting with it, on busy servers
json api struct is only meant for fixed payloads sent via http. nothing else. if it would be possible i would hide this class from modders
@torn bane 😆
bool SerializationLoad(BaseSerializationLoadContext context)
{
if (!context.IsValid())
return false;
typename type = this.Type();
string script = string.Format("void Load(BaseSerializationLoadContext context, %1 inst) {\n", type.ToString());
for(int i = 0; i < type.GetVariableCount(); i++)
{
string varName = type.GetVariableName(i);
script += string.Format("context.ReadValue(\"%1\", inst.%1);", varName);
}
script += "}";
string err;
int errLine;
ScriptModule module = ScriptModule.CompileScript(GetGame().GetScriptModule(), script, err, errLine);
if(!module)
{
PrintFormat("Err: [%1] %2", errLine, err);
return false;
}
module.Call(null, "Load", false, null, context, this);
return true;
}
Wait is your issue just nested types? For me the only way (without going to extreme lengths) to exchange that data as json was to use type discriminators
It makes the json a bit ugly tho
If you use auto serialization with an object somewhere in the hierarchy that is null, even if the json deserializer finds it, it will stay null. This includes the top level object.
Fixed in an upcoming version but not right now.
It's a bug, because it creates the instance, but doesn't set it so it stays null.
OMEGALUL, I did not know we already added compile from script. I had to do ugly compile from temporary file stuff in the past. This opens the door to so much things the script programmer will hate me for. Excellent. This together with some more reflection utilities can make dynamic framework coding so cool
I've been working on a lot of dynamic stuff thats magical
there is no pretty way for mixed type arrays. it is the same if you do it in other languages like c#. it adds it too 🙂
The biggest problem however is that the dynamic compiled/LoadScript ScriptModules have a static heap limit of 262kb that can't be increased
make more modules then 🧠
I made a whole thing to do that
Then the issue becomes the modules have to be hierarchical if they use each other so it's a lil annoying
I'd like to see more love to ScriptModule stuff, user made decorators and component children insertions during runtime.
I saw how you did the database framework decorators it was pretty funny.
yeah it was super hacky XD. i liked how in c# i could link frameworks easily by reflection on the assembly or using attributes. so i tried to mimic that. in enfusion script its not as exactly as nice, but there are other ways.
dynamically inserting componenets and stuff will not be a thing. neither is removing. both "work" but there are sooo so many issues associated with it. iit will often not be worth doing
It'd also be nice to be able to use our own void params that we could pass to underlying void params that go to the engine. E.g. a custom MyPrintFormat that I can use strong.format to get a string out of and print to a custom log file and then run PrintFormat
I got very very close by messing with the Base containers but gave up
ehhhh void params and casting them back will prooobably not be a thing. not for script -> script calls. it serves no purpose and the compiler is already fragile enough. we are only ever adding things we need for a purpose
It's a bit painful for certain things since we don't have pointers
E.g. out voids
Hence why I had to do the script generation approach
Ok one last thing then... What about function level templates?
time will tell. so far no plans
Not being able to pass functions as parameters is such a downgrade
ScriptModule.Call not being aware of the inherited class type it's being called against is a bit weird
in dayz we added a callable wrapper which i can and probably will port. but i am looking for ways to just allow func keyword for script usage too, especially since we commonly established signature delcarations for e.g. strong typed script invokers. We will see
minimal example of what you expecrt please with a repro as feedback ticket and send me the link. i will check and see if i can offer a patch to enfusion for it
does anyone know if the Play Area Boundary entity culls water animations outside its boundary ?
Hello i am creating a mod and the last step i need and i don't find clear documentation about it is a way to assign an action and a keybing in settings of arma reforger (for it to work on keyboard, controller etc.). If someone have a doc or a mod exemple doing this pls ! thx 😄
best way currently to figure it out is to look at a simple mod that already does it, as far as documentation good luck. As for working with it in general also good luck, probably the most difficult buggiest thing to do, my hatred for it knows no bounds 
2 main configs to pay attention to is chimeraInputCommon.conf & keyBindingMenu.conf and* for having keys displayed on the screen then there is also AvailableActions.conf
ye man fr im trying to do thing with documentation actually, I feel like I'm going back to my development years in school, reading C manuals.
Lol I wish this game was documented as good as C manuals
ok thx i figured about chimeraInputCommon.conf and keyBindingMenu.conf but thx for AvailableActions.conf
Documentation aside the key input system is so infuriating to work with. One minute you'll have to working the next it doesn't work at all, constantly having to restart workbench etc. And if something screws up in those configs the entire game goes whacky.
Last time I fiddled with it I spent 2 hours trying to get one keybind to work and I was duplicating from a working set I already did. 
my mod is a stats hud thing, i think if i dont figure out to do it today i will try to only catch event of ingame exit menu to display it i think its easier
the good thing about C/C++ docs is that it is formal, the bad thing about C/C++ docs is that it is formal. the worst thing is: once you get used to how precise and non-ambiguous it is, you will die internally each time you have to work with any other tech (which doesn't have it)
Pretty much ^ After so long though a lot of things blend together and it's easy to pick up but then I look at this.. It was easier for me to reverse engineer a games input system and hook into it then it was to figure this one out 
there are lots of weird/non-intuitive design decisions in ENF/AR, though over time, once you get well versed, much of it starts to make sense.
what baffles me is the absolute lac of docs or even some high-level overview materials that would explain the design concepts, not even actual implementation of the systems. and I'm not buying the "AR is just a testbed before A4" argumentation, because how do you even onboard new devs to the project? here is your keyboard, here is the SVN url, and here is your task list, good luck.? 🤨
Hi, if i like to predefine such Bounds for a character, what should the vectors looks like?
vector mins, maxs;
entity.GetBounds(mins, maxs);
from experience working on my mechs, the bounds remain the same regardless of what buttons I press
Does someone know the best way to use persistant data on server side ? like a little text file i can write/read/create with FileIO ? or i need to use an external api and use http:post/get request
i guess it depends on what kind of data you're trying to store.
If it's user progression / user related data then have an API.
Now if it's to store server config(such as an API endpoint, etc) then absolutely do save that to a file(never expose an endpoint in your code. unless you want everyone to run request on it.. and even then, there are better ways)
also, related but kind of unrelated question. Saving to a file doesn't work on console right ?
idk im starting modding on arma reforger thing
its a pain
ok thx i will definitly do that, env for endpoint and api for user data 😄
This question wasn’t necessarily aimed towards you. I have some data saved in files for a gamemode i’ve been working on. But heard consoles can’t save files so…
respawn timer should be set on controllable destroyed event or earlier rather than player killed event in BI core code. even on LAN (peer tool) client, there is too much net delay, including on initial spawn, so timer can be bypassed
Is there a way to determine which mod a prefab is from?
Can anyone lend me a helping hand? I know some java + a few other languages, so i generally understand how to actually code things. I was also scripting alot for arma 3 missions. But im feeling like a complete noob trying to figure out how to get a simple f'ing hello world script/mod running for arma reforger...
I wanted to make a "Hardcore mod" which essentially bans players for 12 hours if they die. Can some1 help me with this?
First thing i tried ofc was to make a hello world test, but i cant seem to get it working... I made a script but it just didnt send the message when i tested it...
... A step by step tutorial would be so much appreciated
I'm an Enfusion noob too, so take my advice with grain of salt, but here are some possibly useful links:
- https://community.bistudio.com/wiki/Category:Arma_Reforger/Modding
- https://www.youtube.com/playlist?list=PLfUcrRpCM_fKjkTrkV-bqnknVbFCPA3YU
Also you might want to learn how ECS (Entity Component System) works, here's one explanation: https://www.richardlord.net/blog/ecs/why-use-an-entity-framework.html
And replication too, it's explained both on the wiki and there are two recordings about it (basics + advanced usage) in the Modding Bootcamp in YouTube
I’ll say that randomly and without checking if it’s actually correct but isn’t the first part of the resourcename the id of the mod it’s from?
No, that's the GUID of the prefab
Oh :(
i looked through alot of tutorials already. a few seemed useful but at the end it was always useless bcs there were so much stuff in it that i just dont need, i literally only need a few lines of code to work and make people get banned once they die
couldnt find anything helpful in that regard
Look into the playermanager
Yeah, I guess Enfusion is different from the Real Virtuality engine of the previous Armas. Making super simple scripts is probably harder in Enfusion, but when the size and complexity of the project grows, you should start to see increasing benefits of the new modding tools (again correct me if I'm totally wrong here lol)
It has functions to kick/disconnect user with an enum you set to « ban » and a duration(-1 for perm, until server restarts i assume)
I mean yea, once i get into it it will be ALOT better for sure. but the barrier of entry is just so huge, i dont even know where to start...
i dont wanna learn the whole engine just to make a few simple scripts :/
And how do i find it? or how do i use it, like i said, i cant even get a hello world script going, i dont even know if the script i made even loaded on testing, im literally a complete noob. thats why a step by step "tutorial" would be perfect for me, thats how i usually learn the basics the best
I’m not on my pc so i cannot really help you… but basically in your death event you run
PlayerManager pm = GetGame.GetPlayerManager();
And then you ctrl+click on the PlayerManager class name. This will open the playermanager class and you’ll be able to find the method you’re looking.
You will be able to call it by writing something like(this example will not work)
pm.DisconnectUser(playerId, EDisconnectReason.Ban, -1);
You will learn most of the code by looking at how the vanilla game does something and replicating it.
:/
I got this so far:
HardcoreBanManager.c
class BanManager
{
static ref map<string, int> bans = new map<string, int>();
static void Ban(string playerId, int durationSeconds)
{
bans[playerId] = System.GetUnixTime() + durationSeconds;
Print("Player " + playerId + " banned for " + durationSeconds + " seconds.");
GetGame().DisconnectPlayer(playerId);
}
static bool IsBanned(string playerId)
{
int currentTime = System.GetUnixTime();
if (!bans.Contains(playerId))
return false;
if (bans[playerId] > currentTime)
return true;
// Ban abgelaufen
bans.Remove(playerId);
return false;
}
}
HardcoreDeathHandler.c:
modded class SCR_CharacterControllerComponent
{
override void OnKilled(IEntity killer)
{
super.OnKilled(killer);
SCR_PlayerController pc = SCR_PlayerController.Cast(GetOwner());
if (!pc)
return;
string uid = pc.GetPlayerId();
if (uid != "")
{
GetGame().GetCallqueue().CallLater(BanManager.Ban, 1000, false, uid, 43200); // 43200 Sekunden = 12 Stunden
}
}
}
HardcoreJoinCheck.c:
modded class SCR_GameModeBase
{
override void OnPlayerConnected(int playerId)
{
super.OnPlayerConnected(playerId);
string uid = GetGame().GetBackendApi().GetPlayerIdentity(playerId);
if (BanManager.IsBanned(uid))
{
Print("Banned player tried to join: " + uid);
GetGame().DisconnectPlayer(uid);
}
}
}
thats what i got after googling and watching videos for the whole day. but in the end it just doesnt do anything
How can I get all .et files from multi lists in .conf files then copy them to a new randomly generated loot spawner items config?
@torn bane hey, was wondering if i can pick your brain again on something.
Im using the map everon map but only using quarter of it and im wanting to increase the performance when hosting the server by stopping the animations for the rest of the map not being used? ie: trees mainly
is there a possible way to do this or is it a lost cause ?
this should work to grab all .et file names and then export that results to chatgpt or something and get it to find what you need
can anyone confirm this?
I don't think stopping tree animations would help server performance
well everon has 1.4 million entities. if im only using from monti up to airfield as the map then why wouldnt i want to freeze everything below that.
but ya i guess theres nothing out there that can work like that
Afaik stuff like tree and water animations are done clientside, they are just timed based on the most recent timeslice processed by server to synchronise them. I could be wrong there and maybe server is animating and replicating each tree individually but that would be kinda crazy
yeah true. idk im at a lose cause i dont wanna create my own map, i just wanna plug my scripts into everon lol
Generally speaking, most baked static entities do not put much load on the server. It's usually dynamically spawning/despawning/simulating entities that hurts performance. Unless you are spawning AI or vehicles outside of your play area it should be fine
If your scenario will use AI then probably a good idea to delete any AI spawns outside your play area
Same for vehicles
this is a batch file
we can use batch in tools?
oh
itll make a log and boom you have a list of .et
but I need it to be very recursive
for all the weapons and gear in the dependent mods, to get all that into one
chuck it in chatgpt to help you out and verify the script is safe, even tho i got chatgpt to make it for you lol
just ask it to be very recursives
there may be a better way but idk myself
lmaooo I been doing that with ai for 3 years I learn that you must learn with it in order to figure things out
I just need to give it the docs that are in the tools folder as a dataset and then its a bit more accurate
but the docs are huge
learning c with ai i guess and the best way to learn is from a game
use the paid version of claude ai
its way better and its built for coding. its what im using
hi frens. Im trying to implement an AI command to open the inventory of an AI recruit
But if I call SCR_InventoryStorageManagerComponent.OpenInventory() on the targets storage manager it will always open mine
That is because SCR_InventoryMenuUI will just always fetch the player's inventory storage manager
Does anyone know of a way to achieve this? or know of a mod that has I can take a look at
or am I just going to have to hack it/mod SCR_InventoryMenuUI
haven't looked into it much yet but I want something similar (being able to access inventory / change equipment of recruited AI) eventually.
My initial thinking was it would probably be easier to find a way to expose living AI inventories as storages (as if they are dead and lootable) with maybe some hooks to make the AI character try to equip any items you insert or drop it to vicinity if it can't be equipped or stored.
That way you don't need to worry about making inventory menu open and work for the AI directly since you don't need to manage loadout slots directly, just open it for local character and have the AI react to player looting/reverse-looting gear on the AI's storage
yeh thats an option but also not ideal
im trying to mod SCR_InventoryMenuUI atm (well, Claude is)
so im opening the menu manually, and then forcing it to reinitialize/refresh with the targets inventory
MenuManager menuManager = GetGame().GetMenuManager();
SCR_InventoryMenuUI inventoryMenu = SCR_InventoryMenuUI.Cast(menuManager.OpenMenu( ChimeraMenuPreset.Inventory20Menu ));
inventoryMenu.SetInventoryManager(targetInventoryManager);
SetInventoryManager is a modded method that is trying to re-init/refresh
but after its open, because I cant see how to override the actual opening code (menu manager is external)
no luck there, but trying an alternative approach: switching player control to the AI recruit, then opening inventory and switching back
using the same method Game Master does to control AI
yeah that could work, have player posess the AI -> open inventory and hook some logic to unposess upon closing inventory
atm im just switching back after a 100ms delay
but if that doesnt work yeah I can just hook into close inventory
complete success!! here is the implementation if you want to use it: https://github.com/ArmaOverthrow/Overthrow.Arma4/blob/aicommanding/Scripts/Game/Commanding/Commands/OVT_OpenInventoryCommand.c
and credit to our good mate Claude for the idea
That is an non issue, animations are not run on the server and clients who do not render them neither.
yeah that makes more sense
Hey Mate, I have had the same troubles but have at least got a hello world example going.
Start by openeing the world editor and making a blank world. import a SCR_BaseGameMode SCR_FactionManager and a SCR_LoadoutManager. Click on your new BaseGameMode and on the script table click + and select OnPlayerSpawned this is where you can do your print or hello example. When you want to start doing more you can create your own custom class that extends the base game mode and change methods as such. Hope this helps 😄
Any chance we're going to get a NetApi call to validate/recompile scripts and get errors back? It's the last step to a vscode plugin really
I dont think you can use ScriptModule.CompileScript with anything that is inheriting any classes
sounds interesting, make a feedback ticket for it with an example of what you would be expecting and our tool programmers can have a look at it
I have vscode autocomplete with entire vanilla codebase and would be cool to have a compile button
I use perplexity pro and Gemini with the docs oof the full code
in a way you can if you ziptie him you can pickpocket him 😭
I have a scaled item that whenever I put in my inventory and place it back down it gets ride of the scale, is there anyway to fix this
You'd have to scale it every frame
How do I point at specific hitzones in an array and return only the ones in a destroyed state?
How'd you manage that
I've made an extremely janky extension for testing this but I'm not interested in putting serious effort into it until I can validate/compile scripts and get errors
How did you get the enfusion codebase out
Copy paste
not what bacon used but fwiw https://github.com/landaire/enfusion_tools/
It's packed up though?
This doesnt work in reforger scripts but other than that it's cool
what do you mean?
it works for dayz scripts but not reforger scripts - doesnt parse various keywords and stuff
you're referring to your vscode extension? because my repo i linked works for reforger
oh wait sorry I thought you meant this for some reason https://github.com/yuvalino/enscript/tree/main
ah
I've been thinking about this too much
no that repo is just to suggest a way to read the scripts out o fthe packed game files
yeah I saw the online demo it looks amazing
I think that repo mario linked for enforce script would be the way to go for creating a proper autocomplete: https://github.com/simonvic/tree-sitter-enforce
tree-sitter fucks, so the LSP would just need to be written. still on my TODO list whenever i quit my job
All I did for my crappy plugin was parse everything with the world's worst regexes
hey if it works it works
But I don't want to commit to it until I can actually compile (remotely, via net api)
for the compile step, does that just validate script syntax + type checking and compile to a pak file?
there's no intermediate bytecode right?
There is no compile step in my extension, what I want to do is tell script editor to recompile scripts like pressing Shift+F7
And get a list of errors and warnings back
You can run ScriptModule.CompileScript but it will not compile anything that uses a class from anywhere outside itself
Unless I'm just dumb
I think there is
But we don't see it
You need to set the parent module
right it probably gets JIT (to the intermediate not native)
Where do I set that?
In the compile script function there's a parent module parameter you use GetGame get script module
Yeah I did that and it still complained
peak
hey guys, what function I can use to send UI messages to player screen in conflict mode?
Can you call a variable that meets a specified condition in a foreach loop?
If the array has 6 variables for example and 1 and 3 have met a specified condition how do you retrieve 1 and 3?
i feel like this apart of scripting but im trying to fix this ui being so close together
docs of what ??
Popup message
ty. I can popup messages to player in workbench. But the dedicated server player can not get the notifications. I basically copied the scenario framework code in another system.
I forget to change the system from "server" to "both". Now it works.
C:\Program Files (x86)\Steam\steamapps\common\Arma Reforger Tools\Workbench\docs
j I can try to host this thing but I'm not sure if it's online or not but you all have that in your armaforger tools in the docks of the Workbench and script api
is there a function in the game where if players go into a entitty set up with a radius that they die instantly ?
Get the SCR_CharacterDamageManagerComponent from the player when entering the zone/radius and just use Kill() func
how can i see my Sphere radius , Trigger action dont seem to work when i pass through ?
Because it’s a empty entity with just an RPL component
What would be my best bet in the biggest radius ? I’m wanted to cut after the world off from players using but I’m also allowing Helis hence the need to instant kill when they go beyond a certain point
nothing happens when i press draw shape
see it ! thanks
You probably could get the terrain boundaries dynamically, + your own treshhold to it for helis. With that you do not need to hardcode any values besides trashhold distance
Terrain size X, Y + Treshhold = Your Radius
Yeah I could try that out, I would just 400x a prefab but I guess there would be collision issues with that plus I’m guessing it would cause major performance issues
Hi, so im almost clueless about scripting and im just helping myself with chatgpt to understand a little bit better and create few things, im trying to have a component that allows me to select different bones from a character to link/attach them with particle effect slots. Im trying to debug now but i got stuck and i have no clue and i keep getting this error "scripts/Game/Components/FXBoneEffectComponent.c(24): error: Trying to call non-static function 'GetComponentData' as static":
[BaseContainerProps()]
class FXBoneEffectComponentClass : ScriptComponentClass
{
[Attribute("", UIWidgets.ResourcePickerThumbnail, "Particle Effect", params: "ptc")]
ResourceName m_ParticleEffect;
[Attribute("Spine5", UIWidgets.EditBox, "Bone Name")]
string m_BoneName;
[Attribute("", UIWidgets.Auto, "PointInfo (auto-init)")]
ref PointInfo m_BoneSlot;
}
[ComponentEditorProps(category: "FX", description: "Attach particle to specific bone")]
class FXBoneEffectComponent : ScriptComponent
{
protected ParticleEffectEntity m_Effect;
override void OnPostInit(IEntity owner)
{
super.OnPostInit(owner);
// Recupera la tua ComponentClass dai prefab data
FXBoneEffectComponentClass data = FXBoneEffectComponentClass.Cast(GenericComponent.GetComponentData(owner));
if (!data || !data.m_ParticleEffect)
return;
// Inizializza il PointInfo sulla bone
data.m_BoneSlot.Init(owner);
// Parametri per lo spawn in LOCAL space sulla bone
ParticleEffectEntitySpawnParams params = new ParticleEffectEntitySpawnParams();
params.TransformMode = ETransformMode.LOCAL;
data.m_BoneSlot.GetLocalTransform(params.Transform);
params.Parent = owner;
params.UseFrameEvent = true;
params.DeleteWhenStopped = false;
params.UseParentAsVelocitySource = false;
params.PivotID = owner.GetAnimation().GetBoneIndex(data.m_BoneName);
// Spawna il particle
m_Effect = ParticleEffectEntity.SpawnParticleEffect(data.m_ParticleEffect, params);
}
}
I have a component that applies physics impulses to a body to fly and whenever this EOnSimulate begins apply impulses to the body EOnContact stops working. This only happens in a dedicated server enviroment
This happens only on the server and if the client runs it, it runs just fine
The function GetComponentData needs to be called on an instance of GenericComponent. So get from owner the instance of GenericComponent and then you can get the data for EffectComponent
Replication streaming is only for proxies right? So I cant force stream out an entity for e.g host & play?
Hello, I am in need of help. The following below is my problem.
It says that the 1st line is incorrect
I have compiled the other 2 scripts. I shall show those as well, As they work together.
Any help resolving my issue will be greatly appreciated.
I understand "Modded" enum is the issue. Though when I take it off. The following happens. This gets resolved once the term modded is replaced back into the line.
Only add your new values in the modded enum, not the vanilla ones again
Ranks are what I added though
Yeah dont add the vanilla ranks again in your modded file, like PROPS, AI etc..
Perhaps I am not following what is being said.
So, I remove all of it aside from the additional ranks?
Exactly
What does the error say
Is there a way I can invite you to look at the issue?
In what folder (path) is your modded file?
can I show you via video?
That way you see exactly what I have.
Fleet UI Overhaul\scripts\Game\EntityCatalog\EntityCatalogEntryData\SCR_EntityCatelogSpawnerData.c
Fleet UI Overhaul\scripts\Game\Components\SCR_CharacterRankComponents.c
Fleet UI Overhaul\scripts\Game\Editor\Enums\EEditableEntityBudget.c
Check dm
Works now after remaking the script with a different name
This return vector zero on a dedicated server :/
Ouch, I imagine map doesnt exist on server since it doesnt have UI
Asking this seems so simple but can't figure it out
How do i get proper world size? For example Everon is 12800x12800.
If i do this:```
GetGame().GetWorldEntity().GetWorldBounds(min, max);
float widthX = (max[0] - min[0]);
float widthZ = (max[2] - min[2]);
I get 14443.8 x 12900??? Why do the map /cords show 12800?
My goal is to get max x,z cord to i can select a valid point in the world position from 0-12800
any kind of config i can read or somthing
Hm not sure but bounds probably isnt the right thing to check
SCR_MapEntity mapEntity = SCR_MapEntity.GetMapInstance();
Print("X: " + mapEntity.GetMapSizeX());
Print("Y: " + mapEntity.GetMapSizeY());
this doesn't work on dedicated server thou
hello, i am not sure if i am in the right place, but i am trying to override a config file and it kinda fails, in console i get error that it cannot copy and load the file.
Though tbh the map entity should be there on server
actually i only tried size let me try x/y
Did you try with mapEntity?
Is there a difference between the workbenches playing a scernario and the games?
And if so how to I distinguish that
I think the main difference to understand is client vs server. Workbench runs both all the time. A DS environment is client or server(both in some cases)
Apparently I have a syntax issue
I tried adding and removing the last syntax. I don't know what the issue is
Either way the problem persist
When you mod a class
You do not have to copy paste the rest from the other class
Just modify specific method you want to modify with override keyword
And add new method like if you were inheriting normally
same for variables
Can I dm you it?
Post it here
In DM you just slim your chances of it getting resolved
You just posted the same as before
Read what I said
Is this your first time modding with scripting?
Yes
Watch the modding bootcamps
Trying to learn
Arma Reforger Modding Boot Camp #10 - Animation #3 - Scripting and Extra Features
Kind of shows it fast. But with anim stuff.
But there is some direct class modding in there
Also read what is on here
From Introduction of Modability of Enforce Script classes. and below
It's late here so you will not receive a reply from me in hours. Going to go to sleep
you wouldnt know how to fix HUD issues would you
#ifdef workbench or something
im trying to log when a bullet hits a player after first hitting a wall. basically a soft anticheat
i found SCR_WeaponBlastComponent that does all this under onWeaponFired. but its only for launches.
anyone able to point me in the direction of hitreg/trace for all projectiles?
shooting people through walls is perfectly fine in this game
Yes i get that, but not if they are doing so 100% of the time.
like squad, there are cheats where players rack lots of kills by just shooting the floor.
So i want to track than alert admins if a threshold it hit.
im currently tracking headshot percentage an alerting admins if this gets too high after x amount of hits
Wow thats weird, but are you sure this works in reforger? since all weapon fire and hitreg is serverside
we havent had anything to that extent, We've had a few hackers of players wiping areas in seconds by shooting through buildings ect
Yeah with a wallhack and sufficiently high caliber it might be easy
How to activate #define in code ? I tried to add define in Workbench->Options->GameProject->Configurations->workbench->Defines, but it ignores that
Elaborate a bit, are you trying to create a definition? You just need to place it in a file, ideally alphabetically higher (so a file like !Depyrih would be ideal), definitions only apply within the module it is placed in (Game, GameCode, not both), otherwise if you are trying to ask how to run a script if definition is present, do #ifdef YOUR_DEFINITION (followed by your code then #endif)
How to activate MY_DEFINE to print "Hello" ?
void Func()
{
Print("Func start");
#ifdef MY_DEFINE
Print("Hello from my define");
#endif
Print("Func End");
}```
u cant make #define MY_DEFINE 1 like in c++, u should place this define somewhere. I know how activate defines from startup parameters for exe file but how it works with workbench?
#define MY_DEFINE
void Func()
{
Print("Func start");
#ifdef MY_DEFINE
Print("Hello from my define");
#endif
Print("Func End");
}
it doesnt work for outside, it works only inside file with this #define MY_DEFINE
I dont want restart workbench every time and change startup parameters to activate/deactivate define
Try to find Build or Compile settings and loon for Preprocessor where you can define the definitions.
If you want to make it work when compiling in the workbench, create a file and put #define MY_DEFINE
I think that will work for what you are trying to do, but it will be a part of your project until you remove the file.
I cant test it rn .. but can you even define something and then check for the definition inside of the definitionm
#enfusion_scripting message
I want enable define for ALL project That code is simple example. I have that define in different classes and different modes that i added to project
@abstract crescent it works in file compilation order, which is alphabetical
Do what I said and make the define in a file named starting with an exclamation point
So other files compiled before the file you put the define in won't "see" it,
but if you do what im saying, they will "see" it and it will work for the whole project, however, like I said, the define only works in the module you put the file in, so if you have scripts in multiple modules, you will need to take that into account
thx for help. But this design is look like weird. I better will use scrDefine in exe file. But another question: why Workbench->Options->GameProject->Configurations->workbench->Defines doesnt work in workbench 
good question, I wondered the same 2 years ago when starting to mod it. Not really sure
I will have a look at them when I have time
How can I add the ability to name config objects - or create a parameter which does that? For example, with action contexts, their name in the workbench updates to "Context Name". I would like to add this feature so my config array is not just the class name over and over again.
implement the _WB title method. the classes you found as example have a title attribute on their class definition. there you can see how it is done 🙂
https://enfusionengine.com/api/redirect?to=enfusion://ResourceManager/~core:scripts/Core/attributes.c
line 392 (BaseContainerCustomTitle)
Did u ask about that?
class MyCustomTitle: BaseContainerCustomTitle
{
override bool _WB_GetCustomTitle(BaseContainer source, out string title)
{
title = "My Title";
return true;
}
}
[BaseContainerProps(), MyCustomTitle()]
class TestConfigClass
{
[Attribute()]
string m_ID;
};
I found it, really I was looking for BaseContainerCustomTitleField("m_Identifier") as I want it to by based on entered attribute
Also a note, you need to put BaseContainerCustomTitleField("m_ID") on inherited classes as well, not just the base class.
Hi, what is the best way to get an array of IEntity containing every spawned vehicle ?
maybe poke the editable entity registry
My original idea was to mod the VehicleControllerComponent and add each entity to an array by overriding the OnDelete / OnDestroyed / OnPostInit
How would I access the editable entity registry ?
tl;dr it is useless for you. it is only used in validation for multiple platform configurations right now. you must use the cli param
ok, thx. Its strange, but we havent another way
yeah tracking the array in a system or manager and registering/unregistering vehicle entities to it when they are created or deleted with overrides to those kinds of methods (or binding event handlers/script invokers if they have them) should work
Do layers support drag and drop system?
How do i move a character into a vehicle?
Are there any tutorials or info about how to have a server save a default json if there isn't one, and then read from it if there is one?
Is it just a case of using JsonSaveContext / loadcontext and a file path "$profile:name" ?
I just need to read playerUIDs from the server but the file isn't being created as a default to then read from in future
Basically, yes
Are you able to point me to a resource? I tried looking at your server admin mod actually to try and work it out but it wasn't creating a default file
As in the json file itself needs to be created manually on the server?
Yes create your class/struct/whatever and save it to a file
Anyone else light entitys just randomly stop working in WB?
Anyone what this error is
Pre sure I came to the conclusion that it's because the game isn't in the right state yet.
I take it you are getting these at a server restart?
Yea.. when I start the server up
Any recommendations 🙏🏽
Fix the code - that's all, error is telling that something is call Rpc for entity/component without a replication (or not yet inserted to it)
And in this case it's somewhere in ZEL_PlayerUIDComponent
It’s a prefab it should work without me having to change it ?
It is probably because you are sending RPC before EOnInit of RplComponent which inserts it into replication
SCRIPT (E): No data found for keyboard:KC_TAB !! Check 'chimeraMapping.conf' and add data if necessary! Provided Actioname: Inventory_WeaponSwitching.
is this log spam back for everyone else? it was happening back in december but latest update it seems to have issued it's triumphant return
I certainly dont have that action or any references to KC_TAB in my input conf override
Enfusion is yelling at me and saying cast to world is not supported, you ever figure it out?
World world = baseWorldVar
It's wired but it's how bis supposed to do this
Yes I was able to create the decal eventually, ill send the result when im at my computer next.
I dont remember if Vlads solution was mine, but give that a try
It's literally code from BIS, just save to World var without any cast 🤣
ChimeraWorld.CastFrom(world)
@shadow oxide
World is a special pointer, so it needs a special cast
unfortunately
This also can be used for World
That one looks familiar, i think its probably what I used too
World castedWorld = ChimeraWorld.CastFrom(world);
u mean castWorld
this worked, thank you!

store actual bounds in json for dedicated servers. that's what I had to do. also, I store the spline points and width for roads in json as well. had to be done.
yeah, sucks thou :/
i'd like it to be dynamic for any map
Why do those need to be stored? You should be able to get them dynamically
I do it in my mines remixed mod. Just get all roads and then you can get all points of a road and the width of that road.
I just want actual map size but doesn't seem like dedicated server loads the map entity size?
It does, I use get world bounds and that seems to work just fine. I just plug in the min and max for get roads in aabb or something like that. I can post my code when I get home in a few hours. I've personally tested for everon and Arland, works great for getting a random point on a random road for placing mines. You could always check my mod in workbench to check it out sooner.
Get world bounds shows bigger size than the terrain but the roads stuff might save you in your case
did the game start allowing multiple players with the same player name in workbench recently, or am I going insane? previously my peer client connected as keeyan (0), now I have two players that can't be distinguished apart. wtf
Damn, you had to changeSCR_NearbyContextWidgetComponentInteract::IsHealingAction to static and now I my override through modded won't work anymore, since when SCR_NearbyContextWidgetComponentInteract calls IsHealingAction from inside one of its methods, it calls the vanilla implementation instead of my override...
I'm wondering why modded seems to be implemented as an inheritance hierarchy under the hood, when it could probably be actually inlined.
This is a question for Mario regarding the Modding Boot Camp #10. Can we get some insight into what Weapon_DetachMagazine does under the hood? In the tutorial, you used weapon.RemoveChild(magEntity, true); to unparent the magazine, but this isn't sufficient for detaching the mag. Weapon_DetachMagazine still has to be called to update the weapon, which despawns the mag. If Weapon_DetachMagazine isn't called (which is what I am shooting for), the weapon still behaves as if the mag is in the gun and doesn't spawn the next mag. So I assume the mag is cached by the weapon and breaking the hierarchy doesn't actually free it. Is there an API that I am missing to properly detach the magazine?
is it possible to edit the SCR_CaptureAndHoldTeamScoreDisplay.c
im making a king of the hill script and want to modfiy the capture and hold hud thats already in the game but the script is read only.
any help would be amazing
or do i create a script that uses the exact path as SCR_CaptureAndHoldTeamScoreDisplay.c in my own projects file path and have it call upon the orginal script and also my own?
Do you want to mod that script? Or replace it fully?
I'm making sure because you can still override certain parts of it if you want
currently thats what it looks like but i want to add a third team since its a 1v1v1 koth so 3 teams, plus i want ot edit it so it says what zone is next, 3rd team score board etc etc
If you want to replace, go to the script and copy the entire file to clipboard, put in notepad, etc. because once you replace the file it will be hard to get back to it until you delete yours (it still exists but script engine considers yours the original)
Find the folder hierarchy they use for that file, and make the same folders verbatim in your project
so:
scripts
- Game
- UI
- ETC (you need to find this yourself!)
After that, create a script file and name it exactly the same as their script,
Paste their script into your script, validate and reload scripts.
when i created the script in my projects hirerarchy it wont allow me to type in it
also when i make a txt file with the script name and the file tpye .c and tried importing it i got this
i might be doing something wrong
Script files are one of the only things that do not need to be registered
They get automatically read from the Script folder (Each module reads it's own folder).
yeah but my problem is i can create the script but not type the modified version inside it ?
Are you modding an existing script?
yes the SCR_CaptureAndHoldTeamScoreDisplay.c script
Did you also name it SCR_CaptureAndHoldTeamScoreDisplay.c?
currently this is waht is showing
i want to make it so it shows 3 teams scoreboards, time limit, what zone is curently active etc
Don't do that
i guess i shouldnt have done that ?
You completely replace the file
Bad for modding
Make the name different. Or have the file in a different path.
(Your project folder is not considered part of that path)
also
Use modded keyword to mod classes
thats my current file path atm
See everything I pointed here, and below messages
#enfusion_scripting message
im guessing its this one ?
Modding patterns
Also modded classes are seen in Animation #3 too
sweet thanks ill give it a watch rn
one last question tho
pretty noobie tho. with watching all the videos in the playlist will it give me the basic foundations on learning everything regarding modding in general ? - after this koth project im wanting to make a custom world built from scratch etc like a Vietnam style custom everything ?
sorry if its a weird question to give an answer to
In general yes.
They are bootcamps so they show you stuff, the tools and how it looks to bring some stuff in.
But they are not tutorials and not aimed to be tutorials on how to make a full map for example.
That is why they are based on foundational areas needed for modding in general
like scripting, audio, modelling, animation, etc
In Animation #3, we actually mod a feature in to player character.
true ? i guess tomorrow ill be watching everything on that playlist lol. lots of studying in the days/weeks to come haha
man I wish there was an easy way to spread a foreach loop in chunks across multiple frames
Yeaa.
the GameSystems are kidna going for that.
/*!
The 4 functions below are designed so scripters can handle a batch update of multiple entities in a performant way.
Example:
override void OnUpdate()
{
BeginUpdate();
foreach (IEntity ent: myents)
{
ent.SetWorldTransform(myNewTransform);
AddEntity(ent);
}
Update(); //< This is the call where entities are updated in batch
EndUpdate();
}
*/
Just not really there yet with a good standard solution
maybe in arma reforger 2?
rn I have to write like 3 methods, enter, step and end I guess and two variables: data array and index
Just use a pivot variable with % sizeOfArray 
No need for structures or anything else
no methods needed, no new containers, nothing
some stuff is needed to tell the stuff waiting on the processing how much was processed and when it's over
You know how much.
pivot instances were processed
It does not seem to be generic as you say
So there is no tool for that, I don't think we ran into this on scripts
Yeah which is why your arsenal crashes people
one example where I might use this is my loadout editor but thats not client/server, render N amount of thumbnails in the list per frame
In general how it goes is that you will only see tools/APIs for things that are general
If one system needed it, then very rarely you see it on as tool
foreach (int index, ArsenalItem item : m_Items) {
GetGame().GetCallQueue().CallLater(RenderItem, false, index+1, item);
}
Done
Rip the callqueue implosion and freezing networking threads because of it

by the way are those guaranteed to be sequential? if I dump 100 of those in there will they all run in that order?
When done with CallLater of CallQueue in general?
Yeah
uhm I do not recall. Let me get back to you after checking the implementation
Idk I thought you did now know how to add specific language syntax markup to the code block
Bro its highlighted
Must be phone version then not doing it .. mb
im honestly having trouble with this hud crap. would anyone know how to make it visually better. also how do i remove that annoying very top bit of the image ?
Oh, that's your mod. I've used your mod a little, and I am pretty sure it's not actually random points along the road. It's not the full spline and path of the road anyway. That's not available in-game from the Road manager thing, but you can get the full data while you are still in a workbench plugin. I also like to know the path of the spline from one point to the next, so I can the perpendicular direction and have the edge.
is there a simple way to not allow player to fire weapons?
CharacterFire actionmanager thing
are you wanting to stop players from shooting inside mobs ? im guessing ?
any area
I've seen attempts to do it that work that are overengineered, there has to be a simpler way to do this than try to intercept action context with 200 lines of boilerplate
{
override bool CanUseItem(IEntity item, ItemUseParameters params)
{
// Check if trying to use a weapon in no-fire zone
BaseWeaponComponent weapon = BaseWeaponComponent.Cast(item.FindComponent(BaseWeaponComponent));
if (weapon && IsInNoFireZone())
return false;
return super.CanUseItem(item, params);
}
}```
iv seen this around lately, hopefully this helps
on a related note, I find it weird how a captives mod I saw uses a unattached vehicle compartment to restrict player movement. It's not something BI core code anticipated, so it has side effects. I guess it had to be done though, or the alternative like rewriting animation transition stuff was messy.
Did AI give you this code?
nope, i just found it awhile ago when i was searching google for code related crap
whys that
doesnt even compile
anyway I wonder if it would be easier to simply holster the weapon and not allow ANY weapon to be equipped
inside said zone
but that might have side effects, when getting out of a vehicle in combat for example
increased time to start firing
i know thc has a working zone control on there server. inside mobs it just refuses you to shoot at all. i dont know - you could always hit them up and ask them ?
I wanted to create a return to sender script, rockets, bullets, etc. reverse trajectory when fired in or at a no fire zone
Lol I did bounce friendly fire damage before
Super funny
on the topic of input, action contexts with overlay selected cant use exclusive
I expected it to work in a way where used actions are eaten by my context and everything else is passed down
and when you set it to exclusive without overlay then only your actions work and nothing else
so I dont understand what the point of overlay is
or rather exclusive
but I would like to find a serverside solution to disabling weapon fire
Is there a way to detach a mag from the gun? Removing the parent and removing from weapon storage don’t work since the current mag is cached
Gave some ideas an honest attempt but seems like there's no way to easily do a thing as basic as prevent character from firing a weapon without doing a rain dance
I've only seen it done by denying / resetting keypress. server can only give client data about conditions. I guess it's done without worrying about context because it's coming to the character controller. I did something with limiting horn press button altogether when in a vehicle, because you can't control the horn scripting through the vehicle itself really. it was kind of jank since you don't have full control of the key event firing off.
also, I remember Arma 2 had a huge collision dome thing for bases to mess with all lethal projectiles / grenades. maybe that's the superior way all along. fun times.
Delete the weapon on left click and spawn it back a frame later 
@ocean kernel so I tried out my genius single file drm idea and it works. my file is 78141 lines of code, 3,083,835 characters (3 MB text file 😂 ), compiles in WB, launches and works in-game just fine.
haven't tried to work with this in the script editor or use the debugger tho, no one sane would use it as a working copy anyway, but rather do it as part of the release.
Sounds like a lot of effort for someone to just open the file with some text editor. Also that file is probably taking up a lot of memory.
10 smaller scripts vs 1 bigger script not sure there's a memory difference
everything is compiled anyway?
Wasn’t sure if the file was garbled data or a real project lol, assumed the former
I'd say the compiler aggregates everything (or at least the modules) in memory during compilation anyway, as there's no "unit of compilation" (which then needs forward declarations and so on) like in C/C++
no, it's a codebase of an actual gamemode I'm involved with, just merged into a single file
Yeah I was worried about one of my files that has a lot of classes in it.
I only checked briefly ingame, but if that superfile were to be truncated at some point, it would very likely fail to compile
ah you meant that everything needs to be compiled after all, regardless of what file it comes from
Silly idea, not that I am opposed to privatising code though,~~ but it might work lol. BI didn't implement a ReadLine function but instead has two ReadLines functions. Verified BI moment.~~
//SCR_FileIOHelper.c
//! Get file content as one big string
string GetFileStringContent
//! Get file content as array of lines
array<string> ReadFileContent
FileHandle.ReadLine
DRMbros it is over...
I'm not sure how does it relate to my concept?
If you can read a single line you can process your file without running out of RAM and essentially bypass the fact it is one hypothetically big file you cannot open.
Otherwise where is the DRM if people can read and copy your code?
nah, it's not about reading the file. there is an unpacker for reforger data files on github anyway, and any decent text editor (be it notepad++) will open and work with even a 100MB file.
there was a longer discussion in #other_ip_topics which you can check out to get the entire context.
in short, we were theorizing about ways to make a drm (as a watermark, or access control within the game, or whatever else) that wouldn't be possible to be removed by simply overriding it out and without infringing IP rights
the point is that if you make a sealed class one cannot just modded it and remove your access control, but they can still overwrite entire script file. but if you put your entire mod in a single script file, they would need to copy and redistribute your entire codebase just to remove the drm (but that is an IP infringement and BI would go after you)
strongly suggest overriding firing "action" keybind
SCR_CharacterControllerComponent
OnPrepareControls
void HCA_GR_TriggerCheck (ActionManager f_ActMan) {
// only relevant if hold allowed
if (HCA_GR_m_bIsTriggerHoldAllowed) {
return;
};
float t_fActVal_Fire = f_ActMan.GetActionValue("CharacterFire");
// block fire action
if (t_fActVal_Fire) {
f_ActMan.SetActionValue("CharacterFire", 0);
There is, but for making itbeasier everything is forward declared already. In older enforce you had to forward declare and use .h script files for header.
interesting info. so based on the internals, would amalgamating into a single file have positive or negative effects on the runtime?
Its useless as drm tbh
The idea is to prevent overriding mod scripts by placing same named script files in your mod
Just seal your classes
In this case it would simply render the mod not working
How does sealed help here since you can completely overwrite any script by having script with same path and name? Huh
If someone is copying it, and you specified that no derivatives. Even if you happen to be subject of a case where it does not constitue actual IP rights issue. We will tell the modder to remove it anyeay on basis of good behavior
And if not then remove the mod.
copyrighted filename
arma.c
You are more likely to get banned by making a script file that bugs out workbench on purpose
Remember that the drm cannot affect the tools, game and server in a way that it does affect negatively on it's behavior
Tolerance on obfuscation will be completely gone soon. So if you are doing that then i suggest you stop
I did explain the use case
Its not allowed but it is tolerated. But its becoming such an issue that its going to be gone soon
I fail to see how is that obfuscation. the code can be inspected freely
People will just copy the code and paste things until it works
They dont need to understand it
Its what always hapoens in a3, dz and here
Its useless
you're entirely missing the point. this is not supposed to protect against reading or copying the code, it is to prevent overriding certain things (i.e. modded-ing out a watermark code) without causing an IP infringement
Also makes it harder for us to see if there is ip rights issue in there
So it will be banned
I am not missing it
It does not protect
Its the same as having it in a separated files
From enforcement from our side, its the same
Which is where bacon idea origimated from
Based om his posts in IP channel
Also simple things are not protected.
I had someone before that wanted me to ban a guy for modding a vanilla method that returned true to false.
Silly
Did you ever fix this by chance?
But what if I actually just faceroll my keyboard for variable names 
A bad variable is very different than making a method call 100x other methods with randomly made names
There is also huge performance loss by doing that method thing, or random things in a method
Not to mention that it does make it useless for us to investigate crashes, investigate a mod, etc
It is simply going to go away. I will probably start enforcing it early next month and on
And no, providing us the source does not help
As the crashes are almost always due to the obfuscation process
This also goes for file obfuscation
Not only scripts
And also for messing with the pak files
Ask in the AI channel 😅
Bumping this hehe xd
ok Ill move my question there, but it doesnt make sense to me why I CAN get the SCR_ChimeraCharacter from the owner, but I cant get the AIAgent 🤦♂️
I feel like the real solution RE copy protection would be for BI to just fix it so that sealed class restrictions can't be bypassed by doing entire file replacement
Not gonna happen
And there is nothing to fix
Sealed is only for classes, enums or methods.
It's not aiming to solve that.
It's there so that other developers know that a class is not expected to be inherited from
ah ok
If anything, solution should be something else.
I've seen it used as a kind of DRM in other mods so figured that was expected
(sealed class that is)
Not repurposing some tool that was never aimed for that intent
Yeah it is not for that.
Are there any plans to give modders some kind of proactive DRM mechanism? Playing whack-a-mole on IP infringements retroactively does not seem ideal as in a lot of cases damage will already be done by the time a mod author finds out about and reports an infringing mod
Nothing is really planned or set in stone. Modding should be open to begin with anyway. So it goes against a bit fo what we have always aimed to get as platform.
First, other things need to be solved rather than that.
Until then there are no definite plans on it.
Other than make the report, on which the related team on this is already being strengthened with more resources.
It seems that DRMs are used by mod teams that aim to have their own servers, breaking rules or hiding things in general
So, it has the lowest priority for work to be done.
We might or might not provide it.
So, don't expect it.
It will also complicate workshop report handling, so there is that too
If we provide the DRM measures, and it gets breached and we expose it as a mechanism for that then it's on us if it gets broken. Which is not ideal.
Anyway, off topic for the channel.
You can DM if you want to discuss it.
The kind of use-cases I had in mind was around things like enforcing attribution conditions. For example if you release a mod, should be able to have some DRM logic to prevent people from just rebranding it and pretending they developed the mod for their own servers. Or in my case I am making a game mode which has similarities to some other mods/games and I want to prevent people from running servers with my mod and calling it something else as that would lead to confusion and potential drama
In this case, just make the report with proper information. Otherwise it will fall flat
Issue is, that what people add to DRMs are not really enforceable things, and in many cases break or conflicts with the game EULA (From the DRM maker side and their requests)
Of which, your mod would now fall into breach of that and make it even more complicated.
I don't think putting a different game mode's name in the server or scenario name is necessarily something that would be solveable through an IP report?
There are many reasons why we do not provide it, nor enforce it for you.
Reports are not only for IP...
IDk why people keep thinking that
We have behavior clause on the EULA and ToU
You can report that.
Like say I want to stop people putting "wasteland" or "dayz" or "extraction" in their server names when running my mod because it's not any of those things, what are my options there? Just manually monitor server browser and play whack-a-mole?
Add it part of your license.
Talk to the owner of the server, if they do not comply. Then report it.
They are also subject to the behavioral rules
Yeah so sounds like retroactive whack-a-mole is the only option
If you contact us first, we would tell you to try to sort it with the server owner first
then if fail then contact us again
Just saying some kind of preventative measures would be nice, I understand you guys have way higher priorities and it wouldn't likely happen soon if ever 🙂
Unfrotunately you are in a community platform
And we can not give you tools to moderate that yourself
As it si often more than not exploited when a platform gives it
Mods are not your own games, so you can't use these things.
They are content run within the game, which has rules and expectations on it.
But anyway, we are aware.
It's why the team is being increased in this area.
Not only for reports, but for active checks
Yeah fair I understand there is a risk of such a feature being abused to lock things up in a way that probably breaks TOS/EULA, I was thinking that wouldn't be nearly as frequent as other kinds of cases though so would probably result in a net reduction in cases BI has to process if we can enforce a lot of licensing conditions a bit better ourselves
Thing is that it reduces for you as the modder doing it, for the reports from players, servers and modders that want to derive from it increases.
I'm just going to ramble a bit here instead of presenting everything coherently.
Very little modder incentive if there's no way to lock things down on top of not being able to monetize (cosmetically or priority queue, etc) due to essentially all content mods having no monetization clauses (even for monetization separate from their content). Modding/server making is turning into a beareucratic hellscape that puts mod developers last.
Already it's happened that people try to load mods into their server and complain when it doesn't work when it has DRM. I had one server that wanted to take the source code of my mod instead of "add another dependency", It's the lowest effort possible. So if the approach is to move towards a fully open arma platform with absolutely no preventative (e.g. server side code) and instead be reactive (e.g. scouring mods for IP violations then going through bohemia) then there's no incentive to spend hundreds of hours to mod or build a server for free that's just going to get stolen.
I think there's great examples of games which are "platforms" with lots of modding like Garry's mod or Roblox and they all have ways to do server side only code. Even DayZ has mpmissions and that was enough to ensure IP wasn't being stolen at the game mode/server level (actual mods intended for greater use are a different story).
Now that servers can monetize the theft is only gonna get worse.
100%
I did not mention anything about server side mods. I mentioned about drms
And no. You are not getting drms from us.
Ok so we're on the same page. What classifies as DRM?
Have in your mod license stated that only x servers can use your mod. Then blocking things if the server is not on that list as one example.
Or breaking the game which already lands you with a ban.
And where does ScriptModule use stand here?
It's currently the only way of server side hidden code.
I saw some talk about mods erroring out or crashing the server being considered malicious. Which could be caused if scripts for ScriptModule are missing and a null error. I take it that's not what that means?
Malicious or technically broken mod does not mean drm
And malicious mod is the part that really lands you with the perma ban
Uhh
You can have a DRM of sorts that does not land you on the malicious part
Nice.
"Have in your mod license stated that only x servers can use your mod."
Ok and one last thing.
I've seen some mixed feelings from Bohemia people about ScriptModule, is it going anywhere in the future? Is there going to be some way in the future or A4 that we can do server side modding?
How is this relevant?
Its doing ehat i said
Its custom license.
Meaning they can add what they please.
I think my message got mixed up with "DRM" but it's a lot of things at once.
No 😅
I think he means if you put code that crashes it on their servers it's considered DRM, but license is OK.
No
That is just a malicious mod
So i'm free to release my mods with a license only allowing myself to use my mods.
Ok so "disabling itself". Semantics but my understanding is there.
Its your mod so 
Only way it is allowed is if the mod gets disabled without breaking the game
That's the approach all modders should take then
If you disable it but it causes the game crash on purpose then it is not allowed
Oh ok. That changes a lot.
(In isolation)
Take vanilla game, make it so that if your mod is loaded and not allowed, it is still vanilla game and playable.
Otherwise we consider it malicious and you get in trouble for affecting the normal functioning of the game, increasing crashrate, etc
And thoughts on this? It got mixed up in the last set of messages
There are no exeptions to this
Its in process but with moderate priority
It seems a lot of my original paragraph is explained then with these clarifications. My take on monetization still stands though. I think it's unfair to have a license preventing use on a monetized server, I think it should be restricted to not monetizing that content. E.g. if I have donator badges next to names should not be affected by a no monetization shirt mod. But the shirt mod should have all the right to say you can't monetize anything deriving from the shirt mod.
Especially since monetization is already non advantageous
The issue here is on the license the mod has
You can just use a license that allows it
We cant change the licenses of the mods as they are not ours
So nothing we can do here.
Unfortunately all of the top content mods use this clause, and to my understanding are funded by content creators who make those funds externally by content on their servers.
People usinf APL, APL-SA and APL-ND have blocked the monetization by default given the non commercial nature of the license
Yes but nothing we can do
Its down to the licenses.
If bohemia is going through the effort of policing the workshop meticulously and IP rights surely you can lay out what the license can and can't include.
There's also 0 reason server "hosts" should be allowed to get donations based off having the most popular mods either. Why should they get to receive money in exchange for something they had nothing to do with? Anyone can pay $40 and host a Reforger server. Not everyone can spend 100s of hours creating a mod.
I don't think one mods license should dictate the entire state of a server. It should be self contained.
Monetization is non advantageous so it eliminates that debate entirely, yes cosmetics of items are annoying and if you have a no monetization clause for your items that eliminates that.
Does having a priority queue affect that? I don't think it's bad in that case. Servers are expensive now. Small servers aren't getting donations anyway, it's for the big ones that don't get anything under the current model but have to dish out $50+/month.
I do understand your point and I would agree with it more if the base game had more content like A3.
Who want's to donate for priority queue on a server that doesn't have any good mods on it?
That's the current situation
Good
Its more that the license of the mods license the usage of it
Anyone know if it’s possible to “unstale” the player animation to stop it from T posing when changing materials on the player/gear?
Do it when they don't have anything in their hands.
It at least worked last time I tried it.
I don't know about clothing actually, but I can tell you it works for the character.
That's a fair point.
That was my point, the mod being on the server effects the number of players and the likelyhood of donations.
So remove the item from their hands, change material, and reapply. Sounds like a good hack
The way I read the way he defined "using" was loading it in general as a mod pack.
It may or may not work any longer. I haven't tried in a good while.
Its not the same. My point is that the license dictates usage. Server s using it. Players are using it, etc.
Its more that those licenses limit the whole environment. Rather than limiting it's features for this.
As they should because people literally only join servers based on the mods that they are using.
Unless it's some niche community.
@minor agate thanks for clarifying a lot there. its really confusing since a lot of the rules need to be read like a lawyer. Maybe some points we discussed about DRM vs broken mods can be added to your FAQ about mods and eula (I forget the name of it).
Anyone know if there is an API or way to detach a magazine from a gun? Doesn't seem possible to me
My issue I guess is that the character T-poses when they are dead - assuming that SetMaterial under the hood basically swaps the mesh object and breaks whatever animation matrix the model previously had, so maybe I can get the animation and reapply it after the material switch?
What have I done
I love how you downplay those mods by saying a « shirt ».
Mods that don’t allow monetization are usually the big and complete pack such as RHS, wcs, etc.
You can always delete those mods and make your own if it’s that easy.
You can’t be mad because you are not allowed to monetize someone else’s work
Whats the point in monetization of modded content if modders cant get a cut
I can see both side of the argument, if they allow monetization for modders then great! Just find a fair way to share the revenue.
The one thing i dislike and will never agree on is server owners insisting on disregarding a modder’s license and monetizing content(that they didn’t make).
I think way less people would be modding the game if they had no say over what people can and can’t do with their mods
I mean licenses are binding by default so that's not a very hot take
My take which I still hold is that licenses should be isolated to their own content not the whole server (same as the malicious mods vs DRM distinction where a mod must be disabled in isolation and not crash the server). And that if you want the no monetization clause it should only apply only to your mod's content being monetized in some way (e.g. skins). I also understand Marios point of "usage" meaning the mod is loaded and currently that's the easiest way to understand the current stance on the issue.
There's a tradeoff of modders spending their time and server owners being the ones spending their money to host. Unfortunately most server owners are lousy and it's created a reasonable stigma. I've already accepted the fact I will have to run servers without monetization, but unfortunately I can't even put up boards in communal areas for something as simple as thanking donators because that's "a reward or advertising". Nobody wants to donate for absolutely nothing in return and server costs are high.
Also, RHS and WCS act as the core for most content mods since the base game is lacking in content. As for WCS, from what I understand that is funded by Klean, who gets money to generate content on those servers. So content creators get to monetize WCS/RHS by using it as click bait (we've all seen it), while the ones actually providing the servers have to pay for it out of pocket with no help because of no monetization clauses ensuring nobody wants to donate.
This isnt really a discussion for this channel but donations result in your servers staying up, so it's not fair to say there is nothing in return. But I know what you mean, people need something they can present to others in-game to assert dominance over non-donators.
I don't think you'd break any license agreements by adding boards on a map.
From my understanding that would be "an in game reward for payment" or "advertising".
In general I don't think people would want to donate to a server especially not even getting recognition (like a thank you or a badge on your name). Maybe the die hards, but they're hard to come by. The monetization rules are already quite stringent in being fair.
But.... maybe i'm.. slightly on the autistic side and... yeah ok I was just giving grief for the sake of it. I don't like obfuscation either. I think it's a silly way to try and hide things but it doesn't. Sure makes it harder for the common person who just grabs things and doesn't understand it but for people that actually know it's just annoying and as you said a performance loss. Just a waste.
how would I go about populating a list of entities in entity browser from script instead of config?
With ResourceDatabase.SearchResources ?
Sorry I mean in GM entity browser
Like populate runtime
When the user browses stuff
Is using entities to replicate large dynamic datasets okay?
Or is there considerable issues with creating lets say 10k IEntities to have a bunch of dynamic rplProps
Because I can technically just send individual data 1by1 with Rpc and handle the data in maps /arrays on my own...
But using entities with RplProp seems like an alternative that could require less work
why not use one entity and write proper rpcs methods to update partially?
Would this be bad? Because I understood the markers right now kinda function liek that?
because large set of random and dynamic data seems more work and less automatic
If there is not a big downside for using a bunch of entities and RplProp...
That might be better for handling networking of big random datasets
having markers entities is great because you can pull in their origin and put it on the map easy
Yes but is there a reason they only do 10 markers per client? 
but add collision to them so that it randomly trips vehicles over
just to not spam entire map from one player
better yet, they could spawn actual marker meshes where they are placed like minecraft signs
funny that you mention that as that's one thign I got planned too btw
almost
Lmao that’s evil
at least - it's origin, memory for entity/component's data, hierarchy, cpu time for entity/component code
Question is does that have any downsides.
Lets say someone made a market shop.
All the items need to be synchronized.
Sure we can Rpc manually, but if there is no downside to just creating infinite amount of entities and using RplProp etc. instead.
Why bother managing the data manually
But the question is, if I create 10k+ entities and they all have 10 RplProp.
is that gonna be a problem
These would be "simple" entities like markers, but just for data storage, not position necessairly.
rplprop is faster in terms of cpu time, but don't forget about network traffic
if you bump entity - it will send entire it's data
not just single updated variable
I thought the server tracks what the data sync is and only sends the changed data?
I assume it tracks per client
Yea and Jip synchonization...
And in general intialization etc.
Natural feeling that entities are usually slower and have more overhead, but it could be eaiser
Anyone happen to have a script to delete a dir or at least all a dir's contents handy?
only by snapshots
so if snapshot is different in any bit then entire will be send
at least it's how it's described
ok, there are new functions: EncodeDelta/DecodeDelta
so now it's possible to send delta
market shop
client send request -> server response with 1st page of items -> client send request for 2nd page -> server response...
-> network go to the sky)
And also - how many clients receive non-relevant updates?
none, the data is created when mission starts
but my assumption is that the real thing slowing things down is high entitiy count and high RplComponent count.
Also RplProp will only replicate to appropriate clients I.E. if steaming is enabled - so you might be ok if these objects exist and are created by server and separated from player bubbles
So in a way when you bring the entity within streaming range, then it will replicate and rplprops will populate to current value.
Otherwise maybe a rplprop for that many entities is overkill and you just Rpc from server to players when they need the info, how much info needs to be accessed at once becomes the decision I guess
Instead of focusing on RplProp vs. Rpc, or multiple vs. single entity, I'd be more interested about who needs the data.
If your plan is to send 10 000 data items to all players right when they connect, then keep in mind that this just increases traffic spike in the most traffic-intensive moment - when client connects and everything around him is streaming to him.
For example, if you're only going to be showing those items in the UI, some questions worth asking are:
- Can I only send it when that UI screen is opened?
- Can I only send part of the whole (eg. pages of some 50 items)?
Entities make sense if there is natural relation between entity position in the world and data it carries being relevant to player in its vicinity. If this is not your case, there isn't much to be gained from entities.
edit: Well, you can take over streaming of entities and manually force them to specific players, but this is quite advanced and tricky, and you might find single entity with RPCs emulating classic request/response model from web easier.
also consider how data can change at a random time.
sending an update to 1 part of the data(such as shop item price change)
The reason I'm considering entities and RplProp is because it saves writing a lot of functions and handling data manually.
spawn entity on server -> set data -> bump -> bump when updated to update clients
vs.
create data on server -> cannot network objects -> create a Rpc with all the necessary data -> oops there's 10 data fields, create multiple RPC to send data -> handle sending data initially -> handle sendwing data updates with separate function (15 data fiels = 15 Rpc functions) -> handle/assemble the data on client
||i've done the 2nd way a few times, since this is a common issue I am just thinking of a system for making it easier the next few times||
cannot network objects
can you elaborate? Because I'm pretty sure you can write a codec and send custom type through an RPC this way. If your concern is that you want to send only some fields of it, you could add a bitmask to it which would indicate fields that were sent, and in the codec use that to only serialize relevant fields.
still more work than entity and rplprop
But yeah, you can also do the thing with entities. I can't really tell you how much strain would 10k entities be, since it depends on how heavy each of them is (eg. number of components, rate at which fields are changing and getting bumped, cost of streaming to client, etc.). My intuition is that, unless you modify properties every frame on many of these entities, the greatest impact would be upon streaming them in, so you want to keep them light.
👌 Yeah makes sense, networking and replication systems are usually slow.
probably CPU killer and probably all Rplcomponents and entities are in a foreach loop every frame
probably CPU killer and probably all Rplcomponents and entities are in a foreach loop every frame
Pretty sure that's not the case. 😄
Is the model that each item is an entity and you're sending the data for all the items to the client?
idea is that I just spawn all the entitiy in and set RplProps and no streaming, just replicated
minimum effort
global rpl
It's just that a lot of what one does has to be multiplied by number of clients for whom it is relevant, so you want to keep that number low.
The absolute worst case when all action is concentrated in one place makes traffic roughly grow with players and AI as (players + ai) * players. Even if you disable AI, you still end up with traffic curve that is square of player count (hence 128 player servers are such hogs).
I'm confused what these entities are? Are they shop items, map markers?
example shop items yeah
if we have shop items,
expectation is every player will interact with them,
therefor all data will be syncronized when they join the game (ish) anyway
In that case it would probably be better to have a catalog manager that synchrones instead of synchronizing thousands of entities because those entities will go into the world.
no that's more work
So your catalog model consists of 10k entities in the world?
Okay it would be better to have a catalog manager to only network 1 page to save on network traffic yes.
(virtual shop items) in this exmaple, so they are not in the world
they are not physical, just in a menu
Okay iv been stuck on the scr_captureansholdteamscore.c script for over a week now…..
Would someone please help me understand it, any changes I do to it just doesn’t work and I’m at a loss
@half patio did you mod it or due the replacement? Do you have any print statements in the script which run and log in the console?
Well not that I can remember, I’m taking the core elements in the script but the slightest change and instead of the normal original hud it just shows colored boxes
I’m just tryna add a 3rd team scoreboard and a time limit till next rotation of zone
Someone able to collab with me to get this working ?? Genuinely need help with it
Why does owner.ClearFlags(EntityFlags.VISIBLE, true); not work for characters on proxy? (Vehicles work) 
nvm I didnt apply to prefab 
I'm having an issue reading a json file. I can create it if it doesn't exist, and LoadFromFile loads my config struct correctly but then LoadContext ReadValue("", config) fails and I'm not too sure why
Anyone have an idea?
It is set up explicitly for two factions a lot of the stuff in the game is. Making it work with three factions I imagine would be quite a chore.
Probably including making your own game mode.
Hello, Is this necessary to do "RemoveActionListener" in "OnControlledEntityChanged" of PlayerController ? I use few times "AddActionListener" in "UpdateLocalPlayerController"
why does my AI move faster when my waypoint is farther away
Either it's missing a field or it's related to my discussion with Arkensor here #enfusion_scripting message
If you're using nested objects you have to initialize them in the object. First the constructor runs then the deserialize for that object.
Or do it the manual way until the fix is pushed
yes, I do it like this: ```c
array<string> files = {};
FileIO.FindFiles(files.Insert, "$profile:DirectoryToDelete/", "");
foreach(string file : files)
{
FileIO.DeleteFile(file);
}
or for example, to delete all json files in that directory: ```c
FileIO.FindFiles(files.Insert, "$profile:DirectoryToDelete/", "json");
Hey y'all, is there a reason why a ScriptedUserAction added to the ActionsManagerComponent of an entity is visible in singleplayer but not on multiplayer?
in singleplayer the client is also the server
Joe does anybody want to play with us
Does anybody want to play with me
I got Roblox fortnite and Xbox
Do I have to add something to the my ScriptedUserAction or to my prefab?
maybe? Whatever your action is, probably gets a variable on the server that you cant get on the client, something like that. I cant tell you what it is without knowing your code.
Oh yeah sorry, the player's prefab has a custom component added and the script only applies to those prefabs with the component enabled.
class GetLoadoutAction : ScriptedUserAction
{
[Attribute("Loadout Action", UIWidgets.EditBox, "Action title")]
protected string m_sTitle;
[Attribute("0", UIWidgets.ComboBox, "Loadout type", enums: ParamEnumArray.FromEnum(LoadoutType))]
protected LoadoutType m_eLoadoutType;
override bool CanBeShownScript(IEntity user)
{
if (!user)
return false;
return LoadoutComponent.Cast(user.FindComponent(LoadoutComponent)) != null;
}
override bool CanBePerformedScript(IEntity user)
{
return CanBeShownScript(user);
}
override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
{
if (!pUserEntity)
return;
LoadoutComponent comp = LoadoutComponent.Cast(pUserEntity.FindComponent(LoadoutComponent));
if (!comp)
{
Print("No LoadoutComponent found.");
return;
}
comp.RequestLoadout(m_eLoadoutType);
}
}```
But even if they don't have the component they can see the action, it just won't do anything. This in singleplayer of course as in multiplayer the action is just not visible
IDK, Id check your client logs for null pointer errors.
Sadly there are none :/ so I'll keep looking, thanks tho
This is indeed very annoying, I second this being fixed soon. We tried to override the ban message, but it doesn't work since the player is no longer in the server with the mod.
It'd just be nice for the ban/kick reasons to actually be able to show properly, as well as when a temp ban expires. Also not showing rcon kicks/bans as "voted out of the game".
Hmm okay, my json only has 3 ref maps of string:string inside, it fills it with a default for each when created.
What field might be missing? I can see them filled and they're formatted correctly but readvalue returns false
There's no nested objects, but I'll try the manual way anyway and see if that fixes the issue. I'll add some prints like you have to display the individual maps rather than just the ReadValue() bool
Can you post code for your reading?
Will do later 👍
@remote musk sorry to ping you but I had a question about the CharacterIdentityComponent::SetIdentity
I would like to use this to set identity locally, such as for preview, etc. rather than replicate across server. Attempting to use locally right now appears to crash to desktop, do you know anything about this or have advice?
Maybe you could extract the model/prefab and spawn that instead
Do these flags even do anything? Should this do something like owner.ClearFlags(EntityFlags.VISIBLE, true); or are these different flags?
Last time I tried to use these i had little to no success it seems entity flags reset when they're loaded in and out of replication. Best you've got is create an invisible material and setting the mesh to that.
SCRIPT (E): Virtual Machine Exception
Reason: Division by zero
Class: 'SAL_DroneHUDComponent'
Function: 'OpenMapWrapZoomChangeWrap'
Stack trace:
scripts/Game/Drone/DroneComponents/SAL_DroneHUDComponent.c:385 Function OpenMapWrapZoomChangeWrap
scripts/Game/game.c:922 Function OnUpdate
Is caused by this line???
vector center = GetOwner().GetOrigin();
the line number might not be correct every time
It works with owner.ClearFlags(...) but only a frame after PostInit. Im trying to spawn it in invisible, but with the extra frame you see it for 1 frame 
look for a method that does var / othervar, the second one was 0 then. somewherre around the line number that waas printed
Whats proper current way to get date and time?
I think there is a function for that in System.c
ty
Panning a map too early or something causes division by zero at engine/game code level
I remember encountering this with the MFD script - don't remember what exactly it was but it's one of the map functions if you do it too early the game just dies (love it).
Because the map isn't ready so one of the underlying variables which the map relies on to calculate zoom/pan is 0 thus it tries dividing by 0.
That was it haha, made a getter for the frame check and just waited until that was done now it works
Is there a most efficient/streamlined way to mod player stamina?
Or do I have to create script + custom stamina component for base character?
@fringe prairie really the one who dominates this parameter is @balmy cloak as he is the creator of the mod and identities.
https://reforger.armaplatform.com/workshop/64F869693699EEA7-Identity%2526CharacterSelector
You can always look at the code and see where the issue is.
Is there a way to force the player to load something outside of their replication bubble
Id only want it for a specific player too if that's even possible
Speaking of replication is it possible to turn it off per component or selectively replicate to players I choose? I’m assuming I’m boned if a component is written mostly in game code
Don't remember it off the top of my head but look into squad leader markers, specifically something related to streamingrule.
Are there any base prefabs that would be suited to start a computer tablet device from or just use item_base and build it from there?
That’s not really doing selective replication on an entity. The server knows the entity (player) positions and periodically moves the markers. Markers have rplprops which move them to the right positions on the client side since clients don’t have entity info (cross the map outside of streaming), but they get the marker replicated.
Squad leader markers behave differently than normal markers.
You can either have streaming on/off but if it’s off you need to “do replication” yourself but that also means movement, etc.
So let’s say there is a vehicle, I turn off streaming. Now I need to build the entire movement codec myself. I dont remember what it’s called but you can have streaming off but it still replicates to all players (ignores bubble), but that doesn’t allow selectiveness
Already have done that step haha, only ossue now is if a player connects to a drone outside of his bubble it obviously fucks it up
All players will get all markers (and then on client you need to hide the ones they shouldn’t see)
Which isn’t great for cheating
Yeah entity doesn’t exist, guess you can try this on the entity
Check the methods on replication component. There should be a con stream method you can call on the server to force stream it to the player
That still sucks cause there's no need for a player 5km away to have to track that drones positional updates
Okay bet will do
This is what I was trying to refer to, squad markers utilize this as it creates a separate entity and forcefully streams it in ☝️
https://languid-atmosphere-e75.notion.site/Dynamic-Map-Markers-1ce1c757d7ff808c933fe4c471217f96?source=copy_link
This was my approach when building my own marker system.
Can you post code for your reading?
Seems that you will have to use the player controller for this. Unfortunately you cant use WorldControllers yet in AR version of Enfusion which tackles this problem nicely
Hey everyone. I’m messing around with a mod for Arma Reforger, trying to make a trader NPC, but I’m kinda stuck on getting scripts to work with the NPC. I wanna add some custom stuff, like trading mechanics, but I’m having a hard time figuring out how to hook up my script to the NPC in the Enfusion engine.
Here’s what I’ve done so far:
- I made a script file in Workbench, put it in the right module folder (I think).
- I set up a NPC in the World Editor and slapped a Script Component on it.
- But, I’m not really sure how to make my script actually work with the NPC, like for interactions or dialogs.
Hey Team im looking to play an animation during a user action I have found in the codebase some references to using a custom loiter to play animations.
customAnimData.m_CustomCommand = staticTable.m_CustomCinematicCommand;
customAnimData.m_GraphName = "{312D2589E4BF5BC8}anims/anm/NPC/workspaces/Officier_Mission01.agr";
customAnimData.m_GraphInstanceName = "{DC477052F8B60926}anims/anm/NPC/workspaces/Officier_Mission01.asi";
controller.StartLoitering(ELoiteringType.CUSTOM, true, true, true, vAnimationTransform, true, customAnimData);
But this is not exactly right for my case I just want to use an animation like {8523E5943FD4F602}anims/anm/player/attacks/unm/p_erc_attack_punch_melee.anm I have looked around and not seen much in other mods. Any help would be great
Adding animations is a bit annoying at this time. In any case you are going to have to create an animation graph for it. Either you add it through modding to the main player animation graph or use a helper like a vehicle compartment or gadget to inject a standalone graph. ACE uses vehicle compartments, as they also make characters carriable (carrying and captives), but are harder to set up properly. An example for the gadget approach would be Bon Action Animations from what I remember.
You do not have this right now, but perhaps in the future you will get it when Reforger gets that Enf update.
In current Enfusion you can play an animation straight up by calling it by the ANM file from scripts.
Is there any information on hit effects and such? I'm trying to adjust timing with my custom warhead to play/spawn first, and then vanilla base game after that. Cannot seem to get the timing right...
This sounds great. The animation system is definitely daunting to look at even just to replace one.
Is there a component I can add to a prop that tracks damage from a bullet?
Scr damagesystemcomponent I think
Something like that
Bet got it kind of working
How do I have it delete the children of the first one
Currently all the entities in the slot manager stay
Just had to add damage managers to the prefabs in the slots
If I am using BaseElement.layout, how do I get the TextWidget name of "Name"?
I managed to get the workspace after 2 hours, but I have no idea what Im doing with widgets really.
Do you know the widget name you are trying to get? I guess the purpose of getting the widgets name might help me better
Im trying to change the base name color on capture, here's what I have so far, but it's not changing the color of the name. ```c
TextWidget name = TextWidget.Cast(GetGame().GetWorkspace().FindAnyWidget("Name"));
if (name)
{
Print("NAME WIDGET FOUND! "+name.ToString());
if(faction.GetFactionKey() == "US")
name.SetColor(Color.Blue);
else
name.SetColor(Color.Red);
name.Update();
}
I'm just doing this in SCR_MilitaryBaseSystem - OnBaseFactionChanged()
Is it printing the widget found?
It looks like it should
What diag menu setting do you enable to call component's DrawDebug?
An example for them please? I do not see the method on script component itself, so it might be specific to what you saw
Oh its not a component indeed, its in SCR_InteriorBoundingBox
Seen SCR_DestructibleBuildingComponentClass and though next class would be SCR_DestructibleBuildingComponent itself
All in all I'm trying to understand how I can do visual debugging
I see it now, its called in _WB_AfterWorldUpdate of SCR_DestructibleBuildingComponent
in general you can just do it on each frame event and draw diags there. we "usually" make a diag system that components connect to, just so that the game runs ever so slightly better during diag debugging, but if it is temporary you can just use onframe event.
No clue if this is fixed in your version of the IDE but in ours current #else does not actually verify if the codes errors
#ifdef WORKBENCH
if (m_BGrenadeDropped && m_DropperSlot.GetAttachedEntity() != null)
SCR_EntityHelper.DeleteEntityAndChildren(m_DropperSlot.GetAttachedEntity());
if (!m_BGrenadeDropped && m_DropperSlot.GetAttachedEntity() == null)
{
IEntity newGrenade = GetGame().SpawnEntityPrefab(m_DropperGrenade);
m_DropperSlot.AttachEntity(newGrenade);
}
#else
if (RplSession.Mode() != RplMode.Client)
{
if (m_BGrenadeDropped && m_DropperSlot.GetAttachedEntity() != null)
SCR_EntityHelper.DeleteEntityAndChildren(m_DropperSlot.GetAttachedEntity());
if (!m_BGrenadeDropped && m_DropperSlot.GetAttachedEntity() == null)
{
IEntity newGrenade = GetGame().SpawnEntityPrefab(m_DropperGrenade);
m_DropperSlot.AttachEntity(newGrenade);
}
}
#endif
For example in this in the #ifdef WORKBENCH the IDE see the error in SpawnEntityPrefabe that I have not done Resource.Load(), but in the #else block it says the code is fine.
Obviosuly it can be picked up in my personal testing but this can allow people to submit code that intentially crashes the game
Or unintentionally
In my case haha
This works with even more egregious errors as the IDE does not seem to check it at all, I can remove semicolons and even pass methods without the propper variables in them
I mean, that is how defines work
Search about preprocessor directives on the internet
Can I not programatically edit the bounding box trigger? There's only methods for changing sphere radius.
Yes it is, but the name isn't changing color when the faction changes.
Can an entity inside a prefab be marked to be server only somehow? Is this a thing?
I don't thing so, I've had the same issue(ish)
ended up just creating the entitiy locally with a script SpawnEntityPrefabLocal and AddChild
When is "faction" retrieved? What color is the text being set to (or what is it by default)?
you saying when the faction changes makes me think the script you showed is working but you need to update the faction variable
Otherwise there is probably a GetFaction method which might be more reliable to get the right faction.
Is there anything you can do with VolumeEntity at this point? No getters, nothing. I remember trying something with it back in 2023 but looks like nothing changed and its unusable.
I see that SCR_DestructibleBuildingComponent uses array of SCR_InteriorBoundingBox which you apparently have to manually input guessing numbers to match the model space, did BI designers really input all these volumes by hand or I am missing something?
It's passed in OnBaseFactionChanged(faction, base). I did also find my old implementation of this last night before I went to sleep. Looks like there I was doing this in SetIconText() so I'll have to review all this again after work tonight.
I was hoping to use VolumeEntity to somehow edit volumes through editor without manual number input. Let me know if its all futile and if BI themselves ended up just typing in numbers, I guess I'll have to as well.
Rn the visual gizmo thing for volumes is not available from scripts in AR
Only from CPP
Also, you can click on the vector property (highlight on title)
And it sill show a normal coords or angles gizmo
No need to type them
dont suppose theres any updates on this https://feedback.bistudio.com/T187707
or is there a workaround, possibly adding a SCR_EditorActionsManagerComponent to the entity?
i dont think it lets me add one if theres already an ActionsManagerComponent tho
Oh, nice! Scale doesn't work though.
VolumeEntity has visual gizmo for editing it but it seems you can't get that resulting volume out of it from script.
Oh nevermind you meant exactly that, no access from scripts right now. Sad.
vector points[2] = {
{1,2,3},
{4,5,6}
};
```=>```
SCRIPT (E): execCode(1): error: Array initialization of non-array type 'vector'
SCRIPT (E): execCode(1): error: Array initialization of non-array type 'vector'
```What would be the proper way to do this?
Try
vector points[2] = "1 2 3", "4 5 6";
Nope. Also tried inline cast (vector) and it made no difference
vector points[2];
points[0] = "1 2 3";
points[1] = "4 5 6";
not pretty but it works
How does attach entity work in replication with the slot manager component
Has anyone run into trouble with this as whenever I try to attach an entity in runtime it teleports to the actual location but never follows the parents movements


