#enfusion_scripting

1 messages · Page 25 of 1

restive island
#

yea still looking through that

restive island
#

Looks like it's registering to the coordinates of the command tent. annoying, but I could probably use that instead of base names
SCRIPT : GenericEntity<0x000002A6BCE7A340> @"ENTITY:6917529027641083271" ('GenericEntity') at <2769.705322 76.283035 1638.779663> @"{C02498D55CF377AF}PrefabsEditable/Auto/Systems/Compositions/BaseLogic/E_MilitaryBaseLogic_US.et"

river imp
#

Continue to look through the scripts, that logic is attached to a military base at some point.

restive island
#

SCR_MilitaryBaseLogicComponent or SCR_MilitaryBaseComponent? Pulling the unique ID for them from SCR_MilitaryBaseLogicComponent .RegisterBase(), guess that's better than XY coords. SCR_MilitaryBaseComponent.GetCallsignDisplayNameOnly() probably has something, gonna need to make a whiskey run

river imp
restive island
#

yea we got the prefab localstring being spawned (changed it to the filename since updates change my prefab configs), but i dont think we finished what base name they're registered to 😄

river imp
#

Well, the U.S. ones can only be spawned by the U.S, if you're wanting to have only the first one be full and the next ones to be empty the logic is pretty simple, it seems as though now you're trying to limit based on the specific "FOB" that's spawning them?

restive island
#

that's correct, the first built at each base is set to 100%...otherwise they're empty.

#

so if it's the first fuel depot/light veh depot/heavy veh depot/helipad built at each base, it's at 100%. Else they're empty

#

future version will let GMs turn that on/off/custom setting, but thats off in the future

hallow portal
#

Anyone have the script location to disable players from commanding AI into entering a Vehicle/emplacement

leaden quartz
#

Real quick question, are there any ways I can add lines to a script without outright replacing the whole script? I see this being an issue for mod compatibility, so I'm asking. I know in modding software, you can usually add hooks, but im not too sure how to do something similar here.

midnight talon
candid garnet
leaden quartz
#

Okay so, i just need to spend more time learning c# keywords
thank you!

candid garnet
#

C# translates well. There's a few missing features but the gist is there

midnight talon
#

yeah general best practice with overrides is you should call super.Method(args) of the same method so you don't "clobber" any underlying logic from vanilla game or other mods, unless you specifically want to skip logic from the inheritance ancestry you're overriding

#

in some cases there is a script invoker or event you can bind a callback method to which is ideal to hook logic into something, but a lot of classes don't have them so you'll either need to add your own or add your logic to method overrides directly in those cases

leaden quartz
#

okay yeah. i should've just watched forward in the dev video. I really like getting ahead of myself lol

restive island
#

Is there a way to add components to prefabs (vanilla and editable) via scripting? Right now I have to add 2 components and alter 1 existing one via GUI.

river imp
restive island
river imp
#

Are you using the plugin for making changes to editable entities or are you just trying to edit them?

restive island
#

For making changes to the Editable entries. I modify vanilla first, then generate the Editable. Then edit the spawning items that Editables have

#

Both variants use the same Component settings, but the Editables don't always work like their counterpart does.

river imp
#

There are plugins for that.

restive island
# river imp There are plugins for that.

Yes I know. The Editable does not generate properly when using Override, and with Duplicate the Editable prefab won't always work the same like the vanilla prefab.

#

so if i can set it all via script, I can avoid dealing with the prefabs directly and hopefully that works

river imp
#

You can't add components to prefabs from script at runtime.

#

That will never be a thing you can do.

restive island
#

dang it

grave vessel
#

anyone got any clever ideas on how to remove clouds at a specific time with scripting (or any other way)? I tried this which works perfectly in the editor, but does not work in the actual game.

midnight talon
#

Tbh I always found most of the generator plugins unreliable so always created my editables by hand

midnight talon
restive island
grave vessel
smoky sphinx
#

Does anyone know any good videos over understand scripting in a simple way

restive island
trim nexus
#

can someone help me out with this it keeps brakeing

red cedar
trim nexus
red cedar
#

-_-

#

I can't help you when you only share one like, i don't even know what you use as key, well what gpt uses

trim nexus
#

bc this is the script and it keeps brakeing

red cedar
#

"it" doesn't "keep brakeing", it doesn't work because it's poorly made AI slop, in the case of the dictionary to fix it simply use the key, change GetBankMoney to

int GetBankMoney(IEntity player)
{
  return BankBalances.Get(player);
}

Now for the rest i am sorry but I am unwilling to debug AI code as from that screenshot alone i can see it hallucinated a LOOOT and basically made up a bunch of code that will never work and isn't even close to working.

Best of luck !

red cedar
#

You're welcome

clever oxide
#

Is there a function for check entity inside building? Like A3 "insideBuilding" command
I don't find example how AR check where need rain effect.
Closest match the SCR_DestructibleBuildingComponent's bool IsInside(notnull IEntity entity) function, but need find the closest building for it.
Its too many performance drop in user action's CanBePerformedScript function.
Or just need use TraceMove or TracePosition or UP vector?

restive island
red cedar
#

🚀 The system has started successfully (optimized version)

shrewd nova
cobalt shadow
#

NONE = 0,
BANDAGE = 1,
MORPHINE = 2,
SALINE = 3,
TOURNIQUET = 4,
AMMO = 10,
MG_AMMO = 11,
AMMO_MORTAR = 12,
FOOD = 20,
FLARE = 30,
BINOCULARS = 50,
COMPASS = 51,
FLASHLIGHT = 52,
RADIO = 53,
WATCH = 54,
BAYONET = 55,
EXPLOSIVE_CHARGE = 56,
MINE = 57,
DETONATOR = 58,
NIGHT_VISION = 59,
GPS = 60,
HAND_SLOT_ITEM = 61,
IDENTITY_ITEM = 70,

What do the numbers represent?

red cedar
river imp
red cedar
#

fair didn't think of that

red escarp
#

I’m evaluating different data storage approaches for a growing multi-server RP network: JSON files, MongoDB via Enfusion DB, or external MySQL through an API.

From a performance, async handling, and long-term scalability perspective, which architecture would you recommend?

Would waiting for 1.7 make sense in case there are improvements to persistence or database systems?

ocean kernel
#

FOOD | DETONATOR

#

Taco bell be like

restive island
#

What's the best way to cast one object to another in enfusion if I know what the type is? e.g. from type Resource to type EntityID:

Class Example
{
    void foo(Resource in)
    {
        Print(in);
        EntityID in2 = in;
        Print(in2);
    }
};
static tangle
#

Where do i start learning scripting?
I want to make new animations

pliant ginkgo
pliant ginkgo
static tangle
sweet badger
# restive island What's the best way to cast one object to another in enfusion if I know what the...

I think you are confusing some terms here.
IEntity is an thing in the world, this is very distinct from a Resource (which is basically though not technically a file, like e. g. a prefab, a material or a config).

You can cast classes using the Class::Cast(Class from) method, here is an example:

IEntity e; // some entity
SCR_ChimeraCharacter cc = SCR_ChimeraCharacter.Cast(e); // cast entity to character (SCR_ChimeraCharacter inherits from IEntity)
Print(cc); // will print a character entity, or NULL if either e was not a character or e was NULL itself

If you want to check simply whether a class inherits from another class, you can also use Class:IsInherited(typename type) instead of casting.

If you want to actually check what class a Resource contains (different thing), like for example whether a prefab is a character, you can do:

Resource r; // some resource
BaseContainer bc = r.GetResource().ToBaseContainer(); // base container

Then use BaseContainer methods like GetClassName().

However if you are indeed still confusing these terms, I recommend getting a more solid understanding of the foundations first, e. g. by reading https://community.bistudio.com/wiki/Category:Arma_Reforger/Modding/Scripting.

restive island
sweet badger
restive island
sweet badger
#

Oh you mean base in terms of Conflict, nvm

restive island
#

I can't find the correct output where I found the ID that relates to the base it was spawned at, but it was similar to the below:
"GenericEntity<0x000002A6A9C86760> @"ENTITY:6917529027641082754" ('GenericEntity','Assets/Props/Military/Fuel/FuelPump_US_01/FuelPump_US_01.xob') at <1012.185730 37.873810 2817.788818> @"{2DF0C0623E207C7E}PrefabsEditable/Auto/Props/Military/Compositions/US/E_LFD_FuelService_US_Conflict.et"

sweet badger
#

I think you're better off just generally describing what you're doing and want to achieve.

restive island
#

My mod makes fuel depots have limited gas. When a player builds a fuel depot or any service station that provides gas, I want to know what base it was created at and add the base name to an array. If it's the first fuel pump station built at the base, it's full of gas. Otherwise it's empty.

#

Setting the gas level is already figured out, it's grabbing the structure that was built and which base it was built at that I'm working on

desert escarp
#

How do I add custom attributes to an entity for GM to chage

candid garnet
restive island
static tangle
#

do i need to learn scripting to make a new option for dragging and carrying someone?

timid citrus
#

Yes

static tangle
timid citrus
#

You have to see how all the different files work together.It will seem convoluted at first, and it's boring tedious stuff.

static tangle
timid citrus
fervent stirrup
#

If a dev can answer me this. Are the new Attribute reflection functions part of typename staying for the future? And is .Spawn() staying?

fervent stirrup
minor agate
#

What are you doing exactly?

#

😅

fervent stirrup
#

I like experimenting

#

I have made some very interesting things

minor agate
#

They are staying

fervent stirrup
#

Yippie

#

I recall in the past there was a comment on the .Spawn function saying it was bad or something and that brought my mind to asking about it

fervent stirrup
#

wdym

#

Like for bohemia standards yeah

minor agate
#

it's better to create with new keyword

#

It's never better even on other languages to do similar

#

plus spawn does no respect all constructors

timid citrus
#

Any chance of getting a better physics api for modders?

minor agate
#

But spawn is useful if you for whatever reason got some typename from a string

#

And you are unable to do some switch with cases for them

minor agate
#

What do you feel it is missing?

fervent stirrup
minor agate
#

It's plain Bullet API

#

Some things like joints are missing though

timid citrus
#

Ok i'm not sure exactly.It just seemed like the public methods were very few.

minor agate
#

Why are you using everything we tell people to not use

#

but combined?

fervent stirrup
#

Oh you'd hate me

minor agate
#

Time for removals

fervent stirrup
#

NOOOO

minor agate
fervent stirrup
#

im having fun

timid citrus
#

But yeah, bone joints for things like hair and ropes would be dope

minor agate
#

Your workshop account too, due to unsafety. nice

#

It won't be removed but don't do features with that

#

At any point if it causes issues

#

We do go behind you and tell you to fix, help you fix it or whatever

#

if no fix and the thing is decreasing game stability then it gets banned

fervent stirrup
#

I wouldnt be running these things on clients

#

My server side stuff

minor agate
#

Servers count too

#

In fact server is worse

#

Unstable servers => Players unable to play in mass

#

But it has to be quite bad for that

#

Usually the issue can be resolved quickly

fervent stirrup
#

Well lets just say it will only work on my servers because its loaded by ScriptModule. And actually it seems pretty stable right now the way im handling it.

#

The stuff I release for public workshop use by other servers/players wouldn't have these things

minor agate
#

||Or maybe I am half serious|| PES_EvilRondo

fervent stirrup
#

Don't worry I won't crash people's games when this stuff comes out one day coolfrog

timid citrus
inland bronze
#

Kinda losing my mind a little, I can't get this area mesh's material for a trigger entity to properly replicate. I've looked at the RplDocs and examples on the biki, but still can't nail it. Anything I'm missing or not understanding correctly?

class CONVICT_CapturePointAreaMeshComponent : ScriptComponent
{
    [RplProp(onRplName: "OnCurrentMaterialChanged")]
    protected ResourceName m_sCurrentMaterial;

    //------------------------------------------------------------------------------------------------
    override void OnPostInit(IEntity owner)
    {
        if (GetGame().InPlayMode())
            SetEventMask(owner, EntityEvent.INIT);
    }

    //------------------------------------------------------------------------------------------------
    override void EOnInit(IEntity owner)
    {
        m_Owner = SCR_ScenarioFrameworkTriggerEntity.Cast(owner);
        
        if (m_Owner)
        {
            m_Owner.s_OnTriggerUpdated.Insert(OnUpdate);
            m_Owner.GetOnActivate().Insert(OnActivate);
            m_Owner.GetOnDeactivate().Insert(OnDeactivate);
        }
        
        GetGame().GetCallqueue().CallLater(SetRadius, 1000);
        GetGame().GetCallqueue().CallLater(DelayedInit, 1000);
    }
    
    //------------------------------------------------------------------------------------------------
    protected void DelayedInit()
    {
        SetCurrentMaterial(m_sVacantMaterial);
    }
    
    //------------------------------------------------------------------------------------------------
    protected void OnUpdate(float activationCountdownTimer, float tempWaitTime, int playersCountByFactionInside, int playersCountByFaction, string playerActivationNotificationTitle, bool triggerConditionsStatus, float minimumPlayersNeededPercentage)
    {
        if (!m_Owner)
            m_Owner = SCR_ScenarioFrameworkTriggerEntity.Cast(GetOwner());
        
        if (m_Owner)
        {
            if (playersCountByFactionInside > 0)
            {
                if (playersCountByFactionInside > 1)
                {
                    SetCurrentMaterial(m_sEnemyWithinMaterial);
                }
                else
                {
                    SetCurrentMaterial(m_sInProgressMaterial);
                }
            }
        }
    }
    
    //------------------------------------------------------------------------------------------------
    protected void OnActivate()
    {
        m_Owner.s_OnTriggerUpdated.Remove(OnUpdate);
        m_Owner.GetOnActivate().Remove(OnActivate);
        m_Owner.GetOnDeactivate().Remove(OnDeactivate);
        
        SetCurrentMaterial(m_sFinishedMaterial);
    }
    
    //------------------------------------------------------------------------------------------------
    protected void OnDeactivate()
    {
        SetCurrentMaterial(m_sVacantMaterial);
    }
    
    //------------------------------------------------------------------------------------------------
    protected void OnCurrentMaterialChanged()
    {
        GenerateAreaMesh();
    }

    //------------------------------------------------------------------------------------------------
    protected void SetCurrentMaterial(ResourceName material)
    {
        if (m_sCurrentMaterial == material)
            return;
        
        m_sCurrentMaterial = material;
        Replication.BumpMe();
        GenerateAreaMesh();
    }
}
desert escarp
#

I believe Ark said so long as it wasnt abused and allowed players to import material against the games rating itd be fine. In this case itd just be offloading briefing images to a webserver the players can request from so our mod isn't bloated with gb of images.

red cedar
#

I have this little method of mine that's guilty of causing memory leak impacting mostly server with lower ram available

[RplRpc(RplChannel.Unreliable, RplRcver.Server)]
    void SyncCameraData(KE_CameraData data)
    {
        if(!m_spectateComps ||
        m_spectateComps.Count() == 0)    {return;}

        foreach(KE_SpectateUserComponent spectateComp : m_spectateComps)
        {
            spectateComp.RpcDo_UpdateCameraData(data);
        }
    }

I assume the reason is because the data is sent every post fixed frame and that the server is basically instanciating ~30 instances a second of KE_CameraData , would there be a more optimized way to go about doing the same ?

Maybe rplprops with rplconditions ???
But even then the data still has to be sent from the first client to the server.

#

idk if that qualifies as an actual memory leak but it's def spiking up the ram usage a bit.

minor agate
desert escarp
minor agate
#

from web

#

But yeah if it becomes vector of abuse that could cause issues with the ratings, then it will be handled somehow

#

We'll deal with it if it happens

#

for now we want to just keep it open

desert escarp
#

Alright Ill have it locked down so there's not a rainbow six siege situation

solid hearth
#

Time to make a problem out of nothing, I love chaos.

fringe prairie
#

@minor agate does set target transform work on non kinematic entities? I think an entity has to be kinematic for it to function because it’s the process of taking something that is physical but does not react to physics, and moving it to a different place. I think that’s why it did not work for the helicopters when I tried using it.

pliant ingot
red cedar
# pliant ingot What is CameraData?

I should rename the class as it's kind of more general now, but it's a class that implements a codec and is meant to send client sided data from a player being spectated to "spectators"

#

Would it help if i send the whole class or not really?

pliant ingot
red cedar
inland bronze
#

With setting it to authority, the material does not change at all now, but seems that it's because OnUpdate isn't firing for authority?

pliant ingot
red cedar
#

The way I'm filling it isn't really the issue, on the client's side i reuse the same instance the whole time, it's really just the server side that takes a slap from it, for most communities it's fine, it's an acceptable trade off but to others that don't have a whole lot of spare ram it becomes more of an issue

pliant ingot
#
  1. Not sure how enforce align members, but if it's same as C/C++, it will be better to sort members from big to small
red cedar
#

Hmmm

#

I'll test it out and see if i can see any difference

#

Thank you for your help, was kind of hoping there would be a magic trick to get around my problem 😭

pliant ingot
red cedar
#

Then maintainability would suffer and i think i have too many variables now to send it all using params. I'll try out your suggestions and see if they help and if not then it's joever

inland bronze
inland bronze
pseudo merlin
#

Someone know's if the QueryEntitiesBySphere has a minimum radius?
Somehow it feel's like it doesn't go below 1.0.
I tryed 0.05 but it's still finding stuff not even close to this range.

ocean kernel
#

If you want physics then do a line trace maybe?

pseudo merlin
red cedar
#

My dumbass sent this to the wrong channel

-> Would this be a proper way to implement request callback now since OnSuccess it obsolete ?

class SDS_ConnectUserCallBack : RestCallback
{
    private int m_playerId;
    

    
void SDS_ConnectUserCallBack(int playerId)
    {
        m_playerId = playerId;
        SetOnSuccess(ConnectUserOnSuccess);
        SetOnError(ConnectUserOnError);
    }
    
    private void ConnectUserOnSuccess(RestCallback cb)
    {
      // do stuff
    }
private void ConnectUserOnError(RestCallback cb)
    {
        LogBackend("SDS_ConnectUserCallBack.OnError " + cb.GetHttpCode(), LogLevel.WARNING);
    }
}
#

also i noticed that if we disconnect a user shortly after a user is connected we get this silly error and some really cool nullptr spam at

    SCR_PlayerFactionAffiliationComponent GetPlayerFactionComponent_S(int playerId)
    {
        return SCR_PlayerFactionAffiliationComponent.Cast(GetGame().GetPlayerManager().GetPlayerController(playerId).FindComponent(SCR_PlayerFactionAffiliationComponent));
    }
#

nvm for the assertion failed, it just trigger whenever the peertool leave the game

static tangle
#

How long would it take someone (A complete beginner) to make a script for reforger?

red cedar
static tangle
red cedar
#

In that case if you have c++ experience it shouldn't be too hard(assuming you have actual experience on it not just printing hello world).

I think within 2 months you can learn the basics, how replication works etc. And after maybe 3-5 months you'll start feeling confident in the workbench and feel like you can pretty much do "anything you want".

#

You'll be able to get features done before that, but there will be a lot of guessing and banging your head against the wall

static tangle
red cedar
# static tangle Anything you can recommend to speed up the process?

Watch the bootcamp videos, especially the ones relating to scripting and replication.

Watch it fully and pay attention/follow along, it's basically like a lecture.

Do not use AI it will sabotage you.

And also do not hesitate to ask questions, i learned literally by asking the stupidest question out there(just above there is an example of one)

static tangle
#

is SQF also like C#?

boreal swan
red cedar
# static tangle https://www.youtube.com/watch?v=06cfuZ4nCFY ?

https://reforger.armaplatform.com/news/modding-boot-camps-introduction

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

Join Modding Supervisor Mario EnrĂ­quez for our first Modding Boot Camp, where he gives a quick overview of the Arma Reforger Tools and Workbench.

00:00 - Modding Boot Cam...

▶ Play video
static tangle
#

@red cedar @boreal swan im learning scripting for animations and keybinds, so i have an early goal to achieve, so think that will help

static tangle
#

What can i do with enfusion scripting? what does it cover?

  • mission making
  • gui
    ??
open pier
restive island
static tangle
candid garnet
static tangle
#

@red cedar
1)Where should i start? i understand all of the enfusion tutorials and biwiki tutorials
2) How much faster can i learn following someone who can enfusion script?

candid garnet
#

If you learn how ECS works, you can jump right in.

static tangle
candid garnet
#

Entity Component System

#

It's how you'll find your entry points

#

Most game engines use ECS

static tangle
lean moth
#

You’ll still need to watch the bootcamps, or other tutorials to figure out how the workbench system works, but it’s all fairly easy.

candid garnet
#

Just so you know, if the LLM doesn't do it fully right, almost all of us won't spend time to fix it for you. You're on your own with it.

And before anyone comments on the LLM hate in this discord, it's not LLM, it's the "I asked chatgpt and it's not working, how do I fix" questions.

ocean kernel
#

AI bad

red cedar
#

Personally what taught me a lot is trying to make something that's similar to what already exists

#

For example you can flush toilets in the game, look how it works in the workbench and do something like being able to "wash your hands" using a sink

static tangle
red cedar
# static tangle where do i find the flush toilet script? will give it a look

Create a blank mod,

find one of the toilet prefab(won't tell you how).

Override it in your mod and open it.

Open "ScriptedUsetActionsManager" or "ActionsManager" and try to find it inside.

Alternatively you can open the script editor, set the search scope to "entire solution" and search by keywords like "flush" "toilet" etc, etc.

That's how you'll learn a lot

static tangle
red cedar
static tangle
red cedar
static tangle
static tangle
red cedar
static tangle
red cedar
#

watch the bootcamp

  • 1 Introduction
  • 2 Modding patterns
  • 5 Replication basics
  • 6 Advanced replication
  • 4 User interfaces

And then the animations etc (if you want to focus on scripting first)

static tangle
red cedar
#

best of luck, it's a bumpy road

static tangle
restive island
red cedar
# static tangle you still think its a 2-5 month journey?

before you feel comfortable in what you're doing and can pretty much do features you want then yes, once again before that you'll probably get a few things done but with a lot of banging your head against the wall, and eventually you'll know where to look for to find exemple of code you can reuse etc.

static tangle
restive island
#

then maybe not 2-5 months, all depends on how much you spend in the enfusion editor tbh.

red cedar
#

That's also a good point, for me it took me about that time before i started feeling comfortable with replication etc, but i'm also studying on the side and don't have a whole lot of free time

#

but regardless it won't be a two week kind of thing

red cedar
#

Data science

ocean kernel
#

new pfp

restive island
# static tangle yeah

ive never had to deal with OOP but I know python and some powershell. OOP is just more sophisticated data management and control, i dont think enfusion script has pointers though FWIW

red cedar
restive island
red cedar
#

you mean notebook ? yeah a bunch of it, tho i use the VScode extension because i hate the jupyter environment

#

and also a whole lot of lovely math !

ocean kernel
#

Jupyter's biggest advantage is inline rendering of plots

#

Idk if it has any other advantages tbh

restive island
#

i mean, Jupyter looks and sounds cool

red cedar
static tangle
midnight talon
#

For simpler scripts most of the work is finding the best entry point for your logic, so a good place to start is deciding on some small thing you want to change then dive in trying to find where/how you can change that

#

For most common things modders could want to do there is likely some example of similar behaviour in vanilla scripts you can use as a reference

fringe prairie
#

ef328637-4efd-4d71-84e2-bf25a05f920d

Can someone (at BI) help me with this crash ID by chance? Seeing some more crashes with my mod and not sure what is instigating it. This happened in workbench while fiddling through the debug menu. Maybe it was related to that, maybe not.

candid garnet
fringe prairie
#

Yeah, console log showed the typical "illegal access violation" with addresses

ocean kernel
#

Doxxed

boreal swan
#

Would it be possible to use dependency inversion principle (from SOLID) easily in Enforce Script? I'd assume that nothing prevents it but just wanted to make sure

red cedar
#

I'm trying to set up DSTool to be able to try and implement my own RCON commands however it says my config is invalid, any idea what i'm doing wrong ?

I haven't really toyed with server configs a lot so i assume i'm doing something wrong but no idea what.

torn bane
midnight talon
#

also try pasting it into a JSON validator (tons of online tools and browser extensions) to make sure it's valid JSON

red cedar
#

Mine isn't on the workshop

midnight talon
#

I think even unpublished mod should have a UUID in its .gproj file right?

#

anyways if it detects and loads your mod probably that isnt the problem

red cedar
#

The mod id is likely not the issue in here

#

It just says that the config is not valid then closes the server

static tangle
#

Does scripting and config go hand in hand? or overlap? or?

torn bane
torn bane
red cedar
#

so i should use the GUID instead ? fair

static tangle
red cedar
#

uh oh NUCLEAR BOMB

torn bane
pliant ingot
red cedar
inland bronze
#

Is there a way to spawn a turret already being manned through script?

clever oxide
static tangle
#

Where do i start? i want to learn scripting? animation based? Have watched the Bootcamps

red cedar
#

any idea on what can cause my client to be stuck loading here (dedicated server tool), most relevant log i can find is Can't open config file "" but other than that i don't really know

red cedar
#

and if i can't specify the addonsDir then i'll crash out

static tangle
red cedar
#

making progress, now my issue is Addon 'KittenEyeCore' not found but i am pointing to the correct folders so i'm kind of confused.

I also tried renaming the folder so it match exactly the "KittenEyeCore" thingy but to no success

red cedar
#

still the same loading error i give up

static tangle
crimson star
#

dddddddddddd

timid citrus
red cedar
#

Furbezzy, i'll be fully honest with you i find it pretty rude that you ping me all the time, and in multiple channels.

I understand that you're in the middle of a lengthy learning process, but still. I'm not paid for helping out i do it on my own free time when i feel like it.

Sometimes like now i work on my own stuff because i want to.

I also don't want to walk someone through the entire process, i gave you the basic to get started, now you're the one who has to put in effort to learn.

If you have specific questions or issues and need help i'll be happy to guide you a little (when i'm free ofc) but you can't just ping people to get assistance that's disrespectful.

static tangle
#

Ok, will take the advice and know that it will take me months to learn, and there is no fast work around, 👍

ocean kernel
#

Weird approach tbh. More efficient to set some kind of specific goal (I want to make this or that) and try to work toward it than "just learn scripting"

static tangle
#

i want to learn how to script for animations primarily

red cedar
#

I don't think animations require scripting?

#

Tbf i never toyed with them but i'm pretty sure they have their own tool for that

static tangle
#

scripting is required even in animation editor, plus, i want to include new animations that have actions behind them, e.g dragging a person, and medical

red cedar
#

Oh okk fair

ocean kernel
#

Signals and animation commands, events I guess

#

Animation system is much tougher to learn than scripting since it's designed to be annoying

red cedar
#

I'm glad i haven't toyed with those yet then

#

btw bacon, if you have the time. do you have any idea what can be causing my dedicated server tool users to be perma loading ?

Im knid of crashing out i've been stuck at it for hours now :(

ocean kernel
#

whatever the logs say it is

#

does peertool work?

red cedar
#

yeah peertool works fine

ocean kernel
#

do you really need dedicated server tool?

red cedar
#

I'm trying to set up RCON commands so yeah ig

ocean kernel
#

just test them in chat

red cedar
#

i want them to be ran from tools outside of reforger

#

for example a backend

ocean kernel
#

wait in this case why do you need users

red cedar
#

to kick them out

#

but ig i could a command that print it out

ocean kernel
#

rcon commands and chat commands work the same way just different method

#

mostly

#

you can also try just running the server using diag server exe

#

and connecting using diag client exe

red cedar
#

i'll give it a try then

#

ty

#

i hate this DSTool... too complicated for my smooth brain

ocean kernel
#

chances are it just doesnt work

red cedar
#

well it did work until i introduced the config.json that i need to set up the listening adresses etc.

Now it doesn't so it's most likely a mistake on my end (probably?) idk i'm pretty confused

#

when i was simply sticking to giving it a world, scenario using the UI of the tool it was fine

midnight talon
red cedar
#

HELL YES

#

i love you bacon

pseudo merlin
#

Me 2! meowheart

serene fox
#

What is better to update a Camera Transform on Proxy side?
GetGame().GetCallqueue().CallLater(REAPER_UpdateDisplayData, 1, true);
Or
SetEventMask(owner, EntityEvent.VISIBLE);

upbeat lion
#

Hello everyone, I hope you are all well. I have a question. I am trying to write a script that makes changes using slots (enable/disable), and I get the impression that it is not possible to completely disable slots in the game. Have you ever tried this? If so, were you successful?

red cedar
#

The first solution would be a war crime

#

Every server running your mod would make you EXPLODE with their MIND

serene fox
#

I had it OnPostFrame, but such event is not running on proxys

red cedar
#

But also depending on what you're trying to achieve, you could just add the camera to the entity's hierarchy and it'll move with it

serene fox
#

Its a pipCamera and its already added as child. But if i not call ApplyTransform, it will not updated

serene fox
red cedar
#

so.. could do that

#

issue with the normal post frame is you can easily crash a client

#

(trust me i'd know)

serene fox
#

i tryed "postfixedframe" but this will also not start. only PostFrame

red cedar
#

oh ok

#

weird

serene fox
#

i also run it on the Character itself. But:
```event protected void EOnFixedPostFrame(IEntity owner, float timeSlice)````
Do nothing when Set the mask as enabled

red cedar
#

override void EOnPostFixedFrame(IEntity owner, float timeSlice) *

serene fox
#

Error.. Override but no method

red cedar
#

guhh

#

are you modding arma 4 😭

serene fox
#

😛

#

Its a simple ScriptComponent attached to the main character

red cedar
#

is your thing meant to work on AI too ?

serene fox
#

Nope but it get only activated while joining my Vehicle as Pilot and if your the localPlayer (LocalControlled entity)

red cedar
#

fair ig, in those cases i usually attach them as playercomponent component but that's just me, regardless even with postframe it should work

#

just make sure to rate limit it to avoid causing crashes etc

red cedar
#

player controller

#

override DefaultPlayerController

midnight talon
upbeat lion
#

My future system is for vehicles, with the SlotManagerComponent

pseudo merlin
#

Someone know's if a trace is more expensive based on distance?
So the further it has to travel, the more expensive it get's or doesn't matter?

granite tendon
#

is it possible to hide mouse cursor at GM EDIT mode? anyone know? I was trying different ways but no effect. for example:

{
    override void EOnCameraFrame(SCR_ManualCameraParam param)
    {
        super.EOnCameraFrame(param);
        param.isCursorEnabled = false;
    }
}
tawny lotus
granite tendon
pseudo merlin
#

I like to know if there are trees at a specific position.
Within 1 meter to the character.

river imp
pseudo merlin
#

You can tell anyway's if you like.
maybe i need it at some point in time.

river imp
#

This won't work with trees.

pseudo merlin
#

Doesn't matter.
IMaybe i learn something new. 😉

river imp
#

But are you specifically wanting to know if one is behind the player or what?

pseudo merlin
#

I need to know if a cover position is a tree or a rock.

#

To determine the offset.

#

Rocks are bigger, so they need a bigget offset to make the A.I. get behind it.

clever oxide
#

What is the closest Event when streamed vehicles spawning, or JIP player get vehicles nearby?

pseudo merlin
#

My question was wrong.
I would guess the trace is doing some stuff/checks in the background while traveling.
So the longer it has to travel, the longer it will do thouse checks?
Or how does it work in the first place?

timid citrus
#

Raycast is what you mean

#

There are also sphere checks

pseudo merlin
#

Yes i used them but they are not precise enough due to big bounding boxes.

#

They always return stuff which isn't there but the bounding box is.

static tangle
#

Anyone got any ideas where i can start to learn script modding? have learnt the tutorials and what not

pseudo merlin
#

Jump right into "Script Editor" and practice.

#

Trial and error is the best teacher.

#

Maybe if you tell, what's your goal is you will get a more specific answer.

static tangle
#

well right know im looking at the flush toilet script, aha, but my main goal is scripting for new animations

pseudo merlin
static tangle
pseudo merlin
#

True.
Well best is to just start practicing step by step.
If you already watched the Modding Bootcamps.

static tangle
#

so literally dive in headfirst, and hope the water is deep enough lol

pseudo merlin
#

There is a wiki about it as well.

#

Yep 🙂

pseudo merlin
#

That's how most learn it.
There isn't really a step by step tutorial.
It's simply not possible to cover everything.

static tangle
# pseudo merlin Yes that's it.

I'm going to try and give this sink the same 'flush toilet' action the toilet has.
But does the sink have a name? how would i find out?

pseudo merlin
cobalt shadow
#

Where can I find the location of these names? I'm looking to add the names of my own ammo to them so the action manager will register them on the UI.

cobalt shadow
static tangle
cobalt shadow
static tangle
cobalt shadow
static tangle
#

ah, that makes some sense

pseudo merlin
#

See already improved compared to 10 minutes ago. 😉

#

Easy.

static tangle
static tangle
cobalt shadow
static tangle
#

not sure what to do here, as 'add component' is grayed out

cobalt shadow
static tangle
cobalt shadow
candid garnet
#

would you guys consider making a thread?

static tangle
candid garnet
#

anyone can. but you have days of questions on the same topic, which is good for a thread

#

and there needs to be a level of self discovery for you to learn effectively as well. you've already pushed away one person I see #enfusion_scripting message.

trim nexus
#

how would i start making my first life game mode im new doing scripting

trail wing
#

You can make modded maps persistent right?
For online play?

Is there a proper script for it?

restive island
cobalt shadow
pseudo merlin
#

Just found another "stupidity" flaw in the compiler.
If i miss the ; at the end of a line, it will not give an error but skip this line while executing.
So for example this: m_ConfigComponent.m_bConfigFilesSettingsOverrideExclude = m_bConfigFilesSettingsOverrideExclude will not give an error but it will be completely skipped.

torn bane
pseudo merlin
#

Okay.

pseudo merlin
#

I have made the ticket. 😊

torn bane
#

link it please so i can speed up the process of getting it before the eyes of script dude

pseudo merlin
#

@torn bane

torn bane
#

This is not a good ticket. please include a full example script file that if loaded in vanilla will cause the issue

pseudo merlin
#

Okay....

#

That's why they say silence is gold... 😄

pseudo merlin
#

@torn bane not sure, if the breakpoint always skips the bool isTrue; ?
Somehow it does even with ; at the end.
So not sure if this is intended?
I did expect the breakpoint to break at every line/variable?

I updated the ticket.

#

And i don't know how to make this in a good vanilla example... đŸ„Č

torn bane
#

the line does not do anything with the variable so you can not set a breakpoint on it

pseudo merlin
#

Okay.
But the example i gave above from the mod should.

#

I have no clue...

#

It should be false or true.

torn bane
#

This is hard to understand what you are actually on about. skipping some unused bool variable is hard to evaluate. a string would be better so you know if it actually ran or is random memory

#

and the formatting is not good either, why not wrap it all in a code block

pseudo merlin
#

Okay.

#

I will try to get this done with a string.
I have no clue about the feedback tracker.

#

I will try to do better. 😉

#

Sorry may i wasted your time... 🙁

cloud rock
#

Is there a way to get a item that a character has equipped in a specific slot?

pseudo merlin
shell quarry
pseudo merlin
shell quarry
#

yeah i dont really know why they choose this path... it may be simple than that

cloud rock
#

well for my use case it was fairly simple (at least i hope - testing in the following days will tell)

pseudo merlin
#

Lucky. 😉

open pier
kind widget
pseudo merlin
#

Yeah i never really breakpointed them and was kinda suprised, when i saw the code/line was skipped, until i noticed the missing ; which i thought was the reason for the skip.

#

Unfortunate coincidence.

pseudo merlin
#

Never really thought of it this way.

elder wigeon
#

Good day fellow scripters

Could anyone help me improve a deployable squad radio a bit? I'm having a hard time understanding how the dropped radio turns into a deployed radio and how I can pass a variable to a deployed radio when interacting with dropped radio 😅

wintry sable
#

can somebody explain to me input contexts. I'm at a loss. Lack of documentation is not really helping. I want to add custom action, I've figured the best place for it would be overriden chimerainputconfig. New custom action + new custom context. Both activated and listened to inside OnPostInit handler of my ScriptComponentClass and nothing happens. Change of priority didn't help. I just want to have global custom keybind that will activate scripts handlers.

red cedar
#

In most cases you will just add your keybind to a currently existing context

shell quarry
#

am i missing something? i duplicated a prefab but canot delete its components...

#

workbench allows me only inside the original prefab...

wintry sable
red cedar
#

I mean it's only odd when you're not aware of it, as soon as you are it "kind of makes sense" but glad it helped !

fading arrow
#

anyone?

restive island
fading arrow
#

Same result

torn bane
# fading arrow Same result

If he can't find a component then it's not there. I am not sure what variable you are checking but there is a difference between Playercontroller and the character entity

elder wigeon
open pier
# fading arrow Same result

Try to get it through the player manager. Not at my computer rn but play around with GetGame().GetPlayerManager().GetPlayerController()

It might take the playerId as an argument, cant remember off the top of my head though

fading arrow
#

Will do, been a while since I touched this mod (since Reforger release lol) so some things have broken in general, such as custom keybinds

red cedar
#

Ientity entity;

SCR_ChimeraCharacter char = SCR_ChimeraCharacter.cast(dntity);

Char.GrtCharacterController(); or something like that

open pier
#

Yes there have been quite a lot of changes so expect to fix some things

midnight talon
#

Yeah just use the player manager or if you explicitly only want local client one you can do SCR_PlayerController.GetLocalPlayerController()

glossy palm
#

I am trying to make a trigger that basically just removes bullets the second they are fired, I have a base trigger entity and I want it to activate when it detects a bullet. is that possible?

glossy palm
#

Ok, so with it being an event, how does that impact a trigger entity? Or at least how can I manipulate the trigger entity to activate in the case of that event?

#

Sorry if these questions are strange, this is my first project in en fusion

candid garnet
#

are you familiar with oop and c# events?

glossy palm
#

Yes mostly

candid garnet
#

oh I see, you are using the scenario framework? I haven't really messed with that and I don't want to give you a way more advanced guide when the scenario framework probably does it for you somehow

red cedar
red cedar
torn bane
inland bronze
#

For some reason, when using my custom component to spawn an optic rail on a rifle when an optic is attached, the optic rail lines up perfectly on authority (1st image), but not on client (2nd image). What could I be missing? The rail positioning is being handled through the SlotManagerComponent (3rd image).

Additionally, here's my script

solid hearth
#

I've seen a lot of ickyness trying to utilize SlotManager on a weapon entity. I've found it better to just make use of the AttachmentSlotComponent.

elder wigeon
torn bane
clever oxide
#

Hi! How can i ensure which code runs when i have 2 dependencie mod with same modded class, same modded function?
Breakpoint catch the wrong one, and what i need never runs.

elder wigeon
clever oxide
#

First idea is: Disable original manager or component in editor and change to my own inherited one, then maybe i can use override keyword on fuction and use my own codes without .super call. Main problem with this, need own world where i can change manually.
I try find other way for disable something in dependencies or use priority rules in mod hierarchy.

open pier
torn bane
haughty fractal
#

Hello, has anyone managed to deactivate the function that can be built even if there are enemies in the area?

lone glen
#

RPL : rpl::Pip::ProcessNetToGame
RPL (E): IReplication::JIPError: Inconsistent item table on Slave connection. Item is missing or different item was loaded in its place. (con=0x0)
WORLD : UpdateEntities
RPL : rpl::Pip::ProcessNetToGame
RPL (E): IReplication::JIPError: Terminating connection. (identity=0x00000000)
WORLD : UpdateEntities
RPL : rpl::Pip::ProcessNetToGame

#

Need some help on this if at all possible

cloud rock
#

Am i seeing it right that actions on the ActionsManager are static and can not be added or removed by script?

midnight talon
# cloud rock Am i seeing it right that actions on the ActionsManager are static and can not b...

Yeah generally components not prefixed with SCR_ seem to be close to cpp code (often just sealed interfaces with no implementation to read or override) and have limited scriptability. In most cases like this alternatives seem to be things like creating your own custom class that inherits from the base one, or spawning a barebones entity with your custom action on its manager attached as a child entity to the bone of the parent you want the interaction on

cloud rock
versed remnant
#

You could always have the actions be there already but disabled until they meet the right conditions

cloud rock
#

i am trying to create a presentation system where a controller can switch the screen thats displayed on monitors

cloud rock
midnight talon
#

yeah even though you can't dynamically add actions at runtime you can add them to base prefab and dynamically filter their usability/visibility (look at implementation of vanilla scripted actions for an idea), or dynamically spawn and attach a child entity with your desired actions

forest arrow
#

Hello. Maybe someone already implemented something simillar and can help.

I need to create a restriction system for some specific items in arsenal for specific players.

For example: Item1 is available to pickup to his inventory only for Player1. If Player2 will pickup this item from arsenal, or from world, or from trunck, system should delete this prefab from his inventory, or dissallow item creation in inventory

I implemented it with override SCR_UniversalInventoryStorageComponent.CanStoreItem, but it works good for vanilla arsenal UI by blocking user to drag this item. But it doesnt work for bacon loadout editor.

In bacoon I can see using of SCR_InventoryStorageManagerComponent.TryInsertItem, but I cant override it, as its proto external. I tried to use override for

protected void OnItemAdded(BaseInventoryStorageComponent storageOwner, IEntity item)

like this:

super.OnItemAdded(storageOwner, item);
if (item.GetPrefabData().GetPrefabName().Contains("Admin_Patch"))
{
Print("SteelPath >> Admin patch call");
if (!IsOwnerAdmin(storageOwner))
{
Print("SteelPath >> Not allowed");
super.TryRemoveItemFromStorage(item, storageOwner);
return;
}
Print("SteelPath >> Allowed");
}

But it doesnt work with vanilla or bacon arsenal. In logs I can see "Now allowed", but item is not removed from inventory

open pier
forest arrow
restive island
#

try doing ```cpp CODE_HERE ```

open pier
forest arrow
#
super.OnItemAdded(storageOwner, item);
if (item.GetPrefabData().GetPrefabName().Contains("Admin_Patch"))
        {
            Print("SteelPath >> Admin patch call");
            if (!IsOwnerAdmin(storageOwner))
            {
                Print("SteelPath >> Not allowed");
                super.TryRemoveItemFromStorage(item, storageOwner);
                return;
            }
            Print("SteelPath >> Allowed");
        }
inland bronze
forest arrow
#

Looks better. thanks for hint

restive island
#

hit enter after the cpp

forest arrow
restive island
#

^ Like that

forest arrow
#
modded class SCR_InventoryStorageManagerComponent
{
  override protected void OnItemAdded(BaseInventoryStorageComponent storageOwner, IEntity item)
    {
        super.OnItemAdded(storageOwner, item);
        if (item.GetPrefabData().GetPrefabName().Contains("Admin_Patch"))
        {
            Print("SteelPath >> Admin patch call");
            if (!IsOwnerAdmin(storageOwner))
            {
                Print("SteelPath >> Not allowed");
                super.TryRemoveItemFromStorage(tem, storageOwner);
                return;
            }
            Print("SteelPath >> Allowed");
        }
}
forest arrow
restive island
#

i think you're leaving in the code block from the default Discord code formatting. its just 3 back ticks

forest arrow
#
modded class SCR_InventoryStorageManagerComponent
{
  override protected void OnItemAdded(BaseInventoryStorageComponent storageOwner, IEntity item)
    {
        super.OnItemAdded(storageOwner, item);
        if (item.GetPrefabData().GetPrefabName().Contains("Admin_Patch"))
        {
            Print("SteelPath >> Admin patch call");
            if (!IsOwnerAdmin(storageOwner))
            {
                Print("SteelPath >> Not allowed");
                super.TryRemoveItemFromStorage(tem, storageOwner);
                return;
            }
            Print("SteelPath >> Allowed");
        }
}
open pier
forest arrow
open pier
forest arrow
#

Oh, you mean just TryRemoveItem. Let me try

open pier
#
modded class SCR_InventoryStorageManagerComponent
{
  override protected void OnItemAdded(BaseInventoryStorageComponent storageOwner, IEntity item)
    {
        super.OnItemAdded(storageOwner, item);
        if (item.GetPrefabData().GetPrefabName().Contains("Admin_Patch"))
        {
            Print("SteelPath >> Admin patch call");
            if (!IsOwnerAdmin(storageOwner))
            {
                Print("SteelPath >> Not allowed");
                TryRemoveItemFromStorage(item, storageOwner);
                return;
            }
            Print("SteelPath >> Allowed");
        }
}
#

Something like that

torn bane
forest arrow
forest arrow
torn bane
#

I don't know what he did. Permission to take items from arsenal should not be tied to storage. It's its own thing. The same way we check for sufficient supplies. CanX checks know nothing about it being an arsenal item with rank restrictions or cost. It only checks if the item can fit into the inventory due to volume and weight. The only thing that can fail afterwards is some unexpected things which is usually a programming or config error

forest arrow
open pier
forest arrow
#

It works perfectly with vanilla arsenal, but not bacon 🙁

torn bane
# forest arrow But its not only arsenal. I think in my case it should be in storage. It could b...

If the source is what makes the rule and it's always some storage you can avoid it being taken. If the item can be on the ground then you can avoid picking it up.

Either way I think there is a central method called in script by both inventory UI and pickup action. Maybe not. Check what the pickup action code does in script and see if there is a place to mod. I would normally say prevent pickup in the inventory but the actions would maybe bypass it if not also handled

inland bronze
#

I've set it to a Pivot ID, messed around with the RplComponent of the rail, tried various configurations in the AttachmentSlotComponent, and still is an issue sadge

#

It's positioning when attached is seemingly just not synced to the position of the weapon, because it'll follow the weapon correctly, just not in the position that is set in the AttachmentSlotComponent

hollow oak
#

meowsweats
SCR_EntityHelper.DeleteEntityAndChildren doesn't kill all children for some reason

And I don't understand why

red cedar
hollow oak
sleek moat
#

do map placed entities have const unique id's that can be referenced and found every runtime? I'm wanting to store then find some entities that aren't persistent and then do something with them on startup. I have a custom component on the relevant entities too

restive island
#

I'd think everything gets a unique ID to differentiate itself from other entities of the same type

river imp
ocean kernel
#

they have names tho, but if you have a component on them then you can register it in some system

minor agate
mighty glacier
#

I’m about to start looking through all the resources and any YouTube videos on scripting.

But before I start, any key things I need to know?

static tangle
mighty glacier
tawny lotus
#

How can I find the direction vector of where GM is looking?

clever oxide
sleek moat
serene fox
#

Hi, i attached a pipCamera to a Vehicle which will refreshed localy on FIXEDPOSTFRAME (30hz). But now i have the problem, that the camera clips into the Vehicle if you driving fast. I already set the nearPlane to 0.5. I do not like to refresh EachFrame, to save resources. Does anyone have a good solution? Thanks

open pier
#

Someone might know a bit more but it sounds like you'll have to do some compensation on the camera location depending on the vehicles speed. With the refresh rate being what it is instead on every frame it sounds like theres some desync happening

#

Is the camera even meant to move closer to the vehicle as its driving faster?

serene fox
open pier
ocean kernel
torn bane
fringe prairie
#

You can try looking at Tactical Data Link, I have a dirt simple camera prefab I attach to devices that seems to sync well, however for PiP display, it seems that even with such tricks, the vehicle you see and the data for where it is disagree and skip frames can cause camera lag. LODs are bad at distance anyways and limited by replication so might as well only use PiP in close by situations.

#

Engine quirk is what I chalked it up to since the PiP camera is almost like a ghost world that reuses what the “real world” is doing so there’s like a frame to frame delay with world renders > camera gets data and generates render data in copy world > data not ready to display that same frame > next frame the data generated in the previous frame is displayed on render target

#

For your use case though definitely attach the camera using add child with camera prefab like TDL, it will save you so many headaches. You will never get the timing right so let the engine do it for you.

inland bronze
#

How is damage handled after ComputeEffectiveDamage()?

I've overridden ComputeEffectiveDamage() to limit the amount of damage to not allow health to go below 5, but it just seems like there's some calculation to it afterwards that causes it to go below that threshold.

Going crazy a little bit trying to figure out why lol

pseudo merlin
inland bronze
pseudo merlin
#

I know this from the "Projectile Hit" event, where i went crazy cuz it always triggered multiple times, till i asked a dev and he told me the 2. event is from penetration.

#

But idk if this is handled somewhere else. blobdoggoshruggoogly

inland bronze
#

Knowing my luck, it's probably all handled in C++

pseudo merlin
#

Possible. 😅

#

What is your goal by doing this?

inland bronze
#

Goal is to not have the character die initially, but always go unconscious first

#

No matter how much damage is dealt to them

pseudo merlin
#

Got it.

#

For testing something or in general?

inland bronze
#

Want to give time for character to be defibbed within my custom gamemode

#

It was all working at one point in time, but I guess the devs updated something somewhere along the way that breaks respawning because of how I was handling it

pseudo merlin
#

I mean you could make him kinda invincible once ComputeEffectiveDamage() is triggerd and set the uncon state yourself?

#

After he is uncon you can apply the damage to what you like it.

inland bronze
#

Hmmm, could. Will give it a shot, thanks!

#

now I'm even more confused. I'm calling for disabling damage handling within ComputeEffectiveDamage(), and to return a damage value of 0, and it still drops my character's health to zero (but doesn't kill them) thonk

pseudo merlin
#

So that's pretty much what you were looking for.
But yeah strange behavior.

#

I haven't messed with this part for a long time, but when i did it worked as expected iirc.

inland bronze
#

I’ll probably just have to either tackle it a different way or accept that it may not be fully possible now.

I’ve got it to a point now where it does what I want mostly, sometimes damage still passes through the invincibility when the character is being riddled with bullets and breaks it though.

I’ll look again when I wake up, it’s almost 4am so brain is fried

inland bronze
elder wigeon
#

Hey everyone! In a prefab a vanilla class sets a hardcoded value to some variable.

I want that value to adjust to player numbers online.

How can I achieve that?

  • I modded the vanilla class including that variable to calculste the value
  • I didn't change the vanilla component in the prefab
  • I tried to manually change the hardcoded value

What I get is the new hardcoded value in game, not the calculated one. Where could I go wrong?

Should prefab show a formula for the calculated value, not the hardcoded value, if i did it right?

In et file I see hardcoded one

clever oxide
#

Declared vars not changing by manual, you can override the calc methods.

elder wigeon
clever oxide
#

Hi! I have a math question. How can I scale DotCircle radius in different resolutions?
DotCircle's m_fRadius = 4000;
its 4000m on map at 1920x1080 resolution in my tests. (The marker's handler keep this size by mapzoom value.)
Horizontal scaling works but when i change vertical resolution too, the DotCircle changes.
How can i ensure the dotcircle keep 4000m in all resolutions?

serene fox
static tangle
#

Will learning c# for unity help with enfusion and reforger/arma 4?

torn bane
full spindle
sour prawn
#

I am actually going to hang myself wtf is that ? suddenly ALL the script got these errors on my project even dependencies scripts ?! wtf ?

static tangle
#

what about experimenting with existing code and trying to mod? that the best way?

open pier
sour prawn
#

it appeared suddendly

#

i'm stressing rn

open pier
#

If that doesn't work then whatever line you changed last, even if unrelated to the error, check that.

sour prawn
open pier
# sour prawn I also tried that

You'll have to look real close at your scripts then, can't pinpoint an error purely based off the error log without seeing the scripts that might be throwing it

full spindle
#

But like you should probably understand at least one language, and be willing to give up if something is too big for you to chew

modern aspen
#

Hey guys, I was wondering if you have any recommendations on what to watch or read when learning scripting.
Are there any tutorials, guides, or resources you’d suggest for getting better at scripting?

inland bronze
# inland bronze How is damage handled *after* `ComputeEffectiveDamage()`? I've overridden `Comp...

I believe I have it solved. Had to override HijackDamageHandling() in the character damage manager, calculate effective damage and the remaining health after the effective damage, then force unconsciousness and setting health to whatever value I'd like while returning true for hijacking.

As well (for what I wanted), I had to not permit unconsciousness on the character damage manager, then permit uncon through script before forcing uncon

#

took WAY longer to do than I feel like it needed lol

red cedar
sour prawn
#

sorry again

midnight talon
#

It seems like one of those odd cases where compiler errors do not give an accurate trace to what actually causes the issue, like when you try to RplProp a type that doesn't have native serialisation and get an error that takes you to base Rpl class instead of the class with bad RplProp

#

Generally when that happens the fix is to just undo your most recent change, using version control like Git will help a lot with these things

static tangle
full spindle
#

Cause you learn from failure sure, but if you can't get past that failure it doesn't help grinding gears

static tangle
toxic pier
midnight talon
#

For example if you want to learn how to do things with the inventory, search codebase for usages of inventory manager class etc

static tangle
toxic pier
open pier
tawny lotus
pseudo merlin
#

There are also thouse error's, which appears in the log only but not directly as an error message.
If you don't know/notice, it's pretty much ⚰

ocean kernel
#

Just dont write bad code

pseudo merlin
#

Easy fix. 😉

fading heron
#

Quick question: Is there a way to check if a player has the map in their hand? So, a kind of gadget check.

elder wigeon
#

Is there any way to prevent auto waking up from uncon without healing? Making it very slow would work too

I couldn’t find any clear info on what makes a player wake up and how to slow it down or disable

red cedar
#

Jfc

pseudo merlin
clever oxide
# fading heron Quick question: Is there a way to check if a player has the map in their hand? S...

Try this in remote console when play in viewport:
int playerId = GetGame().GetPlayerController().GetPlayerId();
IEntity player = GetGame().GetPlayerManager().GetPlayerControlledEntity(playerId);
SCR_GadgetManagerComponent gmc = SCR_GadgetManagerComponent.GetGadgetManager(player);
IEntity gadget = gmc.GetHeldGadget();
Print(gadget);
if map in hands you will get map entity, then you need only compare of the 3 types of map entity.

#

or just check there is SCR_MapGadgetComponent in entity

red cedar
#

You realize the player controller does that?

pseudo merlin
# fading heron yes gladly

Not tested but "should" work:

SCR_GadgetManagerComponent gadgetManagerComponent = SCR_GadgetManagerComponent.GetGadgetManager(owner);

if (gadgetManagerComponent)
{
    SCR_GadgetComponent heldGadgetComponent = gadgetManagerComponent.GetHeldGadgetComponent();
    
    if (heldGadgetComponent)
    {
        EGadgetType type = heldGadgetComponent.GetType();
        
        if (type == EGadgetType.MAP)
        {
            //! Map in hand
            // Continue...
        }
    }
}
static tangle
#

What should i learn first/more, C# and/or Java, and why, before i spend a ton of hours learning and headbanging please 😂

solid hearth
# static tangle What should i learn first/more, C# and/or Java, and why, before i spend a ton of...

Depends on the purpose, if you're learning it just for the sake of trying to use that knowledge in enfusion then it really doesn't matter, they flow the same way at the end of the day. If you're learning it to use it in a practical sense then I vote C#, java's environment is ass, setting it up is ass. Everything about it in my view is ass. But that's just my opinion that comes with a deep seeded hatred for it for over 14 years.

full spindle
clever oxide
#

I could have used camera manager to get the cursor target entity if want check other entity not own player.

static tangle
agile bloom
#

I wrote so much garbage code (over two thousand lines) in one file that Workbench crashed immediately when I opened my project. It seems this isn't very friendly to someone like me who likes to write mountains of code....

agile bloom
# red cedar AI code ?

That's partly the reason, but I think the main reason is that Workbench is inadequate, especially since I've done a lot of modularization work.meowfacepalm

red cedar
#

@shell quarry
m_fFoo

m_ -> class attribute
fFoo -> float foo (i usually skip that part)
you can also make sFoo for string bFoo for boolean etc but i feel like it is unnecessary

agile bloom
#

Program: C:\Program Files (x86)\Steam\steamapps\common\Arma Reforger Tools\Workbench\ArmaReforgerWorkbenchSteamDiag.exe
Reason: SEH exception thrown. Exception code: 0xc0000374 at 0x7ffd4e057665😅 Currently, the largest file in this project has approximately 1900 lines.

abstract nymph
#

Hello! Do you know which script or method to call so that the AI cannot PerformAction to open the door?

shell quarry
#

it was a simpel google search ahahah

ocean kernel
cunning minnow
#

Anyone got any experience with tweaking the respawn system customly? in short i've built a menu fot you to select your faction Civ EMS and police. after that it takes you to your faction you have selected and shows the spawns available for those factions. On death I tried just making the Faction based respawn system pop up but it seems to flicker / break and can't click anything on that UI. I had made my own custom gamemode, I have made my own custom MenuSpawnLogic is there something I am missing tweaking for respawning?

torn bane
cunning minnow
#

I just don’t know where to inherit from either haha

#

I can get it to open but

#

It just flickers at like 60 times per second

torn bane
#

maybe you are listening on the wrong the events on the client. hard to tell without seeing the setup. all i can tell you is the respawn system in reforger is a very fragile thing and not very nice to mod, so you need to fully understand what you are doing to get things working in the way you want it to be.

serene fox
#

Is there a smart way to sort a SET ?

boreal swan
serene fox
torn bane
# serene fox Is there a smart way to sort a SET ?

Sets are sorted by the type they contain to ensure uniqueness. Strings are sorted by alphanum, complex type by their unique instance adress. If you want a sorted array instead there is an SCR class for it you can use. and to turn it into a set you can inherit and add a check to not insert if already present

serene fox
#

How can i convert a string (vector) back to a Vector?

        vector vOrigin = localChar.GetOrigin(); 
        string sOrigin = vOrigin.ToString(); 
        vector vString2Vector = sOrigin.ToVector();
        Print(vOrigin);
        Print(vString2Vector);

SCRIPT : vector vOrigin = <1160.47,39.573,2825.63>
SCRIPT : vector vString2Vector = <0,0,0>

torn bane
shrewd nova
torn bane
#

It's all documented in the code. Start at the gamemode player events, that calls the respawn system, that calls logic which calls consequent requests on the player controller whose responses get handled by the handlers attached as components to the respawn system.

gleaming phoenix
#

Are any folks here doing development with Claude, Copilot etc. assistance? Is there enough Enfusion Script out there to enable the agents to write decent code? I've done a few tests in VSCode but the results aren't great. I wonder if an extensive set of skills prompts might help

amber moat
gleaming phoenix
#

Thanks folks, I will have a look this evening when I get some time.

amber moat
#

Sorry I posted this in external tools too but I can’t find a real answer anywhere. Can I capture a camera frame as image data from Enforce Script at runtime and POST it via REST?

torn bane
amber moat
#

I reached it already with some stuff but I basically repair the truncated json on my end

#

But if u think that’s possible I will try.

amber moat
#

Is there a way to write image data to a local file from Enforce Script at runtime that an external process could read?

maiden goblet
amber moat
#

I already use the rest api. Works on all consoles and pc. Both ways.

river imp
#

Saving local files is PC only

maiden goblet
river imp
#

Rest api is server only

#

Clients can't use it. Unless there's been an undocumented change

amber moat
amber moat
#

Scratch all this I understand what u mean, so the real question is: Can Enforce Script on a dedicated server capture a camera frame as raw data and split it across multiple REST calls?

river imp
#

Servers are headless. How are the capturing the "camera frame"?

amber moat
#

REST calls work bidirectionally already, confirmed. The camera feed would need to be client side since the server is headless. can the client side of a mod capture a rendered camera frame as data and POST it via REST to an external URL?

pliant ingot
#

it can be removed at any time

amber moat
#

But I have my system working for everybody
 I can literally show you the data.. I posted a video a few days ago in external tools too

#

At this point my question is if there is an official supported method for this
.

maiden goblet
amber moat
#

Omg 😭

river imp
pliant ingot
amber moat
#

But it worked great just letting devs know.. this was perfect

#

No performance issues at all

#

Thanks for the knowledge though ❀ will fix this asap

torn bane
#

We have no reason to remove it right now, but we simply can't assure you it won't be revisited in some update. We have a larger refactor planned to make it nicer for modders but that might be also the time it's switched to a new internal API handler for web requests which is definitely platform locked.

amber moat
#

Hey guys sorry for the confusion I panicked reading the conversation. Just reviewed my code and all my REST calls run server side behind a Replication.IsServer() check. The server makes all the calls, clients never touch REST directly. So I think I’m actually fine? The accidental client REST thing doesn’t affect me. Thanks for the help anyway, learned a lot!

torn bane
#

But you can't take screenshots on the server. But in theory you could take on on the client and try to send it via an RPC, but it's going to be a lot of work to split it to not choke up networking.

amber moat
#

Im trying to do it first with a simple script that takes a single screenshot tries to encode it and POST it. Lets see

#

Ok wait if you say that then I had this pipeline in mind already:

Client takes screenshot
→ splits into chunks
→ sends chunks via RPC to server
→ server reassembles
→ server POSTs to Firebase
→ app displays it

#

And from what I just read you guys lifted the 4k prc call cap

torn bane
#

Yes but that does not mean you can send it all in one go. It will take for ever to transmit reliable which totally chokes out your server for the entire time

calm sluice
#

Guys, is there any advanced/specific tutorials about connecting scripts into animation editor? I need to get variable from scripts into animation graph, but official tutorial video only shows how to override existing one and not create new one. Maybe theres some text tutorial on bohemia site i missed that can help me

amber moat
quasi osprey
#

can someone come answer a few questions i have in a vc ADHD doesn't help me with reading so vc would be faster and better

river imp
quasi osprey
#

thanks for the reply

did something change regarding how to get components to appear under the script section for ui

river imp
quasi osprey
#

maybe a better question would be is there an already made component in the base game already that would allow me to put a character preview into my ui

river imp
#

Not really, that consists of using a ItemPreviewWidget and then using custom functionality to then render the character on it

quasi osprey
#

hmm so then you cant just use the one used in the inventory

river imp
#

All of that functionality comes from the menu.

#

Not a component.

quasi osprey
#

ahhh of course it does

river imp
#

If you want it to be controlled by a component then you must write a custom component.

quasi osprey
#

ok i did that but when i tried to find the component in the place where you add a script to a widget it dident show up thats where my original question come in

river imp
#

Then either A) it's not in the correct module or B) you didn't validate and reload.

quasi osprey
#

cross b off um give me a sec let me look at sum

#

here's my script

river imp
# quasi osprey ^

Don't use SCR as your prefix. That's for scripted classes provided by B.I.

#

Meaning, if they every decided to have a class with that name, your mod would break.

quasi osprey
#

class CharacterPreview : ScriptedWidgetComponent

river imp
#

Use your own prefix.

#

DXS_Thingy

#

or whatever.

quasi osprey
#

oh

#

lol

#

ok issue is still it wont let me attach it to a widget it wont show up in the list

river imp
#

There's no need to have the preview widget name as an attribute.

#

Put it in the correct script module.

#

In 99% of cases, it's the game module.

pliant ingot
river imp
#

Doesn't make it any less uncalled for.

quasi osprey
#

prolly from not having full understanding

quasi osprey
pliant ingot
pliant ingot
quasi osprey
#

ngl i think i dident even do the folder structure right if thats what your saying

river imp
#

Was pretty sure script modules were explained somewhere on the wiki in the scripting section.

quasi osprey
#

ADHD doesn't help me with reading so vc would be faster and better
^
this

#

i learn from vids

river imp
#

Okay.

#

Good luck,

#

99% of this isn't in a video

quasi osprey
#

ive tried to read small parts at a time ive picked up some parts but like i said reading doesent do anything for me in through my eyes and out of my head shrugg

river imp
#

That's unfortunate. Having ADHD myself, it isn't an issue for me.

quasi osprey
# river imp

ok i get that but i have it here
YourModName/Scripts/Game/UI/MSFT_CharacterPreview.c
your saying it goes up one dir

#

and your also saying i dont need this [Attribute("CharacterPreview")]

#

maybe i dont have adhd i got the hard tism

#

ohhhhhhhhh

tidal elm
#

Hello folks.

I'm kinda new to Enfusion, and I'm facing a wall I can't find any information about.

I'm trying to make a new class inheriting from the built-in VehicleControllerComponent, which is a somewhat normal class as far as I can tell, but even tho the boilerplate looks correct according to what I can see on the wiki, I can't see my component at all when I try to attach it to a any prefab, even while inheriting (or overriding) it from the built-in Vehicle_Base prefab.

The script compiles fine, my other components appears to consider the class valid, but it's not getting listed as an attachable component, while engine's built-in components (inheriting from the same class, such as CarControllerComponent, ect...) do have the same file structure as mine, except they work fine.

I saw that these working classes are apparently generated, but once again, I can't find anything documenting it, and don't really understand what makes them work correctly while mine isn't.

Does anyone have any idea what am I doing wrong?

minor agate
#

You are probably missing the class decorator to make it available for editor use

pliant ingot
tidal elm
pliant ingot
#

Then do what mario says

pseudo merlin
#

Nice pfp Mario. 😉

tidal elm
#

Alright, just don't pay attention to the subject, I just wanted to try my way of doing it

#

Non-attachable component :

class JetControllerComponentClass : VehicleControllerComponentClass
{ }

class JetControllerComponent : VehicleControllerComponent
{ }```

Attachable component : 

```[ComponentEditorProps(category: "GameScripted/Vehicles/Jets", description: "N/A")]
class JetBaseComponentClass : ScriptComponentClass
{ }

class JetBaseComponent : ScriptComponent
{ }```
#

From my perspective, the only difference I can see is the component I inherit from

clever oxide
#

is it not SCR_ marked?

#

in my tests SCR_CarControllerComponent inheritable but if you use CarControllerComponent not showing on "add component" or "change class" list at prefab @tidal elm

fiery owl
#

So I am trying to create a cinematic with a scene involving a helicopter crashing into the water. The problem is im having a hard time making a script to control the helicopter crashing. This is the script that i currently have that does work class Scene_1_Class: CinematicEntity
{
// user script

void OnKeyFrame_Heli_Movement_0()
{
    vehicleGO("Cinematic_Flying_Mi1");
}

void vehicleGO(string entityName)
{ 
    GenericEntity vehicle = GenericEntity.Cast(GetWorld().FindEntityByName(entityName));

    if (!vehicle)
    {
        Print("Helicopter not found"); return;
    }
    
    SCR_HelicopterControllerComponent heli = SCR_HelicopterControllerComponent.Cast(vehicle.FindComponent(SCR_HelicopterControllerComponent));
    
    if (!heli)
    {
        Print("Helicopter controller missing"); return;
    }
    
    heli.StartEngine();
}

};

What im trying to do is make it veer to the right and decened rapidly in a autohover style decend.

tidal elm
tidal elm
#

I did tried that path, and still the same result

#

I also tried to inherit from the built-in "AirplaneControllerComponent", which crashed the editor during script validation and made the project impossible to load

#

And after that, I did go check out the R3DCore addon, just out of curiosity, and they did inherit from SCR_CarControllerComponent, so I'm assuming that it really is the only way to go to this date

modern marlin
#

Hi. For some context, I'm using client side modded SCR_MuzzleEffectComponent to detect shots from certain modded vehicles where normal server side approaches have not worked (eg most pilot operated guns in WCS tha don't raise the normal shot events on the server ). I use these for stats collection and it works fine. However, I've noticed that it is possible for multiple clients to report the same shots which i guess makes sense. the problem is that it is not easy to filter these as i can't get information about the vehicle /occupant who is shooting.
In order to filter out clients that aren't actually shooting, I need to be able to detect the vehicle that the muzzle effect is attached to, so i can then find the occupant. So far I have not worked out how to do this (I can get the owner of the SCR_MuzzleEffectComponent, but so far have not been able find an attached vehicle).
Can anyone tell me how I can find the related turret/vehicle (if this is even possible on the client side)?

umbral spade
#

Hello!
I have a strange error. If I add this code to a prefab and recompile the game, this error appears.

[BaseContainerProps()] class ARMST_ITEMS_REPAIR_COMPONENTS : GameComponent { [Attribute(ResourceName.Empty, UIWidgets.ResourcePickerThumbnail, desc: "Đ§Ń‚ĐŸ спаĐČĐœĐžŃ‚ŃŒ", "et", category: "Repair")] protected ResourceName m_PrefabRepairs; }

I can add this ResourceName to any component and still get the same error.

There are no errors upon first launch. If I recompile the game, the item disappears from the world at launch, causing an inventory error, for example.

This code is not even used anywhere, it's just that because of the reference to ResourceName, the item disappears from the world after recompilation.

#

Maybe that's why? When I recompile the code, I get this error. If I run the tools without mods, it's the same.

coarse bane
#

just ignore

tawny lotus
#

I have a vehicle where I've added my own component. Player GM spawns the vehicle via GM entity browser. The GM player is looking in to certain direction (camera direction) and I can find this information in e.g. OnPostInit().

How can I store the camera direction (vector) in component for future use? Storing it in a member variable in OnPostInit() while on client side does not work.

What approach should I take?

torn bane
# tawny lotus I have a vehicle where I've added my own component. Player GM spawns the vehicle...

I believe this approach is flawed, because a GM can freely rotate the entity while placing in the ghost mode. Your camera perspective on it has little to do with it. the camera is fully local, a dedicated server does not know about where you are and what you look at specifically. If you absoletly need to you need to grab the information on your client and nicely ask the server to handle/broadcast it for you by sending an RPC to it via your own player controller. you can not send rpc from the vehicle, as you do not own it, the server does

tawny lotus
#

I need to send the information the other way around. I want server to know the camera direction when the vehicle was spawned. The direction to move to is vehicle origin towards the camera direction. Works perfectly in WB, but not when we have clients in the mix. 😕

torn bane
#

As I said, only the person who spawns it knows. So you need to hook into the placement process and grab the current camera info before the placement continues. Send it to server via your local player controller as new rpc you add there on a component. then on the server you can store the info. to apply on the next spawn. doing it on the entity post init might be too late because by then you can have already moved your camera.

In general this setup sounds strange and should not be something you do. If you want to auto setup something, use the direction the vehicle is facing, not the camera.

tawny lotus
amber moat
torn bane
maiden goblet
#

Sounds a bit silly hearing BI employees allude to code quality when Reforger is the least stable and most buggy piece of software I've ever played with

torn bane
#

Sir I am a programmer not a script writer, I am allowed to rant about them.

amber moat
#

Thanks for the great advice btw!

sonic forum
#

Hey guys
Can you tell me how GetHealth works in HitZone? Limbs have HP, and if you add them all up, what's the character's HP? I can't figure it out.

inland bronze
sonic forum
inland bronze
#

I believe the hit zone GetHealth() will show the default hit zone, which would be the health hit zone for a character, or a specified hit zone if you’ve casted to it

full spindle
#

So is the difference between modded and override in classes just that modded is for adding functionality/data while override is for method overrides?

#

Like modded works with multiple mods, but override overwrites the function?

open pier
full spindle
#

I'm trying to change my classes to modded, and I haven't needed inheritance yet

#

For context most of what I'm doing is modifying another existing mod, not reusing it's components

amber moat
#

modded is about the class itself — how it integrates with other mods.
override is about individual functions inside that class — replacing specific behaviour.

open pier
# full spindle Yeah but what's the override keyword for?

Overrides are more for the functions themselves.

modded class SCR_ChimeraCharacter
{
   override void EOnInit(IEntity owner)
{
   // super will run the base class/inherited functionality
    super.EOnInit(owner);

    // do your custom functionality here
}
}
#

Looks trash since I'm on my phone but thats the basics

full spindle
#

Thank you, that is helpful

full spindle
#

Oh that also explains why my own mod works now, I was using override on the class level, and at some point I swapped it for modded and it worked. gd

#

Well there's a time to learn everything

river imp
primal vault
#

How can i make certain lights pulse/flash?

open pier
clever marlin
minor agate
#

So i dont think this will

minor agate
#

And it is always positive to aim for higher quality regarless of the situation.

amber moat
ocean kernel
#

Overall modders do very well but the bar is pretty low considering y'all release updates that crash the game when a number goes from 999 to 1000

wintry sable
#

can somebody enlighten me please. I'm kinda at a loss here. Does reforger not have any server side capabilities? And the only thing I can do is REST APIs ? So any script kid can just rip the whole server + client at any point ? Like everybody forced to do an opensource project ?

#

sorry if this has been discussed before, haven't found the definitive answer to this

torn bane
wintry sable
#

I see, thanks for the answer!

elder wigeon
#

Hey everyone, I've found a GM action to disarm heli rocket pods. Can anyone help to implement a script to apply this action to every spawned heli with pods?

#

Same as if I called it on a newly purchased heli, but automated

elder wigeon
red escarp
#

Custom ELightType not working with SCR_LightSlot and emissives. Script recognizes it, but no glow. Do I need to override something to register it?

modded enum ELightType
{
Age_test,
}

fringe prairie
fringe prairie
errant fog
#

Hi.
Im looking for somewhere i can hook in and catch when an entity fires its weapon.
I am interested in catching from both player and AI entities.
Anyone know where i can do that?

inland bronze
dire sinew
gloomy lynx
amber moat
fringe prairie
#

Please let me know how! Haha

amber moat
#

The trick is CallLater wait 1000ms after MakeScreenshot before you try to read the file. If you read it on the same frame it crashes. Give the engine time to finish writing first.

primal vault
amber moat
elder wigeon
#

Does anyone knoe how to apply a script to a newly spawned helicopter? I can't find how to catch that new heli to attack a script to it

pseudo merlin
#

GM spawned?

elder wigeon
#

The idea is disarm all new spawned helis

#

I have a disarming script

#

But can't find how to apply it to a heli so that it's disarmed

#

Maybe there is a simpler way though

#

Adding this script to every heli prefab though migh be even wirse

pseudo merlin
#

Well shouldn't be that hard.
Simply check for example if the IEntity owner is a helicopter and if yes let it execute the script.
Maybe there is something more specific to helicopers/air vehicles, but this is the way i know of doing things like this.

elder wigeon
#

I'm not sure what would be the most crash/fail proof solution to spawn a heli in a specific condition, e.g. without rockets and ammo. Before now the prefabs were edited that way but it requires to edit every prefab

tawny lotus
#

I'm trying to spawn an entity flat on the XZ plane. Dropping it via GM aligns it to ground. I want to straighten it.

I've tried SetAngles(), SetYawPitchRoll(), SetWorldTransform() and then Update(). Nothing seems to have an effect on the orientation. What am I missing?

#

Doing this in OnPostInit and EOnInit has the same result.

tawny lotus
clever marlin
ornate sonnet
#

Not sure if this is the right place to post or not, but
 I’m trying to inherit and edit EditorModeBuilding.et so that it calls custom prefabs for helipad compositions which have a subclass on them in place of SCR_CatalogEntitySpawnerComponent, so I can script my own additional cooldown timer for vehicle spawns. Only problem is: when I run it, the game continuously calls the GUID for the vanilla editormodebuilding prefab instead of my inherited one. Is there any way to make it call my inherited editormodebuilding prefab?

calm sluice
#

Can someone explain to me how i can get this variable out of eventhandlermanagercomponent, i need to check it in my sript when event raised but all i can find is just how to perform script when event raised and not how to get this bool out

unique bolt
#

I found a workaround for the editor stalls when working with large amounts of plugins in enfusion and opening the script editor -> That work around was to use VSCode with the enfusion plugin.

tawny lotus
#

Is there a GetSurfaceY() function that takes in to account any entities at that spot and returns the height including entity height?

tough orbit
#

New to scripting. Trying to add two new area types. I’m unable to inherit loadoutareatype I can only duplicate. Is this a thing or am I missing something?

torn bane
tawny lotus
visual atlas
graceful sleet
#

Hi , I have a question about the loadoutinventory. I created a script to insert, for example, the helmet cover into the helmet slot. The script inserts the cover, but once inserted, I can't see it in the helmet storage, so I can't remove it. Do you know which script I need to modify? Or is it just a simple prefab setting?

red cedar
torn bane
# red cedar DStool doesn't listen to RCON you need to start arma reforger server on it's own...

I just ran a local dev server using this -config and could connect with battlewarden, though that tool is hard coded to use commands for older arma games so it is not as useful.

{
    "region": "EU",
    "publicAddress": "local",
    "publicPort": 2001,
    "game": {
        "name": "Arkensors little corner of fun",
        "passwordAdmin": "xxxxxxx",
        "scenarioId": "{68D1240A11492545}Missions/23_Campaign_HQC_Arland.conf",
        "visible": true,
        "gameProperties": {
            "fastValidation": true,
            "battlEye": false
        }
    },
    "rcon": {
        "address": "0.0.0.0",
        "port": 5001,
        "password": "xxxxxx",
        "permission": "admin"
    }
}
visual atlas
visual atlas
#

thanks

wintry sable
#

Is there a Format Document option like in VSC ? I see only Basic Code Formatter which just does something and don't really format anything for me

pliant ingot
radiant robin
#

Am I able to force a client to equip something in their hand through script? It seems no matter what I do it is getting blocked

#

Please ping me if you can help

torn bane
radiant robin
#

hmmm I have been doing rpc. I am trying to achieve equip item > use item > put new item in inv > delete original item > put new item in hand as a way to replace an item the player is holding. I can do all of it except for the last part. I am not sure if gadgetManager.SetGadgetMode(newItem, EGadgetMode.IN_HAND); is what I should use but it will work in the workbench just not on a server.

shrewd nova
inland bronze
#

Trying to wrap my head around something.. I have a SCR_ScenarioFrameworkGet action that's supposed to pull an array of SCR_TaskExecutors from my missions entity in the world. It does so seemingly fine, so then I need to get the playerId and such from the SCR_TaskExecutorPlayer.
I'm able to pull the playerId, but GetGame().GetPlayerManager().GetPlayerControlledEntity(playerID); to get the character entity always returns null for a client-controlled entity.
What direction would I need to go in to fix it?

#

script is based originally on how SCR_ScenarioFrameworkGetArrayOfPlayers is set up

torn bane
sonic forum
#

How can I trigger a custom effect? ​​It needs to be added to the DefaultPlayerController in the HUDManagerComponent, right?

inland bronze
# torn bane A player is the player controller. It does not mean that when you ask it control...

Theoretically they should be controlling a character, as they’re only added to the main entity’s array if they have a gadget equipped, and removed when unequipped, etc.. And even in the case of testing with peer tool, when the peer definitely is controlling an entity and has that gadget equipped.

It’s recognized in everything prior to getting the controlled entity from player manager (which could just be a workbench issue, but it doesn’t work in a DS either, which is why I’m working on it)

#

Might be a little deeper than that though, thinking now, because I can’t get DS to print certain test prints I can get in peer tool thonk

tawny lotus
#

I want to do things on player side when their GM view is open. I'm looking at SCR_EditorBaseEntity and related classes like SCR_EditorManagerEntity. I have a system that in Init() would do GetOnOpened() and GetOnClosed(). Works nicely in WB. With Peertool I can get the Init() to trigger in client side.

On the client side I just can't find SCR_EditorManagerEntity or SCR_EditorBaseEntity (...GetInstance() ). Returns null.

What entity should I look for?

#

Or should I have some other approach?

pseudo merlin
#

Local for the GM client.

sweet badger
#

I found that when running sphere queries, if you delete found entities in the callback method, the query will fail to find unrelated entities that would otherwise have been detected.

int c = 0;
private bool AddEntity(IEntity e)
{
        c++;
        delete e; // c will be different if this line is removed
        return true;
}
GetWorld().QueryEntitiesBySphere(GetOrigin(), m_fRadius, AddEntity);
Print(i);

Without the deletion line, the game prints c=10, with the game prints only c=6.
The issue is not that I am deleting child entities, it's regular independent prefabs like trees or props that are not found! The entities that were not found do in fact remain in the game and are not deleted. I can reproduce this reliably.
It would seem that deleting entities during a sphere query can somehow prevent the query from working correctly. Is this a known issue?

torn bane
# sweet badger I found that when running sphere queries, if you delete found entities in the ca...

As expected, if you delete while traversing the entity query structure you will not find the rest as it skips indicies. This is per design. The vanilla prefab deleter needs to be reworked for the same reason. Collect every entity you want to delete and do that. Also do not use delete keyword unless you are 101% sure the entity is not replicated. use the DeleteEntityAndChildren helper method instead

sweet badger
shrewd nova
#

Best test results come from a actual dedicated server

torn bane
sweet badger
# torn bane As expected, if you delete while traversing the entity query structure you will ...

Also, one more thing since you mentioned the needed rework for the SCR_PrefabDeleter.
It uses a CallLater from EOnInit to delay the query. In my own entity deletion script, if I omit this delay, there will be a mismatch when clients join.
Is the CallLater delay sufficient for avoiding this, or is there also a better way, like using another event or waiting for something specific?

torn bane
inland bronze
clever oxide
#

in server side you need determine which player controlled entity

#

GetGame().GetPlayerManager().GetPlayerControlledEntity(playerID); is ok, always working in server side

clever oxide
#

i suggest print out varaibles and arrays step by step

inland bronze
#

Yeah, that’s what I’ve been doing. I’ll post my code in a moment and see what I could be missing

scenic kernel
#

I need some help,

I want to create an script that when you click on a button on the car, the smoke launchers of the car get fired.

I have the car with the switch already created and working, and connected to the script, but I don't know how to call the weapon's fire trigger..

(right now, script shows the weapon to be use on console).

(Smoke launchers were already working from turret, but we want to fire them from vehicle console panel).

Any help is really welcome.

Thanks

inland bronze
ocean kernel
#

relatable

pseudo merlin
open pier
#

So many things I've built that works in workbench but not on a DS. I've found the best way to test my stuff is uploading every patch and trying it on a test server in the same exact env as my main server

solid hearth
#

It's always recommended to stay away from peertool, 9 times out of 10 it's a trap. Though I have had some instances where DS or atleast the diag clients were a trap. Something could work perfectly fine on the diag client/server but the moment it went to a production environment it would crash PepeSad

tawny lotus
inland bronze
#

What's the best way to lock a storage container so nothing can be inserted? RequestUserLock() doesn't seem to do the trick, unless I'm using it wrong

#

Goal is to just prevent items from being inserted before calling for deletion of the entity

#

But if the player is already in the storage when it's called, seems to still allow inserting items which ultimately get deleted along with it

shrewd nova
#

It’s like ten lines

inland bronze
#

Gotcha, seems easy to do, just figured there'd be a specific method for it

shrewd nova
#

As far as I’ve seen I don’t think there’s vanilla stuff for that

sweet badger
#

What can cause BaseContainer::GetResourceName() to return an empty ResourceName string ('')?

#

It happened for instances of a particular but normal prop prefab that is placed in the map, it does not appear to have anything wrong with its resource name.

shrewd nova
sweet badger
#

It's a regular vanilla prop, {CC66836BF4E211F9}Prefabs/Props/Military/Camps/Duckboard_01.et
I can get the BaseContainer successfully, but when I called GetResourceName(), it returned an empty string

river imp
sweet badger
#

Sphere Query finds the entity, GetPrefabData(), GetPrefab()

river imp
#

BaseContainer doesn't even have a function to get a prefab name.

#

Unless you're using a helper function

sweet badger
river imp
#

ohh I missed that

#

Regardless, if you get the prefab data you can just get the resource name from it.

#
IEntity PrefabThing = GetGame().FindEntity("PrefabThing");
Print(PrefabThing.GetPrefabData().GetPrefabName());
sweet badger
#

Right, but I want to use the BaseContainer one because I'm also checking ancestor names

#

I also wouldn't be surprised if GetPrefabName has the same problem

river imp
#

it doesn't

#

using the base container, if it doesn't inherit from anything it doesn't return a resource name

sweet badger
#

This method works for all kinds of other props

river imp
#

Props that inherit from things

#

No inheritance

#

Just has a component prefab on it.

sweet badger
#

It has inheritance, you selected the component

river imp
#

oof

#

That's odd then.

sweet badger
#

And even if it didn't, GetResourceName should work regardless of that

river imp
#
IEntity PrefabThing = GetGame().FindEntity("PrefabThing");
BaseContainer BC = PrefabThing.GetPrefabData().GetPrefab();
Print(BC.GetResourceName());
#

That works for me.

sweet badger
#

I know, this works for me too, it's just that with this one particular entity it returns an empty string for some reason

river imp
#

The example i'm using is that prefab....

sweet badger
#

Maybe something else is interfering, I might do more testing tomorrow

river imp
inland bronze
#

Trying to disable all actions on an entity, except ones matching a certain name, but calling SetActionEnabled_S(false) through server Rpc doesn't seem to make a difference, despite it being called on server (proven by prints).

Anybody else ran into this issue or see what I could be doing wrong?

river imp
#

Rpcs can only be sent to the server by the owner of the thing

#

Owner being the owning client not "GetOwner()"

#

OnBuriedStatusChange has to be called by the owner of the thing.

inland bronze
#

It is being set buried through a user action, which calls this from the action:

void SetIsBuried(bool buried)
{
    m_bIsBuried = buried;
    OnBuriedStatusChange();
    Replication.BumpMe();
}

so would it not be called from the owner, being the server...? Or am I mistaken?

The OnBuriedStatusChange() and SetIsBuried() is within the component of the entity

#

Also, in the original code posted, I get those prints in the server logs and not the client, wouldn’t that indicate the call is not being dropped by the server?

magic pagoda
#

Hello. I am not new to scripting or programming itself. Coming from 5 years of the gta modding community. I am having a bit hard time to understand how server/client work and how to write code. In the other games we usually have like separate client and server files and they communicate via events. Now in Enfusion looking at it seems like it’s all in the same c file. How do I approach this without it turning into a mess what’s client and server stuff. Thanks

sweet badger
# magic pagoda Hello. I am not new to scripting or programming itself. Coming from 5 years of t...

If you haven't yet, I recommend watching the Bootcamp replication videos (https://youtu.be/asWxIIHT6d0?list=PLfUcrRpCM_fKjkTrkV-bqnknVbFCPA3YU) and looking at the Script API replication pages (https://community.bistudio.com/wikidata/external-data/arma-reforger/EnfusionScriptAPIPublic/pages.html).

https://community.bistudio.com/wiki/Arma_Reforger:Multiplayer_Scripting

This Modding Boot Camp seminar was originally held on the Arma Discord Server on January 23rd, 2025.

In this session, we explore the fundamentals of replication within the Enfusion Engine, highlighting key concepts and common challenges. Through detailed examples and clear...

▶ Play video
magic pagoda
#

Oh okay thanks I will look! 👍 Btw in the enfusion is it possible to spin up a local host server + you as a client with separate consoles for server / client.

sweet badger
magic pagoda
#

Okay cool! First day today when I found out about arma reforger and enfusion. So just trying to get some stuff into my head about basics. Didn’t see no extra console when I selected “Localhost server” . Perhaps could be that I haven’t got server package installed from steam.

#

(Selected it from the world editor or something at that play button in green)

sweet badger
#

If you want to start a proper dedicated server, which behaves differently in some ways, you can do it via Plugins->Dedicated Server Tool.

magic pagoda
#

Gotcha, good info. Yeah I was thinking it might be good test with a dedicated server as my mods I plan to create will be for mp servers.

#

And will be easier to debug if I get a console for server and one for the client. So I can actually know what is what.

#

For example a medical system. I think of it as having your own vitals always “synced”. But you wouldn’t need all the data from every other user unless you are interacting with him (treating or checking injuries for example). That’s at least how i would have done it on other platforms.

river imp
#

You're making this way harder than it needs to be.

#

BuryableItemComp with RplProp on m_IsBuried, Action for Burying, Action for Unburying, Bury Action, (if it's not buried, show and allow performing) Unbury Action (if it is buried, show and allow perform), in the perform of both of those move the item (bury or unbury it) and then have the server toggle the m_IsBuried on the BuryableItemComponent.

inland bronze