#enfusion_scripting

1 messages · Page 9 of 1

red cedar
#

i'm not sure that i'm looking at but adding [RplRpc(RplChannel.Reliable, RplRcver.Broadcast)] over a signature signal that when the method is Rpc called this function will be called on all proxies.

and Rpc(RPC_SendMsgToClients, msg, msgType); - This triggers the RPC call does the Rpc call.

rotund kraken
red cedar
# rotund kraken i am down a rabbit hole at this point lol. how do you send a global message in-g...

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);
    }
rotund kraken
gentle cradle
#

Does anyone know how to remove the WCS primary and launcher configuration to carry 2 primaries?

dire sinew
red cedar
rotund kraken
red cedar
# rotund kraken I am still a bit confused. I am basically trying to send a message in global cha...

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.

rotund kraken
#

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).

red cedar
rotund kraken
red cedar
# rotund kraken 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);
    }

rotund kraken
lofty pumice
#

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.

dark ocean
lofty pumice
#

yes but where is the function called in the first place

#

in my mind is that i have to Call OnPlayerKilled

dark ocean
#

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++

lofty pumice
#

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?

dark ocean
#

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)

dark ocean
lofty pumice
#

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

dark ocean
#

no worries, glad to help

ocean kernel
#

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

lean yew
#

How to check if a player (the current) is a leader of a squad? (preferably returning a bool)

red cedar
ocean kernel
#

Yeah same

desert escarp
#
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
desert escarp
pliant ingot
desert escarp
#

It's just pulling the attribute

#

The registration of the bag is handled in the gamemode and that is working

#

Added that line sorry

pliant ingot
#

how looks log script?

#

looks like you entity just not replicated

#

to client

desert escarp
#

Its a default alice bag

pliant ingot
#

because server is not streaming it to him

desert escarp
#

Thats what Replication.FindItem checks

#

This bag is 100m away from him

pliant ingot
desert escarp
pliant ingot
#

Do this in prefab

#

override it in your addon and add your component

desert escarp
#

Magically fixed

#

Enfusion is an enigma

pliant ingot
desert escarp
#

Yeah ofc its just for testing

ocean kernel
red cedar
tiny pilot
#

I'm not even sure that the question is correct 🥲

ocean kernel
#

What are all the allowed characters in class names?

half patio
#

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 ?

torn bane
half patio
#

[HELP] Script Troubleshooting

humble saffron
#

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.

torn bane
humble saffron
# torn bane are they actually part of the prefab hierarchy? do all of the entities in it hav...

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.

half patio
static vale
#

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();
        }
pliant ingot
toxic bear
#

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

red cedar
#

also, hello. been quite a bit since i talked to you @toxic bear

toxic bear
#

Hey Kitty .. ye but you know .. I watch here and there still .. out of the bush blobdoggoshruggoogly.
You do great btw

red cedar
half patio
#

Hey everyone, is there any videos online that talk about adding scripts to prefabs ? Like already made structures etc ?

half patio
#

Help merging a mod from workshop to my world

half patio
#

would someone be able to jump in call with me and help me test my scripts out, im not understanding ai spawning at all

fervent stirrup
#

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
    }
  ]
}
torn bane
fervent stirrup
#

I can do it with another Json container and then ToString it into a string array but then it escapes everything inside.

torn bane
#

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

fervent stirrup
#

And auto read will do the same situation with testAuto

#

But manual read will instantiate and set

fervent stirrup
torn bane
#

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

torn bane
fervent stirrup
#

Soon(TM)

#

Whats the drawbacks of JsonApiStruct then?

torn bane
fervent stirrup
# torn bane

But that will only work if using SerializationLoad/Save the manual way

torn bane
#

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.
fervent stirrup
#

Ahh so its fixed

torn bane
#

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

fervent stirrup
#

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...

ocean kernel
#

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

fervent stirrup
ocean kernel
#

Ur welcome

ocean kernel
#

It stops working without you even interacting with it, on busy servers

torn bane
#

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

fervent stirrup
# fervent stirrup I have a way... but it involves me generating the code for context.ReadValue (in...

@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;
    }
ocean kernel
#

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

fervent stirrup
ocean kernel
#

Oh wow

#

You could say the implementation is kind of shallow

fervent stirrup
#

Fixed in an upcoming version but not right now.

fervent stirrup
torn bane
fervent stirrup
torn bane
fervent stirrup
#

The biggest problem however is that the dynamic compiled/LoadScript ScriptModules have a static heap limit of 262kb that can't be increased

torn bane
#

make more modules then 🧠

fervent stirrup
#

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.

torn bane
#

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

fervent stirrup
#

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

fervent stirrup
torn bane
#

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

fervent stirrup
#

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?

torn bane
#

time will tell. so far no plans

ocean kernel
#

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

torn bane
torn bane
half patio
#

does anyone know if the Play Area Boundary entity culls water animations outside its boundary ?

silver acorn
#

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 😄

solid hearth
#

Worry 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 madgecry

#

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

silver acorn
ocean kernel
#

Lol I wish this game was documented as good as C manuals

silver acorn
solid hearth
#

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. AngryShrug

silver acorn
dark ocean
solid hearth
#

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 Worry

dark ocean
# solid hearth Pretty much ^ After so long though a lot of things blend together and it's easy ...

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.? 🤨

serene fox
#

Hi, if i like to predefine such Bounds for a character, what should the vectors looks like?

        vector mins, maxs;
        entity.GetBounds(mins, maxs);
ocean kernel
#

from experience working on my mechs, the bounds remain the same regardless of what buttons I press

silver acorn
#

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

red cedar
#

also, related but kind of unrelated question. Saving to a file doesn't work on console right ?

silver acorn
#

its a pain

silver acorn
red cedar
tough cave
#

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

ocean kernel
#

Is there a way to determine which mod a prefab is from?

azure bobcat
#

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

boreal swan
# azure bobcat Can anyone lend me a helping hand? I know some java + a few other languages, so ...

I'm an Enfusion noob too, so take my advice with grain of salt, but here are some possibly useful links:

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

red cedar
ocean kernel
#

No, that's the GUID of the prefab

red cedar
#

Oh :(

azure bobcat
#

couldnt find anything helpful in that regard

boreal swan
red cedar
#

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)

azure bobcat
azure bobcat
# red cedar Look into the playermanager

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

red cedar
# azure bobcat And how do i find it? or how do i use it, like i said, i cant even get a hello w...

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.

azure bobcat
#

:/

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

atomic kiln
#

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?

half patio
#

@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 ?

half patio
midnight talon
half patio
#

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

midnight talon
#

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

half patio
#

yeah true. idk im at a lose cause i dont wanna create my own map, i just wanna plug my scripts into everon lol

midnight talon
#

If your scenario will use AI then probably a good idea to delete any AI spawns outside your play area

#

Same for vehicles

atomic kiln
#

we can use batch in tools?

half patio
#

no

#

you run it as a .py to grab the file names

atomic kiln
#

oh

half patio
#

itll make a log and boom you have a list of .et

atomic kiln
#

but I need it to be very recursive

#

for all the weapons and gear in the dependent mods, to get all that into one

half patio
#

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

atomic kiln
#

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

half patio
coral stirrup
#

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

midnight talon
# coral stirrup 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

coral stirrup
#

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

midnight talon
coral stirrup
#

atm im just switching back after a 100ms delay

#

but if that doesnt work yeah I can just hook into close inventory

coral stirrup
#

and credit to our good mate Claude for the idea

torn bane
dusky latch
# azure bobcat Can anyone lend me a helping hand? I know some java + a few other languages, so ...

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 😄

ocean kernel
#

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

torn bane
ocean kernel
#

I have vscode autocomplete with entire vanilla codebase and would be cool to have a compile button

atomic kiln
atomic kiln
desert escarp
#

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

ocean kernel
#

You'd have to scale it every frame

errant wren
#

How do I point at specific hitzones in an array and return only the ones in a destroyed state?

ocean kernel
fervent stirrup
ocean kernel
#

Copy paste

teal vapor
fervent stirrup
ocean kernel
ocean kernel
teal vapor
ocean kernel
teal vapor
#

ah

ocean kernel
#

I've been thinking about this too much

teal vapor
#

no that repo is just to suggest a way to read the scripts out o fthe packed game files

ocean kernel
#

yeah I saw the online demo it looks amazing

teal vapor
#

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

ocean kernel
#

All I did for my crappy plugin was parse everything with the world's worst regexes

teal vapor
#

hey if it works it works

ocean kernel
#

But I don't want to commit to it until I can actually compile (remotely, via net api)

teal vapor
#

for the compile step, does that just validate script syntax + type checking and compile to a pak file?

#

there's no intermediate bytecode right?

ocean kernel
#

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

fervent stirrup
#

But we don't see it

fervent stirrup
teal vapor
#

right it probably gets JIT (to the intermediate not native)

ocean kernel
fervent stirrup
ocean kernel
#

Yeah I did that and it still complained

narrow aspen
#

hey guys, what function I can use to send UI messages to player screen in conflict mode?

errant wren
#

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?

half patio
#

i feel like this apart of scripting but im trying to fix this ui being so close together

narrow aspen
# high hawk 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.

narrow aspen
#

I forget to change the system from "server" to "both". Now it works.

atomic kiln
#

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

half patio
#

is there a function in the game where if players go into a entitty set up with a radius that they die instantly ?

toxic bear
dusk python
#

how can i see my Sphere radius , Trigger action dont seem to work when i pass through ?

half patio
half patio
dusk python
#

nothing happens when i press draw shape

half patio
#

It will when you run the world

#

Crtl save and f5

dusk python
#

see it ! thanks

toxic bear
#

Terrain size X, Y + Treshhold = Your Radius

half patio
toxic bear
#

Thats heavy 🤣

#

I would be to lazy if you place them manually .. hell nah

visual widget
#

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);
}

}

desert escarp
#

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

toxic bear
late locust
#

Replication streaming is only for proxies right? So I cant force stream out an entity for e.g host & play?

narrow knoll
#

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.

late locust
narrow knoll
late locust
#

Yeah dont add the vanilla ranks again in your modded file, like PROPS, AI etc..

narrow knoll
#

Perhaps I am not following what is being said.

narrow knoll
late locust
#

Exactly

narrow knoll
#

Did exactly that, still there

late locust
#

What does the error say

narrow knoll
narrow knoll
late locust
#

In what folder (path) is your modded file?

narrow knoll
#

can I show you via video?

#

That way you see exactly what I have.

#

Fleet UI Overhaul\scripts\Game\EntityCatalog\EntityCatalogEntryData\SCR_EntityCatelogSpawnerData.c

narrow knoll
narrow knoll
late locust
#

Check dm

late locust
#

Works now after remaking the script with a different name

static vale
#

This return vector zero on a dedicated server :/

ocean kernel
#

Ouch, I imagine map doesnt exist on server since it doesnt have UI

static vale
#

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
static vale
ocean kernel
#

Hm not sure but bounds probably isnt the right thing to check

late locust
#
SCR_MapEntity mapEntity = SCR_MapEntity.GetMapInstance();
Print("X: " + mapEntity.GetMapSizeX());
Print("Y: " + mapEntity.GetMapSizeY());
static vale
queen sigil
#

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.

ocean kernel
#

Though tbh the map entity should be there on server

static vale
#

actually i only tried size let me try x/y

late locust
#

Did you try with mapEntity?

desert escarp
#

Is there a difference between the workbenches playing a scernario and the games?

#

And if so how to I distinguish that

narrow knoll
open pier
narrow knoll
#

Apparently I have a syntax issue

narrow knoll
#

I tried adding and removing the last syntax. I don't know what the issue is

#

Either way the problem persist

minor agate
#

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

narrow knoll
minor agate
#

Post it here

narrow knoll
minor agate
#

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?

narrow knoll
#

Yes

minor agate
narrow knoll
#

Trying to learn

minor agate
#

It will show you visually how it works

minor agate
# narrow knoll 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

minor agate
#

From Introduction of Modability of Enforce Script classes. and below

minor agate
narrow knoll
#

Where would I find the abbreviations for the ranks?

#

or is that mod specific?

half patio
static vale
hallow portal
#

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?

ocean kernel
#

shooting people through walls is perfectly fine in this game

hallow portal
# ocean kernel 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

ocean kernel
#

Wow thats weird, but are you sure this works in reforger? since all weapon fire and hitreg is serverside

hallow portal
ocean kernel
#

Yeah with a wallhack and sufficiently high caliber it might be easy

abstract crescent
#

How to activate #define in code ? I tried to add define in Workbench->Options->GameProject->Configurations->workbench->Defines, but it ignores that

fringe prairie
abstract crescent
#

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?

late locust
#
#define MY_DEFINE
void Func()
{
    Print("Func start");

    #ifdef MY_DEFINE
        Print("Hello from my define");
    #endif 

    Print("Func End");
}
abstract crescent
abstract crescent
#

I dont want restart workbench every time and change startup parameters to activate/deactivate define

toxic bear
fringe prairie
toxic bear
abstract crescent
fringe prairie
#

@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

abstract crescent
#

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 thonk

torn bane
fringe prairie
#

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.

torn bane
abstract crescent
# fringe prairie How can I add the ability to name config objects - or create a parameter which d...

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;
    };
fringe prairie
#

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.

thick kelp
#

Hi, what is the best way to get an array of IEntity containing every spawned vehicle ?

ocean kernel
#

maybe poke the editable entity registry

thick kelp
#

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 ?

torn bane
abstract crescent
midnight talon
abstract crescent
#

Do layers support drag and drop system?

devout shale
#

How do i move a character into a vehicle?

sleek moat
#

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

ocean kernel
#

Basically, yes

sleek moat
#

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

ocean kernel
#

You need to create it yourself

#

I need to keep the labels

sleek moat
ocean kernel
#

Yes create your class/struct/whatever and save it to a file

high hawk
#

Anyone else light entitys just randomly stop working in WB?

slender jasper
#

Anyone what this error is

high hawk
slender jasper
#

Any recommendations 🙏🏽

pliant ingot
#

And in this case it's somewhere in ZEL_PlayerUIDComponent

slender jasper
#

It’s a prefab it should work without me having to change it ?

sleek dove
#

It is probably because you are sending RPC before EOnInit of RplComponent which inserts it into replication

coral stirrup
#
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

fringe prairie
#

Enfusion is yelling at me and saying cast to world is not supported, you ever figure it out?

pliant ingot
#

It's wired but it's how bis supposed to do this

shadow oxide
pliant ingot
minor agate
#

@shadow oxide

#

World is a special pointer, so it needs a special cast

#

unfortunately

#

This also can be used for World

shadow oxide
#

That one looks familiar, i think its probably what I used too

minor agate
#

World castedWorld = ChimeraWorld.CastFrom(world);

ocean kernel
#

u mean castWorld

fringe prairie
minor agate
tough cave
static vale
#

i'd like it to be dynamic for any map

spark otter
#

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.

static vale
spark otter
ocean kernel
#

Get world bounds shows bigger size than the terrain but the roads stuff might save you in your case

dark ocean
#

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

dire sinew
#

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.

mild quarry
#

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?

half patio
#

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?

fringe prairie
half patio
#

well if i can fully replace it then that would be amazing

fringe prairie
#

I'm making sure because you can still override certain parts of it if you want

half patio
#

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

fringe prairie
#

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.

half patio
#

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

minor agate
#

They get automatically read from the Script folder (Each module reads it's own folder).

half patio
#

yeah but my problem is i can create the script but not type the modified version inside it ?

minor agate
half patio
#

yes the SCR_CaptureAndHoldTeamScoreDisplay.c script

minor agate
#

Did you also name it SCR_CaptureAndHoldTeamScoreDisplay.c?

half patio
#

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

minor agate
half patio
#

i guess i shouldnt have done that ?

minor agate
#

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

half patio
#

thats my current file path atm

minor agate
half patio
#

im guessing its this one ?

minor agate
#

Also modded classes are seen in Animation #3 too

half patio
#

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

minor agate
#

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

minor agate
half patio
#

true ? i guess tomorrow ill be watching everything on that playlist lol. lots of studying in the days/weeks to come haha

ocean kernel
#

man I wish there was an easy way to spread a foreach loop in chunks across multiple frames

fervent cedar
#

Just not really there yet with a good standard solution

#

maybe in arma reforger 2?

ocean kernel
#

rn I have to write like 3 methods, enter, step and end I guess and two variables: data array and index

minor agate
#

No need for structures or anything else

#

no methods needed, no new containers, nothing

ocean kernel
#

some stuff is needed to tell the stuff waiting on the processing how much was processed and when it's over

minor agate
#

pivot instances were processed

ocean kernel
#

yeah but I need to let the client know that

#

but its fine I'll do the boilerplate

minor agate
#

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

ocean kernel
#

Yeah which is why your arsenal crashes people

minor agate
#

Arsenal is not mine

#

But i do not know how it is made, only certain things I know

ocean kernel
#

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

minor agate
#

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

ocean kernel
#
foreach (int index, ArsenalItem item : m_Items) {
  GetGame().GetCallQueue().CallLater(RenderItem, false, index+1, item);
}

Done

minor agate
ocean kernel
#

If your callqueue is inefficient it's your fault

minor agate
#

I mean, modders misuse of it is our fault.

#

We better remove it

ocean kernel
#

by the way are those guaranteed to be sequential? if I dump 100 of those in there will they all run in that order?

minor agate
#

Jokes aside

#

If you are doing it every frame, be careful with call later

minor agate
ocean kernel
#

Yeah

minor agate
toxic bear
ocean kernel
#

Bro its highlighted

toxic bear
#

Must be phone version then not doing it .. mb

half patio
#

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 ?

tough cave
# spark otter I do it in my mines remixed mod. Just get all roads and then you can get all poi...

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.

ocean kernel
#

is there a simple way to not allow player to fire weapons?

tough cave
#

CharacterFire actionmanager thing

half patio
ocean kernel
#

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

half patio
#

iv seen this around lately, hopefully this helps

tough cave
#

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.

ocean kernel
half patio
#

nope, i just found it awhile ago when i was searching google for code related crap

#

whys that

ocean kernel
#

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

half patio
#

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 ?

fringe prairie
ocean kernel
#

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

mild quarry
#

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

ocean kernel
#

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

tough cave
#

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.

late locust
dark ocean
#

@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.

fringe prairie
ocean kernel
#

10 smaller scripts vs 1 bigger script not sure there's a memory difference

#

everything is compiled anyway?

fringe prairie
#

Wasn’t sure if the file was garbled data or a real project lol, assumed the former

dark ocean
#

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++

dark ocean
fringe prairie
#

Yeah I was worried about one of my files that has a lot of classes in it.

dark ocean
#

ah you meant that everything needs to be compiled after all, regardless of what file it comes from

shy steeple
shy steeple
#

DRMbros it is over...

dark ocean
shy steeple
#

Otherwise where is the DRM if people can read and copy your code?

dark ocean
# shy steeple If you can read a single line you can process your file without running out of R...

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)

fervent cedar
# ocean kernel is there a simple way to not allow player to fire weapons?

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);
minor agate
dark ocean
ocean kernel
ocean kernel
#

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

minor agate
#

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.

fervent cedar
#

copyrighted filename

ocean kernel
#

arma.c

minor agate
#

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

ocean kernel
#

I did explain the use case

minor agate
#

Its not allowed but it is tolerated. But its becoming such an issue that its going to be gone soon

dark ocean
#

I fail to see how is that obfuscation. the code can be inspected freely

minor agate
#

They dont need to understand it

#

Its what always hapoens in a3, dz and here

#

Its useless

dark ocean
#

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

minor agate
#

Also makes it harder for us to see if there is ip rights issue in there

#

So it will be banned

minor agate
#

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

fringe prairie
#

Did you ever fix this by chance?

solid hearth
minor agate
#

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

minor agate
#

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 😅

spark otter
#

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 🤦‍♂️

midnight talon
#

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

minor agate
#

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

midnight talon
#

ah ok

minor agate
#

If anything, solution should be something else.

midnight talon
#

I've seen it used as a kind of DRM in other mods so figured that was expected

#

(sealed class that is)

minor agate
#

Not repurposing some tool that was never aimed for that intent

midnight talon
#

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

minor agate
#

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.

midnight talon
# minor agate It seems that DRMs are used by mod teams that aim to have their own servers, bre...

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

minor agate
#

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.

midnight talon
minor agate
#

There are many reasons why we do not provide it, nor enforce it for you.

minor agate
#

IDk why people keep thinking that

#

We have behavior clause on the EULA and ToU

#

You can report that.

midnight talon
#

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?

minor agate
#

Talk to the owner of the server, if they do not comply. Then report it.

#

They are also subject to the behavioral rules

midnight talon
#

Yeah so sounds like retroactive whack-a-mole is the only option

minor agate
#

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

midnight talon
#

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 🙂

minor agate
#

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.

minor agate
#

Not only for reports, but for active checks

midnight talon
#

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

minor agate
fervent stirrup
#

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).

river imp
minor agate
#

And no. You are not getting drms from us.

fervent stirrup
minor agate
#

Or breaking the game which already lands you with a ban.

fervent stirrup
#

And where does ScriptModule use stand here?

#

It's currently the only way of server side hidden code.

minor agate
#

That is not a drm

#

Your code being on server only is not a drm

fervent stirrup
#

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?

minor agate
#

And malicious mod is the part that really lands you with the perma ban

minor agate
#

You can have a DRM of sorts that does not land you on the malicious part

fervent stirrup
river imp
#

"Have in your mod license stated that only x servers can use your mod."

fervent stirrup
minor agate
#

Its doing ehat i said

#

Its custom license.

#

Meaning they can add what they please.

fervent stirrup
river imp
#

Maybe I misunderstand what you said.

#

Sounded like you said that was considered DRM

minor agate
fervent stirrup
river imp
#

So i'm free to release my mods with a license only allowing myself to use my mods.

minor agate
#

DRM is not crashing the game

#

Some do, some dont

fervent stirrup
minor agate
river imp
#

That's the approach all modders should take then

minor agate
#

If you disable it but it causes the game crash on purpose then it is not allowed

fervent stirrup
minor agate
#

(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

fervent stirrup
minor agate
#

There are no exeptions to this

minor agate
fervent stirrup
#

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

minor agate
#

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.

fervent stirrup
#

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.

minor agate
#

People usinf APL, APL-SA and APL-ND have blocked the monetization by default given the non commercial nature of the license

minor agate
#

Its down to the licenses.

fervent stirrup
#

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.

river imp
fervent stirrup
# river imp There's also 0 reason server "hosts" should be allowed to get donations based of...

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.

river imp
fervent stirrup
river imp
#

Good

minor agate
fringe prairie
minor agate
#

Ans having it on server, is usage of it

#

So. It affects it

river imp
#

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.

fervent stirrup
river imp
#

That was my point, the mod being on the server effects the number of players and the likelyhood of donations.

fringe prairie
fervent stirrup
river imp
minor agate
#

Its more that those licenses limit the whole environment. Rather than limiting it's features for this.

river imp
#

As they should because people literally only join servers based on the mods that they are using.

#

Unless it's some niche community.

fervent stirrup
#

@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).

mild quarry
#

Anyone know if there is an API or way to detach a magazine from a gun? Doesn't seem possible to me

fringe prairie
fringe prairie
#

What have I done

red cedar
ocean kernel
#

Whats the point in monetization of modded content if modders cant get a cut

red cedar
#

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

ocean kernel
#

I mean licenses are binding by default so that's not a very hot take

fervent stirrup
# red cedar I can see both side of the argument, if they allow monetization for modders then...

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.

ocean kernel
#

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.

fervent stirrup
solid hearth
# minor agate A bad variable is very different than making a method call 100x other methods wi...

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.

ocean kernel
#

how would I go about populating a list of entities in entity browser from script instead of config?

tawny lotus
#

With ResourceDatabase.SearchResources ?

ocean kernel
#

Sorry I mean in GM entity browser

#

Like populate runtime

#

When the user browses stuff

fervent cedar
#

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

pliant ingot
fervent cedar
#

Would this be bad? Because I understood the markers right now kinda function liek that?

fervent cedar
#

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

ocean kernel
#

having markers entities is great because you can pull in their origin and put it on the map easy

fervent cedar
#

Yes but is there a reason they only do 10 markers per client? hmmyes

ocean kernel
#

but add collision to them so that it randomly trips vehicles over

pliant ingot
ocean kernel
#

better yet, they could spawn actual marker meshes where they are placed like minecraft signs

fervent cedar
#

almost

pliant ingot
fervent cedar
#

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.

pliant ingot
#

if you bump entity - it will send entire it's data

#

not just single updated variable

fervent cedar
#

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

coarse pasture
#

Anyone happen to have a script to delete a dir or at least all a dir's contents handy?

pliant ingot
#

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

pliant ingot
fervent cedar
#

server creates entity shop_item -> server sets data -> rpl.bump

#

x 10000

pliant ingot
#

And also - how many clients receive non-relevant updates?

fervent cedar
#

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.

fringe prairie
#

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

eager jackal
#

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.

fervent cedar
#

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||

eager jackal
#

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.

fervent cedar
#

still more work than entity and rplprop

eager jackal
#

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.

fervent cedar
#

hmmyes 👌 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

eager jackal
#

probably CPU killer and probably all Rplcomponents and entities are in a foreach loop every frame
Pretty sure that's not the case. 😄

fervent stirrup
#

Is the model that each item is an entity and you're sending the data for all the items to the client?

fervent cedar
#

idea is that I just spawn all the entitiy in and set RplProps and no streaming, just replicated

#

minimum effort

#

global rpl

eager jackal
#

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).

fervent stirrup
fervent cedar
#

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

fervent stirrup
#

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.

fervent cedar
#

no that's more work

fervent stirrup
#

So your catalog model consists of 10k entities in the world?

fervent cedar
#

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

half patio
#

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

fringe prairie
#

@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?

half patio
#

I’m just tryna add a 3rd team scoreboard and a time limit till next rotation of zone

half patio
#

Someone able to collab with me to get this working ?? Genuinely need help with it

late locust
#

Why does owner.ClearFlags(EntityFlags.VISIBLE, true); not work for characters on proxy? (Vehicles work) thonk

#

nvm I didnt apply to prefab meowfacepalm

sleek moat
#

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?

timid citrus
#

Probably including making your own game mode.

quiet drift
#

Hello, Is this necessary to do "RemoveActionListener" in "OnControlledEntityChanged" of PlayerController ? I use few times "AddActionListener" in "UpdateLocalPlayerController"

devout shale
#

why does my AI move faster when my waypoint is farther away

fervent stirrup
#

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

spark otter
#

or for example, to delete all json files in that directory: ```c
FileIO.FindFiles(files.Insert, "$profile:DirectoryToDelete/", "json");

untold trench
#

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?

spark otter
worn spire
#

Joe does anybody want to play with us

#

Does anybody want to play with me

#

I got Roblox fortnite and Xbox

untold trench
spark otter
#

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.

untold trench
# spark otter maybe? Whatever your action is, probably gets a variable on the server that you...

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

spark otter
untold trench
#

Sadly there are none :/ so I'll keep looking, thanks tho

neat wolf
#

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".

sleek moat
# fervent stirrup Either it's missing a field or it's related to my discussion with Arkensor here ...

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

ocean kernel
sleek moat
fringe prairie
#

@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?

ocean kernel
#

Maybe you could extract the model/prefab and spawn that instead

late locust
#

Do these flags even do anything? Should this do something like owner.ClearFlags(EntityFlags.VISIBLE, true); or are these different flags?

desert escarp
desert escarp
#
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();
late locust
#

the line number might not be correct every time

late locust
torn bane
timid citrus
#

Whats proper current way to get date and time?

red cedar
#

I think there is a function for that in System.c

fringe prairie
#

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.

desert escarp
valid anchor
#

Is there a most efficient/streamlined way to mod player stamina?

Or do I have to create script + custom stamina component for base character?

remote musk
desert escarp
#

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

fringe prairie
#

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

solid hearth
timid citrus
#

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?

fringe prairie
solid hearth
#

Squad leader markers behave differently than normal markers.

fringe prairie
#

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

desert escarp
fringe prairie
#

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

fringe prairie
torn bane
desert escarp
#

That still sucks cause there's no need for a player 5km away to have to track that drones positional updates

solid hearth
fringe prairie
sleek moat
#

Can you post code for your reading?

minor agate
woeful hull
#

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:

  1. I made a script file in Workbench, put it in the right module folder (I think).
  2. I set up a NPC in the World Editor and slapped a Script Component on it.
  3. But, I’m not really sure how to make my script actually work with the NPC, like for interactions or dialogs.
dusky latch
#

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

dire sinew
# dusky latch Hey Team im looking to play an animation during a user action I have found in th...

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.

minor agate
high hawk
#

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...

timid citrus
desert escarp
#

Is there a component I can add to a prop that tracks damage from a bullet?

timid citrus
#

Something like that

desert escarp
#

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

spark otter
#

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.

fringe prairie
spark otter
#

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()

fringe prairie
#

It looks like it should

craggy jolt
#

What diag menu setting do you enable to call component's DrawDebug?

torn bane
craggy jolt
#

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

torn bane
#

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.

desert escarp
#

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

minor agate
#

Search about preprocessor directives on the internet

slate raft
#

Can I not programatically edit the bounding box trigger? There's only methods for changing sphere radius.

spark otter
craggy jolt
#

Can an entity inside a prefab be marked to be server only somehow? Is this a thing?

fervent cedar
fringe prairie
#

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.

craggy jolt
#

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?

spark otter
craggy jolt
minor agate
#

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

coral stirrup
#

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

craggy jolt
craggy jolt
#

Oh nevermind you meant exactly that, no access from scripts right now. Sad.

craggy jolt
#
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?
desert escarp
#

Try
vector points[2] = "1 2 3", "4 5 6";

craggy jolt
#

Nope. Also tried inline cast (vector) and it made no difference

desert escarp
#

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