#enfusion_scripting

1 messages · Page 21 of 1

minor agate
#

Not to avoid it

midnight talon
#

yeah but modding in WB you have pretty good control over load order (aside from nested dependencies). If a mod I depend on breaks due to that then it can be fixed, if a mod loaded after mine its overrides should take precedence right?

minor agate
#

Scripts do not use that at all

#

Scripts is based on alphabetical order starting from their script module being compiled

#

Respecting dependency order in scripts is insanely troublesome because of the hoising behabior we have on it

midnight talon
#

ah right it's all based on FS paths forgot about that

minor agate
#

Otherwise you would have to do includes yourself and so

#

complicating the thing even more

#

before you had to do includes, that is why .h (Header files) were supported a long time ago

#

You could create your inferface on a headfile, then the impl in a CPP way on .c files

#

A bit of script lore here

#

:p

#

Even before that

midnight talon
#

Yeah right considering that the dependency management / hoisting isn't deterministic makes a lot more sense why it would cause problems

minor agate
#

it was very similar to c in style

#

no classes even

#

and even before that, it was just instructions just a bit higher level than assembly

midnight talon
#

Is there any possibility in the future of Enfusion getting deterministic dependency management like most popular runtimes / language toolchains do?

midnight talon
#

Yeah

minor agate
#

It's deterministic

#

just on alphabetical order

#

It will always be the same

#

But we do see the values of making it work with resource db dependency resolution

#

Issue is that the whole of scripts do not use that

#

That is why script files do not have meta files

midnight talon
# minor agate It's deterministic

Every time servers check for mod updates they update everything to latest version on workshop, so it makes using dependencies quite brittle if they update and introduce breaking changes before consuming mods are updated to support them.
Having a proper dependency manifest format like Rust's cargo.toml or Node's package.json that allows us to pin dependency versions would give a way to express dependencies deterministically and prevent core dependency updates (e.g. EPF) from breaking live servers while still allowing other stuff less likely to cause issues to auto-update

minor agate
#

You can set on your server config which specific mod version to use

midnight talon
#

At the mod level?

minor agate
#

No

midnight talon
#

Oh yeah I know about server config

minor agate
#

That we are not giving

#

It will cause ton of issues for us

midnight talon
#

that's not really ideal though, are we supposed to just wait for our mods to break then reach out to everyone running servers for them telling them to update their config and pin a dependency version?

minor agate
#

and go into some dpendency hell and back to A2 days even when trying to get non savvy players to play something

#

So we prefer to force everyone to latest

#

even if it means archiving a mod

#

We also do not host all mod versions

#

only the last 30 versions of a mod

midnight talon
#

There's gotta be a more proactive solution to it than just waiting for everything to explode and scrambling to help server owners fix their configs

minor agate
#

EXP

#

Experimental

#

issue is that only 1% of modders use it

midnight talon
#

experimental is really only relevant for vanilla changes, not dependency mod changes

minor agate
#

Workshop is for final distribution of "a finalized product"

midnight talon
#

I'm talking about when a mod your mod depends on (e.g. EPF) makes breaking changes, right now the only real solution is tell server owners to fix their config

minor agate
#

it's not for testing or so

#

So if you are a dev, using a mod and that matters. Workshop is to the platform for it

#

Mods are not designed to be used as libraries

#

So that is why it behaves like this

midnight talon
minor agate
#

Main problem we see, is deprecated lists point to unexistent mods at that some point

#

Or mods not updating for players, and still causing crashes because of that

#

So safest option, is to force everyone to update.

#

or players having to redownload a mod multiple times

midnight talon
minor agate
#

(Just to clarify, we are not closed to it. We just see it risky player and modder wise)

#

THis is a never ending problem and why in many dev stacks there is infinite amount of package managers and dev environments that try to sort the same thing

#

We woudl like to avoid a Python sistuation for example

midnight talon
#

If my mod is depending on an ancient/unpublished/banned dependency then that's entirely on me to fix especially since I probably had tons of time to do it. But if my mod is depending on a mod that pushed a breaking update overnight and the previous version is still hosted I don't see why I shouldn't be able to point my mod to the previous compatible version so it at least still works out-of-the-box for everyone trying to play it until it's properly updated to support the new dep version

minor agate
#

It might easily be purged

midnight talon
minor agate
#

with no alternative on how to get inside workshop

#

and if the other mod broke

#

and updated

#

on game update. then probably is also broken / crashing the game

midnight talon
#

really it would function no different to how pinning mod versions the server config works, just from the mod .gproj level instead

solid hearth
#

When it comes to versioning I am of different mind, it's always going to be on server operators worryPensive

minor agate
#

See it from player side

#

If mod A updated because it causes some crashes on new game update

#

and yours has specific mod A version

#

If your mod becomes somewhat popular

#

then you are forcing everyone to old broken version of mod A. Just so that yours compile

#

Then mod A dev, receives the issues and all because of outdated mod forced by yours

#

in many cases modders can't contact others, making the whole problem worse

#

THis is the risky part we see

midnight talon
#

Hmm yeah that's a fair point

#

Could maybe be avoided somewhat with good visibility on when a server is running an outdated mod like a popup warning when joining or something, then players already know when joining that it's using an outdated version of X mod

minor agate
#

Unfortunately players barely read

#

😅

#

Evsn on error dialogs

midnight talon
minor agate
#

But that last issue is the one that always creeps out on us on whatever idea we get for this

solid hearth
long hill
#

Is there anyone here who can help me figure out how to spell out the values ​​in SCR_EArsenalItamType?🥹

midnight talon
long hill
midnight talon
#

or unless you add one that collides with an existing value

#

in general you can just add enum entries and let the compiler/VM generate its underlying value

#

there are already plenty of vanilla enums with wayyy more than 44 entries 😅

long hill
fringe prairie
#

Oh I see

#

bitwise

#

Since it's really 2^32, since they can be combined - why do you need so many types? They are meant to be combined

midnight talon
#

ah right it's one of those bitwise enums

#

alien shit to me 😄

long hill
#

Let's skip the reason why I need that many classes

fringe prairie
#

So there is no reason to have that

minor agate
#

This enum should be made on our side so that it has the bitflag attibute

long hill
#

In short, I am trying to create arsenals for divisions by assigning them unique values.

minor agate
#

That way the pattern is enforced and modding friendly

fringe prairie
#

This is the wrong place probably to identify specific types to that level of granularity

long hill
#

Fk

fringe prairie
#

as (not an arsenal guy), this does not look like the place to separate types of weapons or uniforms, you already have item types for both of those.

#

Well arsenal item types, which seem to be meant to be very generic

#

I can see the intent though, because it would be pretty cool to just tell an arsenal it's X type and use that to spawn your items, but the better (and I mean you aren't losing more time than putting this definition on the items themselves), is making a bunch of arsenal configs with those items separated between each arsenal.

long hill
fringe prairie
#

So you are kind of looking to allow/disallow players from using certain item types

#

Are players all in one faction?

long hill
long hill
fringe prairie
#

Yeah, not sure if there is anything in the base game that will not actively try to destroy you on this quest

minor agate
#

Probably worht to mod the method that fills this in for arsenal

#

GetAllItems or something like that iirc

fringe prairie
#

I haven't dealt with a similar issue at all, but the approach I would initially try is to create editable item component labels EEditableEntityLabel, then mod the arsenal logic to only return the items labeled with the label the player has.

#

Not sure if that's how the arsenal pulls items but that could be a pretty good start, and have the server track what players have what labels. The label search is pretty powerful (can use include/exclude for searching items).

#

Probably better to get all items available to faction, excluding the other team's label, that way unlabeled things can belong to both teams within the faction.

torn bane
midnight talon
#

Yeah filtering by editable entity labels is probably a better approach

#

See SCR_EntityCatalog.GetFullFilteredEntityListWithLabels and usages of it for an idea

#

but in a nutshell you should be able to add all those things you were trying to add as arsenal modes as entity labels instead, then you can call GetFullFilteredEntityListWithLabels with the labels for whatever sets of gear you want to be available in a specific case

lime dew
#

Im new to scripting and im getting this warning, howdo I fix it:

SCRIPT (W): @"Scripts/Game/HVK_MagRepack/Components/HVK_AmmoContainerComponent.c,17": Method not linked 'HVK_AmmoContainerComponent.GetMagazineWell'

minor agate
#

Or you moved your mod from Exp to Stable and the method is not available yet there

#

GetMagazineWell

lime dew
cloud rock
#

Also new here with a question.
Is there a way to test multiplayer code in the workbench with multiple clients? Like if i wanna test that the replication correctly works for authority, owner and proxy. Or do i have to upload a possible fix and test it live?

torn bane
cloud rock
restive island
#

Is the MOB supply regeneration defined in the scripting or mission files? I'm looking to add fuel regeneration for fuel depots

spark otter
#

resource component i would think, at least thats where it is for the classic supply depots in conflict

desert escarp
#

What controls the position of entities for JIPs

#

I am setting the transform on the client and server but JIPs don't see this change

#

I already do

droneComp.ForceNodeMovement(transform[3]);

Which works for the entity being streamed into connected players but it seems tho the position never updates for JIPs unless I am directly setting the position when they join

#

For example
JIP Client

#

Client that moved the drone

#
GenericEntity droneEntity = GenericEntity.Cast(drone);
droneEntity.SetTransform(transform);
droneEntity.Update();
droneEntity.OnTransformReset();
droneComp.ForceNodeMovement(prevTransform[3]);
#

The RplComponent was not set to runtime

forest arrow
#

Hello
SCR_ScriptedUserAction -> CanBeShownScript is running on client or server side?

forest arrow
#

Thanks

forest arrow
#

I have a prefab. In prefab I have ScriptedAction and ScriptComponent

Component stores few variables, like isEnabled
ScriptedAction has CanBeShownScript and CanBePerformed. In both methods, i'm getting this entity, find my ScriptComponent and get var, for example component.GetIsEnabled()

In workbench it works fine, but on server i can see that both methods CanBeShownScript and CanBePerformed didnt executed. Why? I'm looking on entity, its spawned, but methods are not executed to verify can I see action or not (I added logs to see it)

forest arrow
#
class EvacuationDriverToBaseUserAction : SCR_ScriptedUserAction
{    
    string evacKey;
    protected EvacuationUserActionComponent comp;
    
    void SetEvacKey(string key)
    {
        evacKey = key;
    }
    
    override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
    {
        comp = EvacuationUserActionComponent.Cast(pOwnerEntity.FindComponent(EvacuationUserActionComponent));
    }
    
    override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
    {    
EvacuationToBaseHandler.GetInstance().StartEvacuation(evacKey, playerId);
        
        comp.SetIsStarted(true);
    }
    
    override bool CanBeShownScript(IEntity user)
    {
        string playerGuid = GetGame().GetBackendApi().GetPlayerIdentityId(GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(user));
        bool result =  playerGuid == comp.GetRequestor() && !comp.GetIsStarted();
        Print("SteelPath >> Script result: " + result);
        return result;
    }
    
    override bool CanBePerformedScript(IEntity user)
    {
        string playerGuid = GetGame().GetBackendApi().GetPlayerIdentityId(GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(user));
        
        bool result =  playerGuid == comp.GetRequestor() && !comp.GetIsStarted();
        Print("SteelPath >> Script result: " + result);
        return result;
    }
}```
fringe prairie
#

GetGame().GetPlayerController().GetPlayerId()

Player manager will exist only on server. Think of these actions as two simultaneous actions. One executes locally, the other on the server. So unexpected things like this are common especially with component properties. Because the action might execute correctly on server, but the client side doesn't know because your local component didn't do anything. The easiest way to sync state from server and client is via RplProp variable on the component, the action would read the component and that variable

river imp
#

Replied to wrong person.

sonic burrow
#

whats the best way to register chat commands which send something to the server and then back to the client? i have a faction whitelist script ive made. it works, but i cant seem to figure out how to make it so when a user types in /facadd it will add a user to the whitelist. but it seems i am having issue registering the command. does anyone know the function to use and what rpc call i should make?

solid hearth
#

Look into ScrServerCommand

#

It lets you create custom chat commands (which can also be executed via rcon as well) on the server.

ocean kernel
#

Yeah but good luck using RCON in Reforger with how broken it is

#

It will do things like randomly adding 5 seconds of delay to your command, and doesnt follow the protocol it supposedly should (BattlEye RCON)

forest arrow
#

@fringe prairie @river imp Thaks for your answers.
In this case, how I can execute server code, or get server data from client? Rpc() is a void return type, i cant return validation result from server to client.

I have a client method, CanBeShownScript for example. From this method I need to call few server functions and get data from this functions, how I can do that?

long hill
#

Does anyone know how to fix the constant change of base positions in “Conflict” mode?

I have already set the “Affiliation Component” keys, but the bases still change from one another.

long hill
long hill
pliant ingot
#

So... how tf I can get player UID "modernly"?

[Obsolete()]
proto external string GetPlayerIdentityId(int iPlayerId);
sonic burrow
solid hearth
#

Never ran into that, are you returning EServerCmdResultType.OK 🤨

river imp
#

No

#

So result type !=ok

solid hearth
sonic burrow
#

So In this case id get the error for not being an admin, and an error that the cmd doesnt exist

#

which it does

ocean kernel
torn bane
ocean kernel
#

Some weird issues like seemingly content of my static array is available after exiting and entering play mode lol

solid hearth
# sonic burrow ``` if (!mgr.IsPlayerAdmin(playerId)) { FAC_SendCmdRespo...

🤨

class TAG_MyCustomChatCommand : ScrServerCommand
{
    override string GetKeyword() { return "echo"; }
    override bool IsServerSide() { return true; }
    override int RequiredRCONPermission() { return ERCONPermissions.PERMISSIONS_NONE; }
    override int RequiredChatPermission() { return EPlayerRole.ADMINISTRATOR; }

    override ref ScrServerCmdResult OnChatServerExecution(array<string> argv, int playerId)
    {
        if (argv.Count() < 2)
            return ScrServerCmdResult("Expected another parameter like #echo hello", EServerCmdResultType.PARAMETERS);
        
        string message;
        for (int i = 1; i < argv.Count(); i++)
            message += argv[i] + " ";
        
        return ScrServerCmdResult(string.Format("You said: %1", message), EServerCmdResultType.OK);
    }
    
    override ref ScrServerCmdResult OnChatClientExecution(array<string> argv, int playerId)
    {
        return ScrServerCmdResult(string.Empty, EServerCmdResultType.OK);
    }
    
    override ref ScrServerCmdResult OnRCONExecution(array<string> argv)
    {
        return ScrServerCmdResult(string.Empty, EServerCmdResultType.OK);
    }
    
    override ref ScrServerCmdResult OnUpdate()
    {
        return ScrServerCmdResult(string.Empty, EServerCmdResultType.OK);
    }
}
sonic burrow
#

ah i think i was missing ScrServerCmdResult(string.Empty, EServerCmdResultType.OK);

solid hearth
#

Yeah... that's what I was referring to.. The kick/ban command is probably the easiest to look at and see how it should be setup for server actions

sonic burrow
#

thanks, looks like its working

ocean kernel
#

whats the difference between StaticArray and static array?

ocean needle
#

first one is for fixed size arrays looks like

deep temple
#

Hello, I'm trying to dynamically retrieve the content present in a player's inventory.
To do this, I get the list of clothes the player is wearing using SCR_CharacterInventoryStorageComponent.
I then iterate through the clothing items to check whether they contain items. For outfits / backpacks / pants, I can cast the entity to SCR_UniversalInventoryStorageComponent to get the contents. But this doesn't work for vests.

So I cast using ClothNodeStorageComponent but this storage isn’t updated over time and it always gives me the player's starting equipment.

Do you have another class to recommend for dynamically retrieving the content ? Or is my method flawed ?

fringe prairie
#

Search predicates can help find specific items based on components or other things. I don’t have a search pattern easily accessible to me, I think you’d want to look at loadout areas?

deep temple
fringe prairie
#

Yeah loadout areas

#
ChimeraCharacter character = ChimeraCharacter.Cast(playerEntity);
        if (character)
        {
            EquipedLoadoutStorageComponent loadoutStorage = 
                EquipedLoadoutStorageComponent.Cast(character.FindComponent(EquipedLoadoutStorageComponent));
            if (loadoutStorage)
            {
                array<typename> equipmentAreas = {
                    LoadoutHeadCoverArea, LoadoutArmoredVestSlotArea, 
                    LoadoutVestArea, LoadoutJacketArea, LoadoutBackpackArea
                };
                
                foreach (typename area : equipmentAreas)
                {
                    IEntity container = loadoutStorage.GetClothFromArea(area);
                    if (!container) continue;
                    
                    ClothNodeStorageComponent clothStorage = ClothNodeStorageComponent.Cast(
                        container.FindComponent(ClothNodeStorageComponent));
                    if (!clothStorage) continue;
                    
                    array<IEntity> clothItems = {};
                    clothStorage.GetAll(clothItems);
                    
                    foreach (IEntity clothItem : clothItems)
                    {
                        AG0_TDLDeviceComponent deviceComp = AG0_TDLDeviceComponent.Cast(
                            clothItem.FindComponent(AG0_TDLDeviceComponent));
                        if (deviceComp)
                            allDevices.Insert(deviceComp);
                    }
                }
            }
        }```
#

This should get you closer to what you need

deep temple
ocean breach
#

Heyo, please tell me I'm being stupid somehow: I've got the following script, to be attached to an entity as a component. I've attached it to an Entity, I can see it, edit properties etc. However I cannot get the Init function to work. I've got this code:

class SCR_MyComponent : ScriptComponent
{
  override void EOnInit(IEntity owner)
  {
    Print("Hello I'm a test");
  }
};

Anyone have any idea what I'm doing wrong?

ocean breach
#

Can I not use the ScriptComponent/EOnInit like this? I've been trying to diagnos this for an hour but I just can't get it to run

deep temple
ocean breach
#

Also another weird question: I noticed OnPostInit()is being called both after Init, and also after I exit the game. Anyone know why ti's doing that?

desert escarp
# ocean breach Can I not use the ScriptComponent/EOnInit like this? I've been trying to diagnos...

Any method with EOn... in a ScriptComponent has to have it's entity event set in OnPostInit to actually fire

For example,

[ComponentEditorProps(category: "Tutorial/Component", description: "TODO")]
class SCR_MyComponentClass : ScriptComponentClass
{
}

class SCR_MyComponent : ScriptComponent
{
    override void OnPostInit(IEntity owner)
    {
      SetEventMask(owner, EntityEvent.INIT);
    }

    override void EOnInit(IEntity owner)
    {
      Print("Hello I'm a test");
    }
}```
#

Here kind of shows you where each event fits into the entity life cycle

ocean breach
fringe prairie
mild bison
#

Is the JsonApiStruct broken or am I using it incorrectly?

JsonApiStruct obj = new JsonApiStruct();
obj.StartObject("hello_world");
obj.StoreString("message", "Hello from Reforger!");
obj.EndObject();
obj.Pack();

string json = obj.AsString();
Print(json);

Returns:

{}
desert escarp
desert escarp
mild bison
#

Thanks

red cedar
# mild bison Is the `JsonApiStruct` broken or am I using it incorrectly? ```c JsonApiStruct o...

When i use api structs i use it like that :
Class definition

class SDS_ConnectUserJson : JsonApiStruct
{
    string player_name;
    string player_uid;
    string platform;
    
    void SDS_ConnectUserJson()
    {
        RegAll();
    }
}

And that's how i use it :

private void ProcessConnection(int playerId)
    {
        
        string uid = KE_Helper.GetPlayerUID(playerId);
            
        PlayerManager pm = GetGame().GetPlayerManager();
        string username = pm.GetPlayerName(playerId);
        
        PlatformKind platform = GetGame().GetBackendApi().GetPlayerPlatformKind(playerId);
        SDS_ConnectUserJson connectInfo = new SDS_ConnectUserJson();
        connectInfo.player_uid = uid;
        connectInfo.player_name = username;
        connectInfo.platform = SCR_Enum.GetEnumName(PlatformKind, platform);
        
        
        m_backend.ConnectUser(connectInfo, playerId);
    }


void ConnectUser(notnull SDS_ConnectUserJson connectInfo, int playerId)
    {
        if(!m_isBackendReady)    {return;}
        
        ref SDS_ConnectUserCallBack callback = new SDS_ConnectUserCallBack();
        
        callback.SetPlayerId(playerId);
        
        connectInfo.Pack();
        m_callbackPendingDeletion.Set(connectInfo.player_uid, callback);
        m_context.POST(callback,ENDPOINT_CONNECT_USER, connectInfo.AsString());
    }
#

i like this approach more than load and save context even tho it's apparently way less optimal

mild bison
#

In a way it looks more appropriate, I'll give it a try as well. The next question is how to attach a GET to a player on spawn. I've just put down a crate and added my RestAPI component to it and it's working but I doubt that's how it's done

red cedar
# mild bison In a way it looks more appropriate, I'll give it a try as well. The next questio...

can always use the OnPlayerSpawnFinalize_S method
I had a game mode running in which i synchronized the data after every respawn ->

override void OnPlayerSpawnFinalize_S(SCR_SpawnRequestComponent requestComponent, SCR_SpawnHandlerComponent handlerComponent, SCR_SpawnData data, IEntity entity)
    {
        
        PlayerController pc = requestComponent.GetPlayerController();
        ToW_PlayerProfileComponent playerProfile = ToW_PlayerProfileComponent.Cast(
          pc.FindComponent(ToW_PlayerProfileComponent)
        );
                playerProfile.RequestClientValueUpdate(); // send a POST request to my backend
     }
mild bison
#

Is ToW_PlayerProfileComponent you're player profile struct?

red cedar
#

no but in some way it is linked to the api struct, it is a component which has function related to data stored in my backend.

So player xp, level, balance, kill death counter etc and then i have a class when i request an update it will turn those into a json api struct and return it.

But those two code sample come each from different projects

#

also when setting headers just note that setting a header will erase all previously set headers, so include every single header every time you call SetHeaders

mild bison
red cedar
#

i get that it is a test to learn how to use http calls but remember to keep the context instance, much more handy to keep authorization headers saved or base urls

torn bane
#

Not only that, it drastically increases performance to not re-create a context each time

mild bison
#

Is this correct: ```c
ctx.setHeaders("Content-Type: application/json");

torn bane
mild bison
#

Just so I'm understanding the syntax otherkey would be charset and othervalue would be utf-8?

red cedar
red cedar
ocean kernel
#

How do I pass a reference to an array containing instances of my class to a method?

#

Without defining the type in the parameter that is

torn bane
ocean kernel
#

Man I hope passing methods as parameters gets implemented, such a pain in the butt

silent shard
#

Is that something that's on the table? I feel like it'd require too many compiler & runtime changes to be worth implementing

ocean kernel
#

ctrl + click doesnt work anymore

#

doesnt go to definition

#

hm

#

ok it sometimes works

neon elbow
#

It's been a while since I've opened the script editor. Did something happen to the creation wizard? It used let you choose a template.

#

I guess I fill from template now

fringe prairie
#

So, can RplProps and Attributes be stacked? Like if my game mode has an attribute configured at prefab level, but I also want to change it and replicate that variable, can this work?
[Attribute("1", UIWidgets.CheckBox, "Enable feature", category: "Freemode"), RplProp()]

It compiles but I'm scared haha

desert escarp
#

I think it works, at least it did for us before I noticed it in our github and got rid of it

#

its uh, interesting but I personally like to just separate the behaviours

minor agate
#

Decorators can be stacked

#

[...] is called decorator list

desert escarp
#

Is there any downside to it or is it just a personal preference kind of thing?

desert escarp
#

Mixing an RplProp and Attribute

fringe prairie
#

Yeah decorator, was the word I was looking for, I assumed as much with the [], that it should be fine. I think it makes sense to use for situations with a default attribute that can change over time

minor agate
#

So it does not affect runtime perf

minor agate
desert escarp
#

Hmm tmyk

minor agate
#

We've instances of that in vanilla

fringe prairie
#

Like for my gamemode I'm adding scenario properties and by default the world can have a default set up, but admins could go into scenario properties and change them.

#

Felt kind of silly having a variable for the attribute, and another for replication, and trying to figure out the difference

mild quarry
#

Anyone know what I'm doing wrong? External clients are not receiving these animation commands at the same time:

void ExecuteCustomCommand(){ // Only initiated from local player
    Rpc(RPC_ExecuteCustomCommand);
}

[RplRpc(RplChannel.Reliable, RplRcver.Server)]
protected void RPC_ExecuteCustomCommand() {
    Rpc(RPC_DoExecuteCustomCommand);
}

[RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
protected void RPC_DoExecuteCustomCommand() {
    MyWeaponAnimationComponent myWeaponAnimComp = GetMyWeaponAnimationComponent();
    
    m_CharacterAnimComp.CallCommand(CMD_MyCustomCMD, 0, 0.0); // This gets executed second (long delay)
    myWeaponAnimComp.CallCommand(CMD_MyCustomCMD, 0, 0.0); // This gets executed first
}

The character is getting the command like 200ms after the weapon, so they get really out of sync. Idk if it makes any difference here, but the character'sCallCommand is natively replicated already, but WeaponAnimationComponent's is not

limpid bloom
#

Does anyone know which script or config file controls the Arsenal refund system?

mild quarry
fringe prairie
#

Yeah are you waiting to start the weapon animation until the client recieves the character animation?

#

Nvm I see now, trying to line this up might be difficult, for you what happens locally? It executes instantly in some other logic?

mild quarry
fringe prairie
#

So callcommand is being used locally as well? And it happens simultaneously?

#

for the original player that is

#

Or is callcommand being used as an analog for other players to see the animation which is already playing for your player, if that is the case, the game might be taking full control of the character animation, and waiting until it's own process replicates it

#

So basically your command isn't even firing, maybe, haven't messed with this yet, but it would make sense the game won't trigger it on an already replicated process. A good test would be doing call command on the server for the character anim comp in the RPC to server, then broadcast just the weapon, and see if that way it lines up?

#

since ideally the server is already replicating character, and when you do that, the weapon call would arrive at pretty much the same time?

#
void ExecuteCustomCommand(){ // Only initiated from local player
    Rpc(RPC_ExecuteCustomCommand);
}

[RplRpc(RplChannel.Reliable, RplRcver.Server)]
protected void RPC_ExecuteCustomCommand() {
    Rpc(RPC_DoExecuteCustomCommand);
    m_CharacterAnimComp.CallCommand(CMD_MyCustomCMD, 0, 0.0);
}

[RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
protected void RPC_DoExecuteCustomCommand() {
    MyWeaponAnimationComponent myWeaponAnimComp = GetMyWeaponAnimationComponent();
    myWeaponAnimComp.CallCommand(CMD_MyCustomCMD, 0, 0.0); // This gets executed first
}
#

see if this works? ¯_(ツ)_/¯

mild quarry
#

I think I have tried just about every combination so far lol

fringe prairie
#

Yeah reminds me of the pain I had with joints.

mild quarry
#

Damn. Well thanks for trying to help. I really think it's some native engine constraint because the client is definitely getting these at the same time, just the character's isn't getting called right away for some reason.

desert escarp
fringe prairie
#

As a hack if you can figure out the delay, delay the weapon command trigger lol

mild quarry
minor agate
#

You will desycn the whole simulation

#

The anim graph can replicate itself

#

Hande it on auth, let it replicate on clients

mild quarry
#

Is there a way I can sync them together?

minor agate
#

it's on both graph config and component

#

The graph and anim system won't replicate and sync things it does not need to

#

You need to tell it what to sync

mild quarry
mild quarry
#

In fact, none of my Anim variables are replicated either (despite being "Synchronized"). I have been replicating those manually too

light tide
#

Can someone please tell me how I can assign access to items from the arsenal only to players with a certain role?

pliant ingot
#

No one has done this yet, as far as I know

scarlet iris
oblique swan
#

Hello folks,
Could anyone tell me why ApplyImpulse() does not work in multiplayer (it works ok in singleplayer)?
I'm trying to make a character fly around.
Any help is appreciated :)

I made this "debug script" for simplicity sake, when on dedicated server as peer in workbench, character doesn't fly up.

[ComponentEditorProps(category: "Movement/Character", description: "script component for flying")]
class REAB_TestComponentClass : ScriptComponentClass {}


class REAB_TestComponent : ScriptComponent
{
    void Fly(vector movementInput, IEntity e)
    {
        if (!movementInput)
            return;
        
        Physics charPhysics = e.GetPhysics();

        if (!charPhysics)
            return;

        charPhysics.ApplyImpulse(movementInput * 10);
    }
    
    override void OnPostInit(IEntity owner)
    {
        SetEventMask(owner, EntityEvent.FRAME);
    }

    override void EOnFrame(IEntity owner, float timeSlice)
    {        
        Fly(vector.Up, owner);
    }
}
storm bobcat
#

@minor agate Hope I am not bothering you.
Is it possible that we could get entity type component params for the world editor?
To explain what I mean:
Have a component with an entity param (a parameter that takes a entity object) that can be set in the component,
place an object with that component in the world,
place a another object down,
and put the second object into the first object's component entity param.

I think of an example where I might is with door keypads. I have a keypad, and it has a parameter that takes a door object, and that I would reference the door to the building that the keypad is on.

minor agate
minor agate
ocean kernel
#

Annoying that autocomplete doesnt work most of the time, ctrl+click also doesnt work a lot of the time

minor agate
ocean kernel
#

what is this

minor agate
#

press f7

#

see if it still does that

#

Or what do you mean?

ocean kernel
#

Kinda expected to see parameters

#

To the method

minor agate
#

mmm

#

Press f7, so the context resets

ocean kernel
#

No changes

minor agate
#

rip lol

#

Did you use auto somewhere?

#

(It does not have to be in the same file)

ocean kernel
#

Probably

mild quarry
ocean kernel
#

This is why I invented my own animation system

dire sinew
#

I do hope they'll rework the animation system at least for A4 to be easier to interface with scripts and also more modding friendly...

#

Though I think Mario already mentioned something about improvements to the editor for modding graphs 😎

river imp
#

If you wanna do something like that in world editor write a plugin.

fringe prairie
#

Are devs aware of thermal shader being very busted on Xbox/PlayStation? I understand it's an experimental feature, but it would be good if PC didn't have an inherit advantage when mods implement this wide spread. I submitted a feedback ticket for this during experimental. https://feedback.bistudio.com/T195448

sharp iron
#

so I'm primarily a modeler and animator, but I was wondering how difficult it would be to create a functioning ammo counter on a weapon, like you would see in halo

#

a number on a screen that ticks down from 32-0 and then returns to 32 when you reload

fringe prairie
# sharp iron a number on a screen that ticks down from 32-0 and then returns to 32 when you r...

So the HUD component on Character_base.et has the weapon info display, but that's heads up display. But you could make a custom extended info display which gets the weapon from the weapon component that the hud manager gets, can do some searching to find the slot with the mesh to display the UI on, and use SetRenderTarget on the layout to put it on there when starting, and RemoveRenderTarget when stopping display

#

HUD manager is probably the cleanest way to do it imo

minor agate
sharp iron
fringe prairie
#

So don't call it Halo, abide by Microsoft game usage agreement

minor agate
#

HALO IP is not allowed unless it is fan fic and 100% your creation

#

No rips, no lore copy, etc

sharp iron
#

oh im just doing an ammo counter

#

on my own project

minor agate
#

Making sure, you mentioned halo, said you are working on that and have a HALO banner on your profile. So just making sure before you waste ton of time and get banned

sharp iron
#

yeah this is a solo thing

#

and I make all my own models

minor agate
mild quarry
mild quarry
#

Unless this is a bug or something. Because from my understanding, these commands/variables should be automatically replicating without me having to replicate them manually

desert escarp
#

Any update on this

minor agate
minor agate
mild quarry
red escarp
#

@torn bane please see your dm

midnight talon
#

How can I debug clients being kicked with this error? Happens when they stream in some common city building prefab

00:43:44.868  RPL          : rpl::Pip::ProcessNetToGame
00:43:44.868   RPL       (E): RplCreationError: Number of items mismatch. expected=2, created=3, nodeId=0x4000F7F3, node='Assets/Structures/BuildingsParts/Windows/Glass_122x42/Glass_01_122x42.xob'
00:43:44.868   RPL       (E):   created items:
00:43:44.868   RPL       (E):    name='RplComponent', layoutName='script::Game::RplComponent'
00:43:44.868   RPL       (E):    name='DamageManagerComponent', layoutName='script::Game::SCR_DestructionMultiPhaseComponent'
00:43:44.868   RPL       (E):    name='DamageManagerComponent', layoutName='script::Game::SCR_DestructionMultiPhaseComponent'
open pier
minor agate
midnight talon
midnight talon
#

The reference in error to a building window glass mesh was a bit of a red herring, it seems issue was caused by one of my entities with AutoHierarchy being child of a building or something

quaint basalt
#

How to I get ResourceNames for materials assigned to MeshObject of entity?
I've found this bit of code posted here by @river imp

IEntityComponentSource ClothComponentSource = SCR_BaseContainerTools.FindComponentSource(PrefabResource, "BaseLoadoutClothComponent");
TResourceNameArray WornOverrides = new TResourceNameArray();
ClothComponentSource.Get("WornMaterialsOverride", WornOverrides);

How could I do this for Materials of MeshObject? Currently by doing it for "Materials" gives me a null

fringe prairie
#

I don’t think I ever found a way

#

You can theoretically read them on workbench instance via file read

#

And parsing start of xob

#

Now you can get it if the materials are overridden, but an override can’t be the same as the original so it’s useless for most items. I put in a feedback ticket for it IIRC

quaint basalt
# fringe prairie I had a way a while ago but it can’t get original materials on a mesh object

Yeah, In the workbench I can read them from IEntitySource using GetDefaultAsString but it doesnt seem to work when packed and used in-game

void Vehicle(IEntitySource src, IEntity parent)
    {
        
        int compCount = src.GetComponentCount();
        for (int x = 0; x < compCount; x++)
        {
         if(src.GetComponent(x).GetClassName() == "MeshObject")
            {
                BaseContainer mesh = src.GetComponent(x);
                string mats;
                mesh.GetDefaultAsString("Materials", mats);
        
                array<string> resources = {};
                mats.Split(",", resources, true);
        
                foreach(string resource: resources)
                {
                    if (resource.Contains(".emat"))
                    {
                        assignedMaterials.Insert(resource);
                    }
                }
            }
        }    
    }
fringe prairie
#

Yeah that’s a lot more elegant than I was doing

craggy jolt
#

Can you use Rpcs inside game system? I see 2 uses in vanilla scripts but does it actually work? Can't get mine to run.

dire sinew
craggy jolt
dire sinew
craggy jolt
dire sinew
#

Can you post what you tried?

#

Some simple system

#

Again broadcast is the only one that makes sense.

#

Could also be that you tried to early when replication isn't ready yet.

#

And depending on what you do, a RplProp might make more sense.

craggy jolt
# dire sinew Can you post what you tried?
class TestestSystem : BaseSystem
{
    override static void InitInfo(WorldSystemInfo outInfo)
    {
        outInfo
            .SetAbstract(false)
            .SetLocation(ESystemLocation.Client)
            .AddPoint(ESystemPoint.Frame);
    }

    [RplRpc(RplChannel.Reliable, RplRcver.Owner)]
    void RpcTest1()
    {
        Print("RpcTest 1");
    }

    [RplRpc(RplChannel.Reliable, RplRcver.Server)]
    void RpcTest2()
    {
        Print("RpcTest 2");
    }

    [RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
    void RpcTest3()
    {
        Print("RpcTest 3");
    }

    int cnt = 0;
    override void OnUpdate(ESystemPoint point)
    {
        super.OnUpdate(point);
        
        cnt += 1;
        if(cnt == 100)
        {
            Print(cnt);
            Rpc(RpcTest1);
            Rpc(RpcTest2);
            Rpc(RpcTest3);
        }
    }
}
#

Testing as listen server in workshop

dire sinew
craggy jolt
#

Having it as Client on server still runs the system and updates, but why not Rpcs?

sleek dove
#

Systems without Both are not registered in replication since it can not exist on one side

minor agate
#

I mean there was a time when it didn't

#

but that was waaay before 1.6

#

even way before this year

#

But as Niirozz mentioned, it would not work unless you have the system on both sides

dire sinew
#

Could be. Can't really tell when tried last time before 1.6 😅

minor agate
#

It should not tick on server if set as client

#

And on DS

dire sinew
#

He's on a listen server, where it should tick though...

minor agate
minor agate
#

But maybe it is fixed now in the hotfix perhaps

#

I need to test again

#

According to relevant enf dev, it was tied to some define mishap

dire sinew
#

What about WorldController? Are they fixed too for next version?

minor agate
#

I will need to check

#

According to relevant enf dev, it was also tied to some define mishap

#

😅

dire sinew
#

Ah, I guess try and see then 😅

minor agate
#

Last part where I left it is when I reported it internally when I found it

#

After that I got busy and did not track it

#

It's easy to test

#

Just create a system on client only

#

and see if it exists and ticks on server in DS

#

I was messing with a mod I was working on, and that messed me up for a while until I debugged it

dire sinew
#

Network stuff is always fun to debug. The worst was by far finding the bandage bug that got fixed meanwhile 😅

minor agate
#

😅

dire sinew
#

Oh and bad codecs

pliant ingot
dire sinew
dire sinew
minor agate
#

It's wrong to behave like that

dire sinew
#

But the table literally has yes for listen server

minor agate
#

if set to client, on DS it should not even exist on server

minor agate
#

DS (Actual server)

#

Should never have it created even if set to Client

#

listen server has both, because it is both a server and client

teal vapor
#

Very random but I've got a couple of mods that I will probably never do anything with if anyone's interested in the code. Both were developed I think 2 releases ago? So may not work as-is on the latest version.

One was a scoreboard including kills/deaths/supplies delivered/supplies spent that you could see only at the command tent (ignore mod name it started off as something different).

https://github.com/landaire/arma-mods/tree/main/ReforgerEventsApi

https://cdn.discordapp.com/attachments/1358669621682503710/1359634756265836625/2025-04-09_13-58-36.mp4?ex=69314e4a&is=692ffcca&hm=5322aa8824d2f2a68e674c4d0de70910bd3162dfa34d3656f9e9067eafd8b8ee&

Another one was a radio triangulation mod which would in theory allow command posts to detect radio transmissions and triangulate position. Kind of a cool concept that was unfortunately incomplete, just needs to port the logic to the map using logic similar to the game master/arma vision camera cone.

https://github.com/landaire/arma-mods/tree/main/RadioDirectionalFinding

https://cdn.discordapp.com/attachments/1358669621682503710/1364252921960595466/2025-04-21_21-47-19.mp4?ex=6931a08b&is=69304f0b&hm=59a9e856721a1de05126f738baf113fcf46ba4039b22d16fb06700dadf7f772a&

#

Just to be clear, I'm not asking for help on these mods but I thought someone may find the code possibly useful for interacting with the radio system or stats.

river imp
#

@fringe prairie@quaint basalt

static void PrintOriginalMaterials(IEntity Entity)
{
    EntityPrefabData PrefabData = Entity.GetPrefabData();
    if (PrefabData)
    {
        IEntitySource EntitySource = PrefabData.GetPrefab().ToEntitySource();
        if (EntitySource)
        {
            BaseContainer MeshObjectContainer = SCR_BaseContainerTools.FindComponentSource(EntitySource, "MeshObject");
            if (MeshObjectContainer)
            {
                ResourceName MeshResourceName;                    
                MeshObjectContainer.Get("Object", MeshResourceName);                    
                MeshResourceName.Replace(string.Format("{%1}",SCR_ResourceNameUtils.GetPrefabGUID(MeshResourceName)),"");

                Resource MetaResource = BaseContainerTools.LoadContainer(MeshResourceName + ".meta");
                if(!MetaResource.IsValid())
                    return;
                                
                BaseContainer MetaContainer = MetaResource.GetResource().ToBaseContainer();
                BaseContainerList MaterialAssignsList = MetaContainer.GetObjectArray("Configurations").Get(0).GetObjectArray("MaterialAssigns");
                for (int i = 0; i < MaterialAssignsList.Count(); i++)
                {
                    //string MaterialSlot;
                    //MaterialAssignsList[i].Get("SourceMaterial",MaterialSlot);
                    //Print(MaterialSlot);
                    ResourceName MaterialResourceName;
                    MaterialAssignsList[i].Get("AssignedMaterial",MaterialResourceName);                        
                    Print(MaterialResourceName);
                }
            }
        }
    }
}
#

This works in Workbench but, it complains about line 16.

SCRIPT       : GetResourceName 'Scripts/Game/aaa.c,16'
SCRIPT       : ResourceName MaterialResourceName = '{A906D0A0D856AE02}Assets/Props/SodaMachine/Data/left_panel.emat'
SCRIPT       : ResourceName MaterialResourceName = '{E962A29EA375CBA9}Assets/Props/SodaMachine/Data/right_panel.emat'
SCRIPT       : ResourceName MaterialResourceName = '{D9DDA98077894464}Assets/Props/SodaMachine/Data/frame.emat'
SCRIPT       : ResourceName MaterialResourceName = '{B71109E7A519E50B}Assets/Props/SodaMachine/Data/card_reader.emat'
SCRIPT       : ResourceName MaterialResourceName = '{4967C3DA48DE41EA}Assets/Props/SodaMachine/Data/buttons.emat'
SCRIPT       : ResourceName MaterialResourceName = '{D090FF036EB9E7B7}Assets/Props/SodaMachine/Data/front_panel.emat'
#

Odd thing is, it doesn't complain about the same call in SCR_Global::GetResourceName

craggy jolt
pliant ingot
craggy jolt
pliant ingot
craggy jolt
#

RplRcver.Broadcast call reaches client when called from server

timid citrus
#

or anybody who knows

minor agate
#

Proxies and proxies with owner modifier cant

minor agate
timid citrus
#

Ty

river imp
#

Why does my script complain and GetResourceName doesn't?

minor agate
#

It seems you clamped the error

river imp
#

That's all it ever prints

nova coral
#

Getting this error when trying to use a Game master spawnpoint of my custom faction. Not sure where to turn to. I have a factionmanager and loadoutmanager already set up with the proper prefabs and affiliated faction on it.


Reason: NULL pointer to instance

Class:      'SCR_LoadoutRequestUIComponent'
Function: 'CreatePlayerLoadoutButton'
Stack trace:
scripts/Game/UI/Menu/DeployMenu/SCR_LoadoutRequestUIComponent.c:364 Function CreatePlayerLoadoutButton
scripts/Game/UI/Menu/DeployMenu/SCR_LoadoutRequestUIComponent.c:325 Function ShowPlayerLoadouts
scripts/Game/UI/Menu/DeployMenu/SCR_RoleSelectionMenu.c:383 Function OnPlayerGroupJoined
scripts/Game/UI/Menu/DeployMenu/SCR_RoleSelectionMenu.c:395 Function OnLocalGroupJoined
scripts/Game/UI/Menu/DeployMenu/SCR_GroupRequestUIComponent.c:168 Function UpdateLocalPlayerGroup
scripts/Game/Groups/SCR_PlayerControllerGroupComponent.c:796 Function OnGroupChangedDelayed
scripts/Game/game.c:914 Function OnUpdate```
dire sinew
#

Did you just create a tornado in Enfusion at the end? 😅

next talon
next talon
trim aurora
#

Hey, is there an easy way to create a unique ID (GUID) in enfusion?

oak thorn
torn bane
oak thorn
trim aurora
#

Nice! Is there an event or method that is triggered when an entity is created or edited in the workbench?
My first thought was to use a modified GenericEntity, but this is not possible, and I could not find anything on the WorldEditorAPI.
The only other option I can think of is to perform some checks every frame, but that just seems too contrived to be the best solution for this.

tawny lotus
#

Shouldn't Math3D.PointLineSegmentDistanceSqr be able to handle a situation where v0 and v1 are the same? Feels unnecessary to check outside if v0 and v1 are same ..

You get the assert with float v = Math3D.PointLineSegmentDistanceSqr("5.0 5.0 5.0", "1.0 1.0 1.0", "1.0 1.0 1.0"); after you've started WB and run your code.

pliant ingot
trim aurora
pliant ingot
#

For other cases - add component on it, or replace entity class without your own in prefab

trim aurora
# pliant ingot If you need it globally - you doing something wrong

How do you mean I am doing something wrong?

To clearify: My goal is to make a little tool to record objects placed and modified in the editor so I can visualize map building progress. The visualization can be handled outside enfusion, so I just need a hook for when any entity is created, changed or deleted. I know it is not a "normal" use case ^^

pliant ingot
trim aurora
midnight talon
# trim aurora Yeah, but I want to know when any entity inherting from GenericEntity gets chang...

Not sure about diffing data changes but for tracking creation and deletion you can make your own component, attach it to an override of common base prefabs used by most entities e.g. most props inherit fromPrefabs/Props/Core/DestructibleMultiPhase_Props_Base.et, most buildings from Prefabs/Structures/Core/Building_Base.et etc

You can then use the _WB and lifecycle methods in your component since your component will be getting created/deleted automatically when any prefabs it's attached to are

What you're talking about sounds like the kind of thing I think WB plugins were intended for, I haven't looked into that stuff much myself yet but looking at how any of the scripted WB plugins were made might give you some direction

quaint basalt
#

Can we control how far PIP will cull the entities? Currently at 1000 vehicles/soldiers just disappear

lone glen
#

how to turn them hostile to US

#

rather than placid and do nothing

ocean needle
gentle cradle
#

how do i check if a player is an admin?

red cedar
#

I could be wrong but there was definitely an IsAmin method

fringe prairie
#

SetNearPlane will cull anything close than X (so like if there is geo like camera lens you want to hide, and far plane is how far it renders), but this camera is quite limited if it's not player camera as it will not render additional GEO or higher LOD levels than the player camera already sees, so direction of player camera and distance from what you are looking at can never be ignored as factors for distant viewing of objects.

#

Then you have RPL bubble, and distances at which things appear/disappear on network side. AR limitation that hopefully will be improved with A4

scarlet iris
quaint basalt
fringe prairie
#

Yeah, though with low enough FOV (high enough zoom), this should be mitigatable.

late locust
#

I guess nice to have ProjectileMoveComponent.GetProjectileSimulationResultnow, but is there a way to get the projectile simulation itself? To change mass, speed etc... at runtime? GetPhysics() returns nothing

dire sinew
#

GetPhysics doesn't work, as projectiles have a distinct simulation handled by ProjectileMoveComponent and ProjectileSimulationSystem afaik.

clever oxide
#

There is an update code for prefab when i edit something by code? its never worked for me, i tried enable LSD differential at runtime, but only next vehcle spawn used that

dire sinew
#

but can't modify anything during the simulation of a trajectory

dire sinew
#

At least those that are not defined in *Class, which are shared accross all instances.

clever oxide
dire sinew
#

As I said, you have to modify the prefab before you spawn the vehicle.

#

No other solution afaik.

restive island
#

What class(es) records what buildings are built by any faction player at bases? Trying to keep track if a player has built a helipad at a base such as Montignac.

desert escarp
#

What does a system failure kick result exactly entail

#

After this hotfix we are getting them constantly

#

Server does not crash, kicks a majority of the population with the system failure

#

Nothing in the logs

restive island
#

Can I use the remote console to pull things from my 3D viewport session? Trying to get live data

forest sky
# desert escarp What does a system failure kick result exactly entail

this is coppy and paste bc im to lazy to retype it,
well if anybody keeps crashing on pc they can deleted any of the banned mods and updated all of the mods and some of the mods I did update them sum the dependencies were also banned so you have to delete them too and every since I done that I haven't crashed yet

craggy jolt
#

Is there a reason why PeerTool client doesn't get prefab entity with changes? For example I adjusted rotor offset in slot manager component but the change isn't there for PeerTool client. What am I missing?

river imp
#

Apply changes to the prefab and it will be visible for the client.

#

Otherwise change on server and broadcast the change to clients.

midnight talon
#

Also if client doesn't pick up (non-runtime) changes to prefab files themselves it could be a problem of your peertool loading published mod over local source mod if you have it reading your game client add-ons dir

minor agate
#

@craggy jolt

#

On the entity you expect to do the changes

#

Just don't use it everywhere, be smart about it

lime dew
#

I know that EPF is deprecated but I'm still using it until I can fully implement the new Persistence System.

If there a way for me to make spawnpoints persistent?

I have a movable spawn that moves to player position with a ScriptedUserAction, I keep getting an VME when trying to implement EPF Persistence.

Any help will be greatly appreciated.

timid citrus
#

Any way to mark things to leave out of the build?

#

Dev only documentation in this case

static vale
#

How do i fix WB freezing for 10 secconds when switching between script editor and world editor?

pliant ingot
static vale
desert escarp
#

Removing them from the workbench menu where you select them seemed to help

minor agate
#

Published mods scripts do not get distributed as bytecode

#

So, no

timid citrus
#

Okay thank you

rancid belfry
#

quick question for my Enfusion workbench, Am i supposed to have a workbench tab? Is so why do i not have one Ive tried to get it to show but nothing works.

timid citrus
rancid belfry
#

ok thank you i was extremely confused why i wasnt seeing it.

rancid belfry
#

Im currently working on an AI Vehicle patrol addon that was similar to how exile would spawn vehicles and drive around, Is there a way to pull vehicles from different loaded addon within a server to add to the pool or do i have to hard code the Vehicles in?

spark otter
#

How would I detect if an entity is getting deleted so I can do something before its deleted? Do I need to check IsDeleted() in EOnFrame()? Seems like that would be pretty expensive

midnight talon
pliant ingot
spark otter
#

Thanks, apparently Im not modding the right action for the conflict building menu. Trying to do something to a vehicle when a player spawns it in. Anyone know what action that is?

umbral spade
#

Hello. I can't figure out how to intercept the moment a shot is fired? I need to implement weapon wear, but I don't understand how to detect the player's weapon and when it fires.

long hill
drifting orchid
#

Hi guys just joined in, I'm sorta of a modder, I need a little help

#

I have this component which works great, it has member variables which works okay but I'm using a custom class data type in a variable, and that custom data type variable just doesn't seem to update , I'm using a custom plugin to update the variable, but it doesn't seem to update in the properties

#

I have tried looking through docs, serialization, AI

#

no luck

#

right below is the variable called 'm_savedObjects'

#

the custom class:

#

P.S: forgot to mention I'm updating this variable through a plugin

pulsar tree
#

Still new to moding in Reforger not new to coding. Is there a script or properties int the game already that will let my make the item's mesh when in the players hand not be visible or is that something I will have to figure out and make?

drifting orchid
# pulsar tree Still new to moding in Reforger not new to coding. Is there a script or properti...

not sure if this relevant to ur question but here's a https://www.youtube.com/watch?v=dUNN_KeyjkQ video of a guy showing how to add a custom helmet

Follow along with our guide here: https://reforger.armaplatform.com/news/modding-boot-camp-3-modeling

Bohemia Interactive Community Wiki (BIKI) Tutorial: https://community.bistudio.com/wiki/Arma_Reforger:Character_Gear_Creation/Headgear

This Modding Boot Camp seminar was originally held on the Arma Discord Server on December 18th, 2024.

Artis...

▶ Play video
#

if his modeling a helmet and gettin it equipped, maybe you can make it appear on hand or something

oak thorn
pulsar tree
drifting orchid
pulsar tree
drifting orchid
#

I think this 'ent.ClearFlags(EntityFlags.VISIBLE,false);' sets the visibility to false

oak thorn
#

I think it has to be done in a gadget component, b/c you still want it visible when its not held

pulsar tree
#

if (mode == EGadgetMode.IN_HAND) {
if(hideWhenHeld){
ent.ClearFlags(EntityFlags.VISIBLE,false);
}
} elseif {ent.ClearFlags(EntityFlags.VISIBLE,true);}

oak thorn
#

yea..prettymuch that 👍 else*

pulsar tree
drifting orchid
#

is any of u guys familiar with this error?

#

error shows up when I hit plus/add button to add a new item for my array, the array's data type is a custom class

oak thorn
#

chat gpt thinks you should declare it like this 😅
ref array<ref SavedObject> SavedObjects = new array<ref SavedObject>();

drifting orchid
#

yea I have been trying out AI as well but not chatGPT though, just the default google search

#

chatGPT didn't declare it that way though, if I recall I saw a ingame code declared like that so I gave it a try

fringe prairie
#

Use Claude for best results, but really the power is in understanding why it works. Really it’s a teaching tool (why does C# declare objects this way? What are pros and cons?)

drifting orchid
#

I know ref is 4 strong reference but it sorta confuses me since it doesn't work on components but seems to work on other classes

fringe prairie
#

Really you shouldn’t need it to be declared like that, if it’s a base container object

drifting orchid
#

I don't really copy paste code from AI, just use it 4 information

fringe prairie
#

Need to see code for that attribute to be sure

minor agate
#

If you want your custom class to be a config

fringe prairie
#

But if it’s not a native class, your class needs decorators to tell the engine it’s a config thing

minor agate
#

Then you need to decorate it tiwth the BaseContainerProps attribute

#

Otherwise it will just be a regular script class

fringe prairie
#

What he said haha

minor agate
#

Then you need to expose each variable you want in the config interface with the Attribute decorator

#

Also

drifting orchid
#

BaseContainerProps?, I did look into that, gave that a try but it throwed an error

minor agate
#

NEVER initialize attribute variables like how you did there with = {}

fringe prairie
#

[BaseContainerProps()]
class AG0_PostProcessEffect
{
    [Attribute("0", UIWidgets.ComboBox, "", "", ParamEnumArray.FromEnum(PostProcessEffectType))]
    PostProcessEffectType m_eEffectType;
    
    [Attribute("0", UIWidgets.Slider, "Priority (0-19)", "0 19 1")]
    int m_iPriority;
    
    [Attribute("", UIWidgets.ResourceNamePicker, "Material", "emat")]
    ResourceName m_sMaterialPath;
}
#

Example

#

Then in attribute:

drifting orchid
#

also I don't think my custom class is 4 config not sure, I'm using my custom class to hold some basic information like the object's health, prefab, position etc...

fringe prairie
#
[Attribute("", UIWidgets.Auto, category: "Video Source Config")]
    protected ref array<ref AG0_PostProcessEffect> m_aCameraEffects;```
drifting orchid
minor agate
drifting orchid
#

I know there is a defvalue, but thought it would be okay

minor agate
#

It's just waste of perf

fringe prairie
#

You are overwriting as well whatever the default value is supposed to be

#

And creates some issues with debugging (why doesn’t it work!)

drifting orchid
#

yo the attributes are working fine except 4 the custom class one

minor agate
#

Read what I said about it

drifting orchid
#

the custom class one I'm using a plugin to update the variable

minor agate
#

But why a plugin?

fringe prairie
#

My example should work if you and to try adapting it, but not sure how a plugin plays with that stuff.

drifting orchid
drifting orchid
minor agate
drifting orchid
#

lmao no

minor agate
#

AI is really bad for programming in general, it's even worse on our custom language, and our csutom engine

drifting orchid
#

yea mate I already know that, I told ya b4 I use it 4 information though it sometimes throws errors

minor agate
#

It sounds super wrong, that is why I ask

#

But it depends on what the reason is

#

It might be valid

drifting orchid
#

I mostly use the default google search one, if I type a question it will answer and also show the topics and I mostly navigate those topics

#

I have this project that I made in Arma 3, all gud no AI

#

its called SandboxLib which has some features called sites, pawns, etc..., atm

#

I'm trying to create a existing feature which you might already be familiar with

#

in workbench

#

areas with spawning & despawning

mild quarry
river imp
#

From your snippet above it looks like you should be inheriting from one of the trigger entities as opposed to making your own component

minor agate
drifting orchid
minor agate
#

That just got me more confused

#

Explain it as if I do not know anything about your feature, because that is the case

#

I do not have context so idk how to even help or how to give advice about it

drifting orchid
#

so basically if u played any game, u know that when you enter a area, it spawn some things and when you leave it despawns right?

#

arma reforger already has a feature like that called areas

river imp
#

yeah

drifting orchid
#

actually the area component sorta provides that feature

river imp
#

Those are trigger entities

drifting orchid
#

I'm trying to create something similar, and this is something I already made in Arma 3

minor agate
#

But why are plugins relevant here

#

Are you referring to Workbench plugins?

drifting orchid
#

yep

minor agate
#

Ok

#

What is the relevance of plugins here?

drifting orchid
#

well I sorta tried to implement a button in a component's properties panel but I couldn't figure that out so I sorta ended up using a plugin to execute a code

#

so to summarize

#

I have some attributes defined, they all work good except for the 'ref array<SB_ObjectInfo> m_savedObjects', since 'SB_ObjectInfo' its a custom class

#

I'm using a code to update that array, but it doesn't get updated, I'm not sure why

minor agate
#

It will then become a config class, which then means it will be able to be used in configs

river imp
#

Not sure why you need a plugin when you can just change the values on the prefab?

minor agate
#

That is why I still do not understand this whole problem as well

river imp
#

Sounds like you're living in the past, this isn't the Eden Editor that you love so much.

drifting orchid
#

yea ik

river imp
#

pun intended btw

#

vc?

drifting orchid
#

not good at vc xD

drifting orchid
river imp
#

You definitely shouldn't be storing information about hundreds of objects

#

especially not in numerous entities across the map

drifting orchid
#

its just basic info, not much, + BI already made something similar though it only takes prefabs/resource names

river imp
#

When they store hundreds of things they do it in a prefab, meaning the data never has to rpc across the network

#

Regardless

#

Give a more clear example of EXACTLY what you're trying to do

drifting orchid
#

yea ik, but still the prefab spawns in a position with a rotation right?, I'm pretty sure those are stored somewhere, and + my code just happened to take a prefab, and 2 vectors for rotation and position

drifting orchid
minor agate
#

It's not the "what" only the thing we need context

#

it's the what and how

#

Please, write properly what you are trying to do and how. Otherwise we are wasting time here. We want to help you but we are going in circles

#

You are giving context in bits, which confuses us more and more

pliant ingot
drifting orchid
drifting orchid
#

currently looking into BaseContainerProps, it might be the solution 2 myp roblem

pliant ingot
drifting orchid
river imp
drifting orchid
#

I'm not reinventing anything though, BI uses a prefab to spawn it which is a pain 4 me sinceI have to manually each time assign a prefab

#

Im sorta using a different approach

#

which I used in Arma 3

minor agate
#

Please do not bring A3 approaches here

#

You will suffer

river imp
#

This isn't Arma 3. The faster you stop making the comparisons the better off you'll be

minor agate
#

And performance and mantainability will suffer as well

#

If you come from A3, then it's better to start from scratch and just learn to use the new tech

#

You might do some insane work for steering it on A3 way, for us to then later break it for you beause we do not intent those usages

#

And you will not get support on that part if that happens

drifting orchid
#

I know this isn't arma 3 because its a different engine, yea ik, but it just happens so reforger already has something similar I made and I'm trying to bring that into reforger

#

and it just happens so the reforger already has that system but just one thing seems to be off and this way seems to be much easier so I'm making that way

#

lool got it working

#

also guys the doc examples aren't updated, had to make a few adjustments to make it work

minor agate
#

Yeah a lot of them need updates

drifting orchid
#

so I managed to get this kinda working using BaseContainerProps, also it turns out I did have 2 use two refs to make it work

drifting orchid
#

why post a link to the channel?

#

O_O

minor agate
drifting orchid
#

ye sure

rancid belfry
#

Is there a way to get the location for the roads on any map and use it to set locations for spawn points?

river imp
#

yes

drifting orchid
#

so try find a way to get that road and use GetOrigin(), P.S: i used GetGame().GetWorld().QuerySphere to get the road

rancid belfry
#

i seen that they are RoadEntities but my issues is the there are different things attached to that like flower beds and what not, i originally started with a hand picked table but that isnt really clean and would only work for one map

river imp
#

Get the RoadNetworkManager from SCR_AIWorld, get the worlds bounds pass those bounds to RoadNetworkManager::GetRoadsInAABB and pass in an array of BaseRoads

#

Then you can get all the points from any of those BaseRoads and use those as spawn points.

rancid belfry
#

thank you

river imp
#

Extra credit if you can spawn an item at each road point facing the direction of the road

rancid belfry
#

is that necessary for an AI patrol point?

#

i wouldnt know where to begin with that

river imp
# rancid belfry is that necessary for an AI patrol point?

Idk, I use it for spawning vehicles on roads, by default everything spawns facing the same direction. For vehicles that would mean, depending on the road point, that it could spawn perpendicular to the road. Which is something I don't want in most cases.

pulsar tree
river imp
#

What are you trying to do?

pulsar tree
#

I moded a M112 with a different object and it is now in the FPV. I'm trying to get the object to not be seen when it is equipped in the right hand.

pulsar tree
river imp
#

What is it? Is it so big that you can't see with it in your hand?

pulsar tree
#

yes

river imp
#

Sounds like you should be using a different animation instance

pulsar tree
river imp
#

change it in the prefab

#

using player_main_heavy.asi as an example

pulsar tree
#

Plus when I tried to do it it didn't change the animation.

rancid belfry
river imp
#

VS

spark otter
#

Asking once again, what action is used to place a vehicle from the conflict building menu, like from a vehicle depot?

open pier
rancid belfry
#

look in SCR_BaseSupportStationComponent.c and see if that would have your answer?

#

@spark otter

river imp
dire sinew
#

Though if you want to override the behavior, you should do it on SCR_CampaignBuildingPlacingEditorComponent.

#

Unless you want the altered behavior for GM too.

sturdy pollen
#

how do i move the position of a component?

midnight talon
#

Or if you mean order of the component in the list, I don't think we have much control over that as half the time when I add a component it gets re-ordered somewhere else in the list next time I open prefab

sturdy pollen
#

sorry i could have made that more clear

midnight talon
#

ok yeah then you want to call set origin or transform on the entity you want to move

sturdy pollen
midnight talon
#

depends on the prefab setup, look at the relevant prefab and see how the child you're interested in moving gets attached and how it can be positioned

drifting orchid
#

I have tried looking into this, but can't find a way, is it possible to use threading in simulation similar to arma 3 spawn command?

#

which allows sleeps

#

I know there is a threading that only works for workbench plugins but I'm looking for a PIE solution

minor agate
#

Answer is: No.

#

But you have other ways to schedule things, or run things periodically.

#

Depending on what you want to do, one option might be best over the other.

#

What kind of logic do you want to do with that?

drifting orchid
#

optimization reasons, will go with CallLater 4 now

minor agate
#

Nor anything in the scripts do

#

So for optimization purposes, the only thing you can do is batching

drifting orchid
#

Yea already learned that

minor agate
#

Just do not use the Game CallQueue

#

it already causes freezes because of misusage

#

Make your own, and tick it on a system or the game loop

minor agate
drifting orchid
minor agate
#

Thanks, we will correct whatever it is suggesting regarding this

drifting orchid
scarlet iris
drifting orchid
#

really?, but the guy joked about having 2 refs in a variable while both in game & wiki code shows variables using it that way so I didn't know

dire sinew
drifting orchid
#

@Kex if you run a heavy operation like spawning alot of objects in a single code it can cause stutter or freeze, but if you divide it into queues like adding delays for each object spawn

#

it might reduce the stutter and make things run smoothly

#

though there is going 2 be some delays if ur spawning objects

#

that way

dire sinew
#

That has nothing to do with my question...

minor agate
#

So, using a global one for everything causes this to happen

#
  • There is extra benefit that when having it alone, you can control when your stuff actually gets called. While the global one is unorganized.
#

We see it internally many times being cause when seeing insane modded performance issues. And because this gets processed on main thread, other secondary threads that require scripts also get stalled. Like for instance the replication threads.

#

So suddenly you could cause a kick because of this, not to mention the performance decrease

#

What I recommend usually, is to create a single callqueue if you need it global, for your whole mod

#

That way you diminish the possibility of this to happen

manic carbon
#

GetPlayerControlledEntity when used inside an rpc call is not returning an entity, any suggestions?

minor agate
#

(Server, listen server)

manic carbon
minor agate
#

When exactly do you call this RPC?

dire sinew
minor agate
#

The thing is that it is was never planned to be abused like that

dire sinew
#

Fair enough

manic carbon
minor agate
#

And allowing that abuse, will just slow it down more on normal case

minor agate
manic carbon
minor agate
#

It seems you just sent the wrong thing as PlayerID

manic carbon
minor agate
#

GetPlayerIdFromControlledEntity should be used with the player character entity

#

As it will check the player id of the character/entity the player is controlling

#

It's why it is called PlayerID

drifting orchid
# dire sinew That has nothing to do with my question...

it does, might have confused it a bit, I was referring to a situation like where you might use a single queue to spawn alot of objects and that would cause stutter or freeze but you can use multiple queues with delays to spawn those objects so tons of objects won't spawn instantly saving u from lag issues

#

usually for stuff like that in Arma 3 I use the spawn command

dire sinew
#

No point in it, you probably didn't understand my question, but Mario answerd it properly already.

drifting orchid
drifting orchid
sinful scaffold
#

anyone knows how to set up keybinds for items that you have made?

dire sinew
#

No, especially with the anology of Arma 3. I would think the scheduled environment where your spawns get scheduled is also a single callqueue.

drifting orchid
#

I'm not talking about Arma 3 atm though

dire sinew
#

You still misuse the word queue. Your point probably is to spawn all objects in a single call instead of breaking it into multiple ones and schedule them in a queue.

#

Whether you do it with a single or multiple queues won't make much difference, unless one of the queues is already overloaded like the main one, as Mario said.

drifting orchid
#

ahh I might be wrong but shouldn't calling alot of queues with delays to spawn objects make the stutter lower? instead of spawning it all in one queue

#

I know queue runs on the main thread but I thought adding delays would still minimize the lag and make performance better*

dire sinew
drifting orchid
#

damn

#

I just looked up into spawn command in Arma 3, it doesn't run on a separate CPU thread, dang, I guess I got confused how threading works

#

my bad xD

#

I thought the spawn command ran on different CPU threads since you can use functions like sleep, but it seems even Unity and UE methods doesn't use multi-threading

#

guess I need to revise my programming skills as I was self taught mostly starting from Arma 1

red cedar
#

Is there a way to await the spawning of a prefab client side?

(Without using callqueues / frames events)

minor agate
#

Also wait for it where?

#

Detect on server that it spawned on client?

red cedar
#

I'm more interested in the client side

#

Just detect when a vehicle has spawned for the client without using callqueues, idk if there is some kind of event i can listen to by giving it the entity id?

minor agate
#

Detect if an entity spawned on a client, on the client itself?

#

You can just use EOnInit on the client

sleek moat
#

How would I go about adding a deliver task to a specific player with the new task system?

forest arrow
#

do we have event from garbage system or IEntity when entity is despawned\deleted?

sleek moat
#

I want to assign it all via script though

gloomy gale
#

Guys, I really need help if someone could offer some insight or point me in the right direction. Our server keeps crashing, a few times or more a day. At first I thought the below crash log was result of CRX AI causing this, but I cannot for the life of me find the mod that is causing the below crash log. I have crash logs, multiple times a day, with only the below log. Is this vanilla, is it a mod, and most importantly how do I stop this?

"09.12 2025 16:03:28
Virtual Machine Exception

Reason: NULL pointer to instance

Class: 'SCR_AIGroupCohesionComponent'
Function: 'AwardXPToGroup'
Stack trace:
scripts/Game/AI/Components/SCR_AIGroupCohesionComponent.c:206 Function AwardXPToGroup
scripts/Game/AI/Components/SCR_AIGroupCohesionComponent.c:224 Function CheckGroupCohesion
scripts/Game/game.c:866 Function OnUpdate"

Thanks in advance.

kind widget
#

Check last messages in console.log right before crash, this might help (not really, never helped me in 1.6)

gloomy gale
#

oh virtual machine exception I assume. I am going to look at the console now

gloomy gale
kind widget
restive island
# kind widget Nothing really useful as always. I experience the same for past month.

Does this always show up in the crash log?
18:05:27.443 RPL : rpl::Pip::ProcessNetToGame 18:05:27.443 ENTITY : SpawnEntityPrefab @"{9430B94B5ED63B3C}Prefabs/Weapons/Rifles/HK416/VRT_Rifle_HK416_BLK.et" 18:05:27.443 ENTITY : Create entity @"ENTITY:4611686018427630110" ('GenericEntity','Prefabs/Weapons/Rifles/HK416/HK416.xob') at <1951.729980 59.000000 504.459991> @"{9430B94B5ED63B3C}Prefabs/Weapons/Rifles/HK416/VRT_Rifle_HK416_BLK.et" 18:05:27.443 ENTITY : SpawnEntityPrefab @"{613FC21D99F14DC5}Prefabs/Weapons/Attachments/Lasers/anpeq15/Laser_NGAL_BLK.et" 18:05:27.443 ENTITY : Create entity @"ENTITY:4611686018427630111" ('GameEntity','Prefabs/Weapons/Attachments/Lasers/anpeq15/NGAL.xob') at <1951.729980 59.000000 504.459991> @"{613FC21D99F14DC5}Prefabs/Weapons/Attachments/Lasers/anpeq15/Laser_NGAL_BLK.et" 18:05:27.443 DEFAULT (W): Provided entity is not valid for procedural animation. ()

rancid belfry
#

Is there a way to filter Land vehicles from Air and sea, right now im having this issue where boats are spawning on land and AI cannot fly helicopters

timid citrus
#

We don't have access to ping via script right?

restive island
#

GM ping or OS ping?

#

I'd think GM ping would be accessible

timid citrus
restive island
#

Is the logic for what counts as getting an XP reward in the engine? eg I want to give XP to players that dance a lot so the psuedo code would be like:
if duration(player.action(Dance_Mod)) > 5 minutes:
XPReward(500);
XPAlert(Dancing());

ornate sonnet
#

Yo Im kinda new to workbench and enfusion and modding. working on my first project right now. Im having trouble getting Workbench to recognize my scripts The script is written and it compiled with 0 errors. Now I'm trying to Add Component to en Entity in World Editor but my script does not show up in the search. Feels like I've tried everything - makling sure class designation is correct. making sure file path through 'Addons' 'Scripts' and 'Game' is correct - restarting enfusion. Nothing workls. If anybody has any advice id greatly appreciate it. I can send screenshots etc if seeing what iI have would help

#

for context, what you should see here in the screenshots is my file path leading to script, my search for the script in the Add Component part of World Editor which does not work - search comes up empty, cant find the script (im trying to add it to the prefab ANPRC radio) . and the code for the script itself in script editor

ocean needle
#

YourAddon/Scripts/Game/.../file.c
structure should be like that iirc

#

YourAddon being the existing addon folder

ornate sonnet
#

srry theres the script photo, my bad, first photo didnt show the top of page

ornate sonnet
ocean needle
#

no

#

in your case its e.g. RadioBat/Scripts/Game/RadioBatComponent/SCR_RadioBatComponent.c

#

also dont use SCR make your own tag like LBL or something else

ornate sonnet
#

okay, ill try that. thought it had to SCR for it to work

ocean needle
#

no its just a "per author" tag
SCR is vanilla stuff for example

ornate sonnet
#

will it still technically work with SCR thEN?

ocean needle
#

i think having a tag matters for some script editor plugins or other things though, not too sure

ornate sonnet
#

ooooh like this! I got it nopw, thank youi for your help @ocean needle

midnight talon
#

Is there some way to set default values for array editor attributes?

Doing something like

    [Attribute("{921A76C90C54CDE3}PrefabsEditable/Auto/Compositions/Misc/CustomEntities/InteractionPoints/E_MO_Stash.et", uiwidget: UIWidgets.ResourcePickerThumbnail)]
    ref array<ResourceName> propWhitelist;

causes that entry to be populated by default when adding a value to the array, but doesn't make the array have that value by default. Is there some special syntax I can use for the default for WB to parse it as expected?

misty escarp
# gloomy gale Guys, I really need help if someone could offer some insight or point me in the ...

It's from Bohemia code, looks like cast for SCR_XPHandlerComponent fails and returns returns a null ptr that errors when trying to access a method on it. There's no error checking for the cast.

There's no other code in the function that can throw this error. Maybe a dev should look at it.
Dunno if it's possibly caused by an AI mod but you could try to remove and see.

You could probably yourself stop the crashing by overriding the AwardXPToGroupmethod in SCR_AIGroupCohesionComponent and adding a null ptr check, if you wanted

#

It's funny that the code example for Cast has the error check but in practice the implemented method does not

#

Though I will admit it doesn't make sense to me that it can return null in a real gamestate somehow

#

The AI mods could be doing funny things with the XP component. If you don't want to remove mods, overriding the method is easy

gloomy gale
#

also I removed the only AI mod I had given I thought it was potentially the AI mod as well. However, this started after I removed it for whatever reason

misty escarp
#

All you have to do is make a script override for that class in the Workbench. Copy paste the original source method into your overrided method. Then just add a couple lines of error check. Then build your mod and put the packaged mod files in the addons directory of your server. Edit the serverconfig.json file to add your mod's information.

#

If you have no coding or modding experience maybe it's a bit daunting

#

If you are just a server owner or hoster and don't really understand what I'm talking about it's ok. Just say so and I or someone else can give more in depth advice.

Especially as I am about to go to sleep and won't be able to respond soon. Maybe someone else will show up and give their advice and opinion on the matter. And maybe a dev can explain how the Cast can fail and why there is no error check

minor agate
#

And casting of a null to anything will return null

misty escarp
#

It gets the base from some Get functions and FindComponent call

#

I don't enough to know if it those can return null or the original reference freed or w/e

#

it is from Bohemia script maybe you can look and see? I don't see any other way to get null instance reference

tawny lotus
#

I'm spawning AIs to vehicles (cars, helicopters, ..). I find a free compartment slot and then use GetInVehicle. I forceTeleport and performWhenPaused. Most of the time all works nicely, but sometimes the AI are left where they were spawned on the map. They've done the sit down animation but exist in the world. See the AIs in the image just sitting there and not reacting.

Is there a better way or am I doing smth wrong?

inland bronze
#

Why does the OnMagazineChanged event handler fire twice when reloading? Am I misunderstanding something? 🤔

spark otter
# tawny lotus I'm spawning AIs to vehicles (cars, helicopters, ..). I find a free compartment ...

Here's how I do it: ```cs
// Get vehicle compartments
BaseCompartmentManagerComponent slotCompMan = BaseCompartmentManagerComponent.Cast(spawnedVehicle.FindComponent(BaseCompartmentManagerComponent));
array<BaseCompartmentSlot> vehicleCompartments = new array<BaseCompartmentSlot>;
slotCompMan.GetCompartments(vehicleCompartments);
// Loop through all group members
for(int j = 0; j < agents.Count(); j++)
{
AIAgent member = agents[j];
if(member)
{
SCR_ChimeraCharacter character = SCR_ChimeraCharacter.Cast(member.GetControlledEntity());
CompartmentAccessComponent CAComp = CompartmentAccessComponent.Cast(character.FindComponent(CompartmentAccessComponent));
// If not in vehicle, put in an open seat
if(CAComp && character && !character.IsInVehicle() && j < vehicleCompartments.Count())
{
BaseCompartmentSlot slot = vehicleCompartments[j];
if(slot)
CAComp.GetInVehicle(spawnedVehicle, slot, true, -1, ECloseDoorAfterActions.INVALID, false);
}
// If no more seats open, remove the member from the group and delete
else
{
group.RemoveAgent(member);
RplComponent.DeleteRplEntity(member.GetControlledEntity().GetRootParent(), false);
}
}
}

oak thorn
sweet badger
midnight talon
inland bronze
# oak thorn Maybe the "change" is to no magazine, then when you put the new one in it change...

this actually seems to the be the case, so adding a check like so seems to prevent it from firing twice, and only once if needed like so (all this for reference for others):

//------------------------------------------------------------------------------------------------
protected void OnMagazineChanged(BaseWeaponComponent weapon, BaseMagazineComponent magazine, BaseMagazineComponent prevMagazine)
{
    if (magazine)
    {
        <perform code here>
    }
}```
midnight talon
#

Has anyone had any weird issues with SCR_UniversalInventoryStorageComponent.ShouldHideInVicinity() result seeming to get cached for other entities?

I have the following override so that my loot containers are hidden from vicinity:

modded class SCR_UniversalInventoryStorageComponent : UniversalInventoryStorageComponent
{
    override bool ShouldHideInVicinity()
    {
        IEntity owner = GetOwner();
        bool isLootSpawn = DL_LootSpawn.Cast(owner);
        PrintFormat("DL: ShouldHideInVicinity(): %1 = %2", owner, isLootSpawn);
        if (isLootSpawn)
            return true;
        
        return super.ShouldHideInVicinity();
    }
}

When this override is enabled, the hidden loot containers will cause other storages which should not be impacted to become hidden in vicinity such as vehicles and backpacks. I can confirm from logs that the method is returning false for these entities, yet they remain hidden.
For some weird reason, dropping an equipped weapon seems to magically fix it ??? confuseddog

desert escarp
#

@torn bane I remember you mentioning that now in 1.6 dedicated server clients that close and relaunch will retain their player IDs, I cannot for the life of me get that to work however, everytime I close the client and reopen it, it connects as a brand new player

desert escarp
#

Is there anyway to see if a prefab inherits another prefab

#

For example if an object inherits Bush_Base

restive island
desert escarp
#

In script

#

I've worked around it by using the sound type of the tree object

restive island
#

i dont think ive ever heard anyone use trees to make something work coolfrog

craggy jolt
#

My current goal is for owner/authority to know transformation from proxies of an entity. As there is no way to replicate properties or rpc call from proxy to owner/authority, what would be a good way to do this?

#

My current guess would be making a player controller component that would pull needed entities proxy data?

midnight talon
#

Looking at how the edit mode building placement is done might give you some direction, IIRC it essentially does a similar thing to what you're going for where client sends local transform of placed preview in a request to server asking it to spawn the entity with that transform

torn bane
deep temple
#

Hello in RestContext the FILE and FILE_NOW functions are currently marked as obsolete with “Not supported, will be removed!”. Do you plan to update them or integrate a similar feature in the future ?

torn bane
timid citrus
#

Any word on FindController fix?

#

It's kind of got me at a standstill.

Are we looking at 1.7 or before?

tawny lotus
tawny lotus
# spark otter Here's how I do it: ```cs // Get vehicle compartments BaseCompartmentManagerCom...

Pretty much the same as I do/did. I'm prioritizing pilot and then gunner to fill in the seats. Before selecting the slot, I check that it is not occupied, it's accessible and it's not reserved. Seems that adding an AI to a compartment, does not immediately make it reserved. Now, if you immediately try to add another AI there, it will "succeed". Eventually when the AI is set in the seat, there might be another AI already sitting there -> AI sits outside. This seems to be my issue. Doing a .SetReserved() for the compartment after assigning the AI to it, seems to solve my issue.

fringe prairie
#

Next big release probably

#

Just use modded player controller

timid citrus
fringe prairie
#

Yeah I did that too

timid citrus
#

Damn

fringe prairie
#

Then had to undo it all

timid citrus
#

I ain't undoing anything lol

fringe prairie
#

Guess you are waiting

timid citrus
#

Yep

#

I guess I'll start practicing map design work

fringe prairie
#

The systems are fine (despite running on both server and client regardless of init info)

timid citrus
#

All my systems are running fine.I just can't get the player controller to attach a camera to when I spawn

fringe prairie
#

Just need to make sure to check rpl role

timid citrus
#

It should be on both but I will have to double check when I get home.Thanks

tawny lotus
midnight talon
spark otter
desert escarp
#

Had the same issue and this was the solution I came up with lmao

tawny lotus
lethal ridge
#

is there anything that exists in the game to detect elevation and set off a trigger, or will i have to create this myself?
the best i can think of now is offsetting the projectile's collisiontriggercomp by my desired distance, but that seems very wack and has a chance of detecting things i don't want it to even with an arming distance.

inland bronze
#

Is there a reliable way to determine the type of terrain an entity is sitting upon? For example, to determine if a entity is on dirt versus being on a rock/road/etc

#

Maybe by getting the game material of the collider..?

inland bronze
# inland bronze Is there a reliable way to determine the type of terrain an entity is sitting up...
//------------------------------------------------------------------------------------------------
//! Is the buriable entity sitting on top of a buriable material?
protected bool IsOnSoil(IEntity buriableEntity)
{
    TraceParam paramGround = new TraceParam();
    paramGround.Start = buriableEntity.GetOrigin() + (vector.Up * 0.1);
    paramGround.End = paramGround.Start - vector.Up;
    paramGround.Flags = TraceFlags.WORLD | TraceFlags.ENTS;
    paramGround.Exclude = buriableEntity;
    paramGround.LayerMask = EPhysicsLayerPresets.Terrain;
    buriableEntity.GetWorld().TraceMove(paramGround);
    GameMaterial material = paramGround.SurfaceProps;
    
    if (material.GetResourceName().Contains("soil") 
    || material.GetResourceName().Contains("dirt") 
    || material.GetResourceName().Contains("grass") 
    || material.GetResourceName().Contains("gravel") 
    || material.GetResourceName().Contains("sand") 
    || material.GetResourceName().Contains("pebbles"))
        return true;
    
    return false;
}
``` seems to work how I want, reference to others in the future
quaint basalt
#

Probably weird question
Can we dynamically cast Managed object to some class, knowing its typename?

solid hearth
#

Huh?

quaint basalt
#

I mean what i a correlation between typename and class
for example

SomeComponent.Cast(entity.FindComponent(SomeComponent))
is basically
Class.Cast(entity.FindComponent(typename))

Now I have typename, and I can get entity.FindComponent(typename) but I still have to cast it to original component

misty escarp
#

Also you don't need to cast it to original component that is wrong, it can be downcast or upcast

vernal moat
quaint basalt
quaint basalt
minor agate
#

Managed inherits from Class

misty escarp
misty escarp
minor agate
#

pointer class has null as parent

#

and Class has null as parent

#

etc

#

There is no Null type class

quaint basalt
#

Well yes I can get type but compiler won't let me cast to type, only to Class

minor agate
#

by null I mena that it has nothing o n cpp side

minor agate
#

But it will be considerably slower, so do not use it for hot areas

#

Enforce Script is compile time, so it can't "figure out" the class type to be compiled after compilation. It does not make sense

#

So you have to do it at runtime

quaint basalt
#

Got it.
Thank you again

late locust
#

Are GameSystems not automatically paused on GameTimePaused?

#

Oh nvm, its false on default blobcloseenjoy

    override bool ShouldBePaused() 
    {
        return true;
    }
past berry
#

how to angle decal same with player.GetYawPitchRoll();

#

I use CreateDecal and angle param little bit confusing

past berry
#

T196480

river imp
#

yaw* Math.DEG2RAD

wind warren
#

Hey guys I've been learning this from scratch just a couple questions.

Are base game functions pre scripted?
If I want to create a standard area capture game mode do I have to manually script in every area and score for each side or is that pre-scripted ?

Lastly any pointers or tutorials for beginners?

river imp
# wind warren Hey guys I've been learning this from scratch just a couple questions. Are bas...

Take a look at https://enfusionengine.com/api/redirect?to=enfusion://ResourceManager/~ArmaReforger:worlds/CaptureAndHold/CAH_Arland1.ent
or one of the other CAH worlds to get an understanding of how it all works.
I would also suggest to read everything on both of these pages, in order.
https://community.bohemia.net/wiki/Category:Arma_Reforger/Modding/Scripting/Guidelines?useskin=vector&useskin=darkvector
https://community.bohemia.net/wiki/Category:Arma_Reforger/Modding/Scripting/Tutorials?useskin=vector&useskin=darkvector
Someone with little to no experience with Object Oriented Programming and the Entity/Component System is gonna have a rough time writing scripts until they at least have a basic understanding of both.

wind warren
#

Thank you so much, yeah I'm not familiar with the class or call functions so far it mostly looks like typescript.

maiden goblet
true haven
#

Hello, in my server while we are with GM no matter what it shows this in console, spamming all time

#

You can still play but it accumulates in logs

queen furnace
#

Does anyone know how to patch the wcs_loadouteditor issue?

drifting orchid
#

anybody know how can I retrieve the spawned units of a SCR_AIGroup?

#

nvm found it xD

#

also I just realized intellisense auto completion doesn't show all methods when you type it like this

#

not sure if its a bug or not

#

I guess its a bug

drifting orchid
#

guys how can I add a component to an entity through code?, have been exploring wiki and intellisense auto completion I don't see something like adding a component through code

#

ping me @ if u have a answer

inland bronze
drifting orchid
#

oh I see, its not like Unity

misty escarp
drifting orchid
#

u sure? because I don't see that option

#

yea its not there

#

_<

misty escarp
#

Don't know that means, it's there. You need an actual entity object to use the method

drifting orchid
#

nope

#

no method called AddComponent

#

just checked the definition of IEntity

inland bronze
#

it doesn't exist, not sure where chance is coming up with that

drifting orchid
#

there isn't a method defined addcomponent

#

is it possible to store a custom variable in an entity similar to Arma 3 setvariable u guys?

#

if there is a way then I don't need to add a component in runtime

#

oh wait I guess u could make a dictionary

inland bronze
#

What's the thing against adding a component to it?

drifting orchid
#

well storing the SCI_AIGroup entity as a key and for a value storing the information I want, kinda stupid but works

#

I think will

river imp
#

If you need a component to exist on all entities of one type just add it to the base prefab that they all inherit from.

drifting orchid
misty escarp
drifting orchid
#

the page is untitled 4 me

#

anyway its fine I can use dictionaries

river imp
#

It was just a link to the base prefab for groups

drifting orchid
#

I don't think you can modify a base prefab part of the engine or provided by BI not sure and also it wouldn't be a good idea

river imp
#

If you want links to work

#

You can modify any prefab you want.

drifting orchid
#

yea but what if another mod happens to modify that same prefab?

river imp
#

The modification stack

drifting orchid
#

will it override completely? or add?

#

Oh

#

still gonna go with dictionary though

river imp
#

Cool

mild quarry
# minor agate <@399706661369020437> NEVER call anim graph stuff on NON OWNERS or NON AUTHORITY

I call the anim commands from the SCR_CharacterCommandHandlerComponent like:

override event bool HandleWeaponReloading(CharacterInputContext pInputCtx, float pDt, int pCurrentCommandID) {

    // if(!rplComp.IsOwner()) return; // This is where I filtermy rpl ownership checks

    if (condition) {
        charAnimComp.CallCommand(myCharCommand, 1, 0.0);
        weapAnimComp.CallCommand(myWeapCommand, 1, 0.0);
    }
}

On multiplayer, if I call from this rpl perspective, the proxies see the anim on:
Anyone:

  • Char: Yes (but buggy)
  • Weapon: No
    Owner:
  • Char: Yes
  • Weapon: No
    Authority:
  • Char: No
  • Weapon: No

I have only been able to get the weapon anims to show if I Rpc and broadcast it to proxies, but it's way out of sync. All commands are synchronized and all commands are bound. Where am I going wrong?

pliant ingot
misty escarp
#

It would be smart for every mod developer to not just stack all their components on the same overrided prefab, and instead use their own derived/duplicated class as a new base for their mod

#

But it depends if you want to add a component that truly affects all child classes of that base, and not just your own mod's stuff

drifting orchid
#

guys is it possible to PIE as two separate clients similar to UE?

#

or do I need to publish my mod