#enfusion_scripting

1 messages · Page 12 of 1

ocean kernel
#

namespaces would fix it, or maybe I can just have my own script module

torn bane
#

SAT_RemoveGMAction would be the intended class name.

ocean kernel
#

Ah I see the issue, it should be RemoveGameMaster not RemoveGM

#

Whoops

fervent cedar
#

we need a custom macro / preprocessor that just compiles normal code into enscript

ocean kernel
#

I can do this in my vscode plugin probably

fervent cedar
#

imagine not writing your prefix everyh time you want to get a class/var

#

just base it on folder structure 😔

ocean kernel
#

Yeah I will, I will reorganize the class names as it transitions from playground to production

#

On and off half a year of work 😅

fervent cedar
#

also that way you can avoid using enfusion functions, just inline everything with pre-processor functions
Even less casting and tedium

ocean kernel
#

This probably bothers me way less than not being able to collapse code blocks

#

I can do it in vscode but I cant compile from vscode

#

So

minor agate
#

It's Enforce Script

fervent cedar
#

*reforgescript

ocean kernel
#

reforc

craggy jolt
#

Was gonna change my name to SCR_BaseCharacterInventoryStorageManagerSystemComponent a week ago

craggy jolt
#

Storag

solid hearth
#

Remember, make it <h1>SCR_BaseCharacterInventoryStorageManagerSystemComponent</h1>

#

Really get that point across and make a few server owners mad.

ocean kernel
#

Almost as wide as adam driver's chest in that one star wars movie

solid hearth
#

TRUE

#

I'm going to do that right now

solid hearth
#

@ocean kernel cat_thumbs_up

ocean kernel
#

I like putting load screen tips as group names to help other players play the game. Ie. #AR-LoadTip_053

#

Something like that

thick arrow
#

does anyone know a way to replicate voices where your camera is in game master, it only does so if your actual character is within distance. many thanks.

ocean kernel
#

It's hardcoded

thick arrow
ocean kernel
#

Not as of 5 months ago, who knows about now

solid hearth
#

Thanks for teasing ap mines after I went through all this trouble bohemia

fervent cedar
#

Now, don't start developing a commander mode now

solid hearth
#

Definitely don't add sling ropes or expose fire mode/rate / sway modifiers to WeaponStatsManagerComponent

fervent cedar
#

...

#

If you want dynamic sway modding you just create your own weapon modifier

solid hearth
#

It doesn't achieve the exact effect.

#

so yeah definitely DON'T add that in a future patch Happy

fervent cedar
#

What are you trying to achieve with the sway modifiers?

solid hearth
#

hold breath

fervent cedar
solid hearth
fervent cedar
solid hearth
#

Yeah i'm not that great at vectorized math dentGe

fervent cedar
#
override void OnCalculate (IEntity owner, WeaponAimModifierContext context, float timeSlice, out vector translation, out vector rotation, out vector turnOffset) {

It's not crazy haha

#

I've seen like 3-4 weapon handling mods on the workshop, it can't be that hard 😄

solid hearth
#

You can only shave off so much even then like I said the effect isn't a desired effect, it's a bit janky and meh. Idk why It should be exposed.. should be a base feature

fervent cedar
#

Ye, seems like a common thing people want to mod 🙏

solid hearth
#

Recoil reduction is easy enough but messing with sway not so much.

ocean kernel
#

Bro I would love if non-character ragdolls worked

#

Tried to make a cape, activated ragdoll, instant crash

solid hearth
#

Can't you just fake it till you make it with an animation?

ocean kernel
#

I try to avoid animations since it just crashes all the time and discourages me

ocean kernel
timid citrus
#

Can not for the life of me get visual area lines to stay on screen using Shape.CreateLine it just pops up once really fast and goes away. Tried all kinds of flag combinations.

ocean kernel
#

it's being garbaged, save the reference somewhere

timid citrus
wild glade
#

Is there a proper VSCode or Visual Studio Community addon for Enforce Script?

pliant ingot
west prism
#

can someone explain how i set up a persistent marker on map like Trader and so.

red cedar
#

(repost)
When spawning in a medical kit in my player's inventory via script i receive this message(and the items refuses to spawn)
'SCR_ResupplySupportStationComponent' needs an entity catalog manager!
Tho my game mode does not use any supplies or whatever, is there something i'm missing in the prefab's config that is preventing me from spawning theme or some kind of manager in the world ?

wild glade
#

is there a way to assert that the parent's type is equal to a specific class? (they inherit GenericEntity)
parent.Type() == LB_EnemyHideoutBase; // <- type of this

wild glade
#

can I somehow access entities within the same (world-) layer? i.e. find every entity in the same layer of type ABCD

ocean kernel
inland bronze
#
void RequestSetContainer(CE_SearchableContainer container)
{
    SetContainer(container);
    Rpc(RpcDo_SetContainer, container);
}

[RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
protected void RpcDo_SetContainer(CE_SearchableContainer container)
{
    Print("proxy-side code");
    SetContainer(container);
}
``` I'm calling `RequestSetContainer()` from a server-side system, which sets the container on server. Then Rpc's to set the container on peer, but it doesn't set on client when `RequestSetContainer()` is called from the system (additionally, the client isn't loaded in yet when it runs).

However, if I call `RequestSetContainer()` from the component with a debug key press when client is loaded, it sets fine. Am I looking more at a timing issue or still something off with replication?
#

I would think that it'd replicate since it's set on server (and called to be set on client) even if set before the player loaded, or am I mistaken?

minor agate
#

Anything else sent before that is lost

#

Use RplSave on auth to know when you can send something to a proxy/owner

inland bronze
#

hmm (E): ScriptBitWriter::Write: type 'CE_SearchableContainer' not supported not sure how to address this

minor agate
#

Because it seems it was doing exactly what you are trying to do, but you are doing it in a weird way

inland bronze
#

I also struggle with learning things with just being told and shown, I gotta deep dive in most of the time and learn hands on. So I could watch it 50 times and still not retain much until I do it myself lol.

But yes, am watching it

torpid mist
#

Can I get some help. I cant see to figure out what Im doing wrong. Im trying to create a custom loading screen for my server. I altered the ScenarioLoadingScreen.layout but nothing changes. Is there something Im missing?

torpid mist
static vale
#

How do i make a player invisible? I tried setting the body parts to a transparent material but that didn't work?

When I set the faction the player is no longer invisible.

inland bronze
# minor agate Because it seems it was doing exactly what you are trying to do, but you are doi...

I notice in the video, the authority system is setup as a “both” system, being server and client, and then the proxy system as just client. What would be a potential case where you would use just a “server” system?

Because that’s what I’ve been trying to do initially (setting it up as a server system), and so far it seems like that’s where most of my issues are stemming from. Maybe I misunderstood when just a server system would apply, and it may not apply to my case

#

My system is being based around mass entity spawning

minor agate
#

Same for the other case.

minor agate
#

Setting it to server means that it only exists on server

#

Client to client, and both to client and server

#

In server and "both", the server is the authority

#

And in "both", you have access to proper replication through the system

serene fox
#

Morning, if i like to add an force to an object (like an magnet), to lift it up. Does the force need to be apply on the top or on the bottom of the object? I try the CenterOfMass and added a force by vector.up * 200000, this should be 20 tons. But the object does not even move. Sim is on.

clever oxide
tacit roost
#

Hi there guys awhile back I managed to get dynamic moving map markers such as the the ones in conflict game mode that a squad leader could see also I edited a line in a script to true i have to be honest I wasn’t really sure how I managed to enable this and I can’t remember if there is anybody out there that knows how to set dynamic moving map unit markers to visible for the squad leader with out writing custom scripts can you please let me know cheers

analog python
ocean kernel
#

How do you get the weapon someone was killed with?

high hawk
# ocean kernel How do you get the weapon someone was killed with?
                        BaseWeaponManagerComponent wpnManager = BaseWeaponManagerComponent.Cast(instigatorContextData.GetKillerEntity().FindComponent(BaseWeaponManagerComponent));
                        if (wpnManager)
                        {
                                WeaponSlotComponent currentSlot = WeaponSlotComponent.Cast(wpnManager.GetCurrent());
                                if (currentSlot)
                                {
                                        Print("KillerPlayerWeaponType", SCR_Enum.GetEnumName(EWeaponType, currentSlot.GetWeaponType()));
                                        Print("KillerPlayerWeaponName", currentSlot.GetUIInfo().GetName());
                                }
                        }
ocean kernel
#

This gets the current weapon the instigator has equipped, not the weapon that was used to kill them

high hawk
#

Okay

#

Stay golden pony boy

ocean kernel
#

For guns this will usually match

#

But if I kill you with a mine

#

It will show AK74

#

Since its what I have equipped

#

Do u kno wat I mean

high hawk
#

Yes bracon

ocean kernel
high hawk
#

Maybe use a world system

#

Idk

ocean kernel
#

Brilliant

fervent cedar
ocean kernel
#

Yeah there are but I did not open them to check how they do it

#

Tryna gather some ideas here

#

And see if there's a way to track it reliably

fervent cedar
#

aviator Looks like we need a feature request for the BaseDamageContext / BaseDamageEffect

analog python
#

It really should be integrated into the Instigator context or something similar, because dealing with separate systems for handheld weapons, vehicle pilot weapons, gunner turrets, and so on is a real pain

#

also dealing with distances after killer dies and then respawns whilst the victim bleeds out, or if the killer changes the weapon that is equipped

#

there's like a shit load of edge cases you need to account for

#

also vanilla weaponslotcomponent that are machine guns dont provide any context data at all if fired by pilot

serene fox
fervent cedar
#

modded class SCR_BaseBulletDamageEffect {

So basically you can at least have the same SCR_BaseBulletDamageEffect object.
But you need to manually track which one is which

#

So you need a script that fires when a gun is fired and on SCR_BaseBulletDamageEffect init.
Then when a SCR_BaseBulletDamageEffect is created on teh same tick as the bullet is fired, save the weapon name / position into the SCR_BaseBulletDamageEffect object.

frosty coral
fervent cedar
#

Then you can query it on HandleConsequences which runs when the damage is evaluated

serene fox
fervent cedar
#

@ocean kernel scuffed position+char tracker hmmyes

#
modded class SCR_MuzzleEffectComponent {
    override void OnFired(IEntity effectEntity, BaseMuzzleComponent muzzle, IEntity projectileEntity) {
        HCA_H_OnFired(effectEntity, muzzle, projectileEntity);
        super.OnFired(effectEntity, muzzle, projectileEntity);
    };
    void HCA_H_OnFired (IEntity f_Ent_Muzzle, BaseMuzzleComponent f_Comp_Mzl, IEntity f_Ent_Prj) {
        HCA_H_s_iTick_Last_Mzl = System.GetTickCount();


        Print("HCA_H_OnFired");
        Print(this);
        Print(HCA_H_s_iTick_Last_Mzl);
        Print(f_Comp_Mzl);
        Print(f_Comp_Mzl.GetOwner());
        Print(f_Comp_Mzl.GetOwner().GetName());


        SCR_ChimeraCharacter t_Char_This;
        ProjectileMoveComponent t_Comp_MoveTesting = ProjectileMoveComponent.Cast(f_Ent_Prj.FindComponent(ProjectileMoveComponent));
        if (t_Comp_MoveTesting) {
            Instigator t_Ins = t_Comp_MoveTesting.GetInstigator();
            if (t_Ins) {
                t_Char_This = SCR_ChimeraCharacter.Cast(t_Ins.GetInstigatorEntity());
            };
        };
        Print("HCA_H_OnFired---");
        if (!t_Char_This) {
            return;
        };
        if (!SCR_BaseBulletDamageEffect.HCA_H_s_Last) {
            Print("HCA_H_OnFired:: no last bullet effect");
            return;
        };

        if (
            HCA_H_s_iTick_Last_Mzl == SCR_BaseBulletDamageEffect.HCA_H_s_iTick_Last_DmgFx
            || (HCA_H_s_iTick_Last_Mzl-1) == SCR_BaseBulletDamageEffect.HCA_H_s_iTick_Last_DmgFx
        ) {
            SCR_BaseBulletDamageEffect.HCA_H_s_Last.HCA_H_m_vPos_Fired = t_Char_This.GetOrigin();
            // SCR_BaseBulletDamageEffect.HCA_H_s_Last.HCA_H_m_IEnt_Mzl = t_Char_This;
            SCR_BaseBulletDamageEffect.HCA_H_s_Last.HCA_H_m_IEnt = t_Char_This;

        };
    };
    static int HCA_H_s_iTick_Last_Mzl;
    static SCR_MuzzleEffectComponent HCA_H_s_Last;
};
#

modded class SCR_BaseBulletDamageEffect {

    void SCR_BaseBulletDamageEffect () {
        HCA_H_Test();
    };


    void HCA_H_Test () {
        HCA_H_s_iTick_Last_DmgFx = System.GetTickCount();
        HCA_H_s_Last = this;
        Print("Init");
        Print(this);
        Print(HCA_H_s_iTick_Last_DmgFx);
        // // Print(this.GetOwner());
        // Print(GetInstigator());
        // if (GetInstigator()) {
        //     Print(GetInstigator().GetInstigatorEntity());
        //     Print(GetInstigator().GetInstigatorPlayerID());
        // } else {

        // };
        // if (!GetInstigator().GetInstigatorEntity()) {

        //     if (Math.RandomFloat(0, 100) > 50) {
        //         return;
        //     };
        //     GetGame().GetCallqueue().CallLater(HCA_H_Test, 522, false);
        //     Print("call later");
        // };
        Print("Init---");
    };


    static int HCA_H_s_iTick_Last_DmgFx;
    static ref SCR_BaseBulletDamageEffect HCA_H_s_Last;


    vector HCA_H_m_vPos_Fired;
    IEntity HCA_H_m_IEnt;

    //------------------------------------------------------------------------------------------------
    protected override void HandleConsequences (SCR_ExtendedDamageManagerComponent dmgManager, DamageEffectEvaluator evaluator) {
        super.HandleConsequences(dmgManager, evaluator);

        HCA_H_Test2(dmgManager, evaluator);
    };

    void HCA_H_Test2 (SCR_ExtendedDamageManagerComponent dmgManager, DamageEffectEvaluator evaluator) {
        Print("HandleConsequences");
        Print(HCA_H_m_vPos_Fired);
        Print(HCA_H_m_IEnt);
        Print(this);
        Print("HandleConsequences---");
    };



};
#

Looks like muzzleffect fires 1 tick after SCR_BaseBulletDamageEffect is created

#

But I got the data

  SCRIPT       : HandleConsequences
  SCRIPT       : vector HCA_H_m_vPos_Fired = <1071.618408,38.411144,2924.195557>
  SCRIPT       : IEntity HCA_H_m_IEnt = SCR_ChimeraCharacter<0x0000000082FBF4B0> @"ENTITY:6917529027641082632" ('SCR_ChimeraCharacter','Assets/Characters/Basebody/Basebody_Male_01.xob') at <1071.618408 38.411144 2924.195557> @"{26A9756790131354}Prefabs/Characters/Factions/BLUFOR/US_Army/Character_US_Rifleman.et"
  SCRIPT       : Class this =  SCR_BaseBulletDamageEffect<0x00000000B3EFBA50>
  SCRIPT       : HandleConsequences---
#

Also you can technically probably fire more than 1 bullet in 1 frame tick, so it's slightly flawed

ocean kernel
fervent cedar
#

What's the opposite way?

ocean kernel
#

Least explicit way possible

fervent cedar
#

m_MyCar_Bacon_IEnt

ocean kernel
#

I wonder if I would have better luck extracting BaseDamageContext.damageSource and .instigator

#

damageSource is supposed to be the projectile

#

Like in your OnFired example

#

Could attach the weapon name to every projectile

#

Nevermind I've been Bohemia'd

fervent cedar
#

frogthinking Yes

#

But you know a funny silly trick ...

#

You can create a map that uses the projectile as key

ocean kernel
fervent cedar
#

I did thise before to know what weapon a projectile came from


        HCA_m_mPrjToLaunchTime.Insert(f_IEnt_Prj, t_fTimeCurrent);
        HCA_m_mPrjToWeapon.Insert(f_IEnt_Prj, f_IEnt_Wpn);
ocean kernel
#
# scripts/Game/generated/EntityTypes/Projectile.c
class ProjectileClass: GenericEntityClass
{
}

class Projectile: GenericEntity
{
    string m_sWeaponInfo = "Gun";
}

# some other file
modded class SCR_MuzzleEffectComponent {
    override void OnFired(IEntity effectEntity, BaseMuzzleComponent muzzle, IEntity projectileEntity) {
        Projectile.Cast(projectileEntity).m_sWeaponInfo = "Some Weapon";
        
        super.OnFired(effectEntity, muzzle, projectileEntity);
    }
}

modded class SCR_HitZone {
    override void OnDamage(notnull BaseDamageContext damageContext) {
        Projectile projectile = Projectile.Cast(damageContext.damageSource);
        if (projectile)
            PrintFormat("Damaged with: %1", projectile.m_sWeaponInfo);
        
        super.OnDamage(damageContext);
    }
}
#

We good

#

Thanks for the input

#

Wonder if this will work in the game

#

@fervent cedar @analog python

analog python
ocean kernel
#

I will test it rq

ocean kernel
#

Bummer, the Projectile override doesnt work on server, but nothing throws VMEs

#

Almost as if that override became a different class somehow

#

Oh I'm a dumbass

minor agate
ocean kernel
#

Its because the effect is set to disabled on dedicated server

ocean kernel
#

I made a custom muzzle effect component with a dummy particle and enabled that on dedicated

#

a bit hacky

#

but maybe storing weapon information in the projectile like that is good

#

not sure yet how to pass this information from OnDamage to OnPlayerKilled

lofty stag
#

Is there a way to make name tags not show civilians? Only the faction you belong to?

ocean kernel
#

Just turn it off on the civ character base lol

lofty stag
#

It’s part of a PvE server that has civilians in towns

wild glade
#

Hi, does anyone know how I can access entities within the same layer (like siblings)?
i.e. Access LB_UnitGroup from LB_EnemyHideoutBase?

fervent cedar
ocean kernel
#

Might be a better idea yeah!

#

Since that gets passed

wild glade
#

I get the following error when adding a waypoint onto a group. Did I miss something to add to the world, except AIWorld?

Virtual Machine Exception

Reason: Index out of bounds.

Class:      'SCR_AIConfigComponent'
Function: 'Get'
Stack trace:
scripts/Game/AI/Components/SCR_AIConfigComponent.c:181 Function PerformGoalReaction#65166
scripts/Game/AI/Components/SCR_AIGroupUtilityComponent.c:197 Function EvaluateActivity
scripts/Game/AI/ScriptedNodes/Groups/SCR_AIDecideActivity.c:26 Function EOnTaskSimulate
#
    void AddWaypoint(ResourceName waypointName)
    {
        logger.Log("Try adding AI Waypoint. " + m_aiGroup);
        if(m_aiGroup)
        {
            logger.Log("Should spawn AIWaypoint");
            Resource waypointRes = Resource.Load(waypointName);
            
            if(!waypointRes)
            {
                logger.Error("Could not resolve waypoint: " + waypointName);
                return;
            }
            
            AIWaypoint waypoint = AIWaypoint.Cast(GetGame().SpawnEntityPrefab(waypointRes, null, LB_Utils.GenerateSpawnParameters(m_spawnPosition)));
            
            if(!waypoint)
            {
                logger.Error("Could not spawn waypoint: " + waypointName);
                return;
            }
            
            logger.Log("Added waypoint to group: " + waypointName);
            m_aiGroup.AddWaypoint(waypoint);
        }
    }
wild glade
ocean kernel
#

In which update was the replication stuff moved to main thread?

minor agate
#

It's just that if the replication thread, or any thread for that matter tries to use anything in scripts. Then they get blocked by the main thread which is where scripts run

ocean kernel
#

I'm recently seeing more reports from server owners about desynced vehicle physics and teleporting vehicles

minor agate
#

If main tread is blocked, and a trhead tries to use scripts. Then they also get blocked as they can't proceed.

ocean kernel
#

That's fine, just tryna figure out what happened recently to increase this in frequency

past berry
#

Has anyone worked with radial menu before? I'm trying to make my own custom radial menu but I can't figure out which parts to work with. Thanks for any help.

minor agate
ocean kernel
#

So when did you guys do that?

minor agate
#

It's already in a bad state by the game. Becomes worse with each modder using it

ocean kernel
#

Right. I'm trying to gauge when it became this bad.

fervent cedar
#

we need headless client it sounds like

#

server should only have 1 job and 1 job only.
To network things.
Everything else should be on headless client

#

imagine having slow call que and tons of slow scripts, none of them affect the server

sweet badger
minor agate
fervent cedar
#

Where are he?
I can't see them

minor agate
fervent cedar
#

okay it says
🤔

#
ArmaReforgerServerDiag.exe -profile ArmaReforgerDS_Peer -client 127.0.0.1 -maxFPS 30 
#

Soooo....
It's kinda undocumented what does headless do other than error?
Does it follow network range rules or is it special like arma 3?

minor agate
#

Just mod the method to detect when a server is a client

fervent cedar
#

Is HasInterface a thing?

#

Ahh here we go
IsConsoleApp
It's the hasInterface test

#

Just write everything with IsServer & IsConsoleApp hmmyes

#

Like it's supposed to be

#

Also ai is engine locked as far as I know,
So I can't even run the ai on the headless anyway.
But at least scripts being possible is nice

clever oxide
narrow aspen
#

any error in this code? I can not find the saved json file and path after running on workbench

narrow aspen
#

find it. forgot to create the folder

wild glade
#

hi, im trying to make a parameter optional via ... = null:
void AddWaypoint(ResourceName waypointName, vector position = null)
But I get the error: Incompatible parameter 'null' hmmGe

torn bane
wraith pagoda
torn bane
wraith pagoda
wild glade
#

What kind of attribute do I need, in order to have make a array of objects configurable? It's not showing in the .conf file like this:

[Attribute(uiwidget: UIWidgets.Auto, category: "Enemy Units")]
ref array<LB_MechanizedInfantryEntry> m_aEnemyMechanizedGroupPrefabs;

// LB_MechanizedInfantryEntry.c
class LB_MechanizedInfantryEntry
{
  [Attribute(uiwidget: UIWidgets.Auto)]
  ResourceName m_aInfantryGroupPrefab;
    
  [Attribute(uiwidget: UIWidgets.Auto, category: "Enemy Units")]
  ResourceName m_aVehiclePrefab;
}
torn bane
#

Add the base container attribute on the class you want to select an array from

And you need another ref for the array elements

wild glade
#
[BaseContainer()]
class LB_MechanizedInfantryEntry
{
    [Attribute(uiwidget: UIWidgets.Auto)]
    ResourceName m_aInfantryGroupPrefab;
    
    [Attribute(uiwidget: UIWidgets.Auto, category: "Enemy Units")]
    ResourceName m_aVehiclePrefab;
}

[BaseContainerProps(configRoot: true)]
class LB_Config 
{    
    [Attribute(uiwidget: UIWidgets.Auto, category: "Enemy Units")]
    ref array<LB_MechanizedInfantryEntry> m_aEnemyMechanizedGroupPrefabs;
}
#

Adding ref to either ``m_aInfantryGroupPrefab` or vehicle gives me the error "Auto-pointer 'ResourceName' must be class-type"

pliant ingot
wild glade
# wild glade ```C# [BaseContainer()] class LB_MechanizedInfantryEntry { [Attribute(uiwidg...

Thanks, I got it working. For anyone wondering in the future on how to correctly attribute a array of objects:

[BaseContainerProps()] // <- This was missing
class LB_InfantryVehicleEntry
{
    [Attribute(uiwidget: UIWidgets.Auto)]
    ResourceName m_aInfantryPrefab;
    [Attribute(uiwidget: UIWidgets.Auto)]
    ResourceName m_aVehiclePrefab;
}

[BaseContainerProps(configRoot: true)]
class LB_Config 
{    
    [Attribute(uiwidget: UIWidgets.Auto, category: "Enemy Units")]
    ref array<ref LB_MechanizedInfantryEntry> m_aEnemyMechanizedGroupPrefabs;
    // -------^ this ref was missing ------
}
wraith pagoda
#

I've just started out with reforger... never written in C before, and I'm browsing the mod project to try and find out where the first file is called and I have no idea where I'm looking... what file is called when the mod is initialized?

ocean kernel
#

is bro looking for int main

wraith pagoda
neon elbow
#

Is there a reason why sphere shape works for triggers but not the bounding box?

spark otter
wraith pagoda
spark otter
#

Yeah that doesn't really narrow it down at all.

wraith pagoda
#

well basically, how do you get started... where's the init file? How does the mod know what to call and what classes to define?

#

at the moment, I've got a bare project with literally nothing in it... how do I get anything in it?

spark otter
#

You gotta start with a goal in mind, not just "make a mod"

wraith pagoda
#

do I just start slapping mystical files into it, and it just reads them willy nilly one by one?

wraith pagoda
spark otter
#

No, first step is to figure out what you wanna do. Then maybe we can help.

wraith pagoda
#

like at server startup, how does it know to call anything?

wraith pagoda
spark otter
#

Well I don't, so i can't really help. My break at work is over, back to the grind!

neon elbow
#

It's too vague. I can recommend you some files to read over for useful functions/methods

#

I'd read tools.c, Game.c, game.c, and IEntity.c. But we're here if you need help with something specific.

rapid ferry
# wraith pagoda like at server startup, how does it know to call anything?

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

everything is centered around the ECS architecture. Entities exist in the world and can have components. Main gamemode logic exists on a gamemode entity, which you can derive and make your own gamemode from. Just make a new script and inherit base gamemode.

Systems are also important for global level control and behavior. Definitely use these, they are best practice and Mario will be happy. https://community.bistudio.com/wiki/Arma_Reforger:Systems

i have heard it is not good practice to use components for entity-level logic anymore, so only use components for data (or do whatever you want, it adds up but for sake of learning sometimes it easy to start with all logic in entity events)

#

Make sure to also read up on replication, best docs are in the comments of the replication class

midnight talon
# wraith pagoda like at server startup, how does it know to call anything?

Aside from entity lifecycle methods and systems Adam mentioned above, things more specific to game mode itself would be initialised in constructor or .Start() method of whatever GameMode entity is in the world the server loads. That would probably be your entry point for making a full game mode from scratch. Check out the source for Conflict (called Campaign in scripts) SCR_GameModeCampaign for a better idea

dark ocean
#

how do I bundle my custom data saved with SCR_BinSaveContext within the mod package? apparently json files get bundled, if I hack around a .meta registration for my .bin files they just get ignored.
trying to work around by saving a foo.bin.json and loading it with SCR_BinLoadContext doesnt work, it still tries to treat it as a json (yet another Totally Predictable API Behavior™)

minor agate
#

😅

crystal edge
#

Hey I got a question do anyone know how to make a script bc i been trying to make a script for weed where a player grab the weed buds then take it to sort it then pack it then sell it but I can’t figure out how to make a script for that Im new doing script and everything with arma tools

wraith pagoda
#

@rapid ferry @midnight talon thanks guys - this is exactly the information I was looking for 😁

torn bane
# dark ocean how do I bundle my custom data saved with `SCR_BinSaveContext` within the mod pa...

There are two issues. First being that your custom .bin file is not included in the mod bundle - that I am not sure about. I wonder why it would be excluded. Have you tried .blob as extension? Maybe there is a whitelist of what assets types we include.

Loading blah.json even if it is binary content does not matter. Bin load context with load from file will treat it as binary content. it has no care in the world of file name or extension.

craggy jolt
#

So transformation matrix is 3 orientation vectors and position vector? No scale vector?

#

Oh, scale is orientation vectors magnitudes

#

Is there a page on wiki about it at all?

dark ocean
craggy jolt
#

Guess so, I got too used to dealing with vectors separately in RV

ocean kernel
#

Storag

dark ocean
wild glade
#

Can I somehow draw gizmos in workbench? Like a red dot/line/cone, where an invisible entity is?

craggy jolt
#

Shape.CreateLines and other methods there

wild glade
#

Im trying to draw a sphere like this. However they are not showing :o

override void EOnInit(IEntity owner)
{
    Shape.CreateSphere(COLOR_GREEN_A, ShapeFlags.FLAT, GetOrigin(), 5);
}
craggy jolt
#

but yeah, you need to ref it or it releases

wild glade
#

storing it in a ref worked, thank you!

wild glade
#

Ah i was missing this:

    override int _WB_GetAfterWorldUpdateSpecs(IEntitySource src)
    {
        return EEntityFrameUpdateSpecs.CALL_WHEN_ENTITY_VISIBLE;
    }
dark ocean
#

anyway, foobar.bin.json it is it seems

torn bane
craggy jolt
#
    vector scale[3] = {
         Vector(m_vScale[0], 0, 0)
        ,Vector(0, m_vScale[1], 0)
        ,Vector(0, 0, m_vScale[2])
    };
    Math3D.MatrixMultiply3(mat, scale, mat);
```Is there a quicker way to create that matrix out of scale vector? Some proto function perhaps?
torn bane
torn bane
craggy jolt
craggy jolt
#

Looks like Shape.SetFlags adds flags rather than setting them 🤔

#

No way to remove flag once added

wild glade
#

Does anyone know why my workbench crashes, once I compile this?

class LB_SpawnUnitsTriggerClass : BaseGameTriggerEntityClass
{
}

class LB_SpawnUnitsTrigger : BaseGameTriggerEntity
{
    override void OnActivate(IEntity ent)
    {
        Print("Triggered: " + ent);
    }
}
clever oxide
#

PrintFormat("Triggered: %1", ent);@wild glade

candid garnet
#

Also, on phone so don't know if phone changes it, but to format discord to c# use cs instead of c#

west prism
#

i cant move M60 gun to Alice BackPack can edit it?

wraith pagoda
#

IDK why, but reforger modding is so overly complicated it seems. How can I spawn a hat on the player using a script?

craggy jolt
candid garnet
#

Fitting name haha

craggy jolt
#

Yeah, character storage inventory base whatever something

craggy jolt
west prism
#

dont work for me

#

backpack has volume has weight

#

dimensions is like ak74

#

maybe backpack edit?

wraith pagoda
wild glade
#

Does anyone know why my trigger triggers like 20+ times at the same time?

#

(fixed ss)

craggy jolt
#

Its still huge 3000

wild glade
west prism
#

yeah u can go 2 ways but easy one is set the back pack demenision so u can carry all weapons

wraith pagoda
craggy jolt
#

Ctrl+Shift+F : BaseLoadoutManagerComponent to see if something inherits it

wraith pagoda
#

There's a usage of it in a workbench script to "check loadout", but it uses IEntitySource, which I also don't have access to, and can't find a way to it when I have the IEntity

#

which again, is absolutely wild af considering the effort gone into making the tools that they don't make things circular.

minor agate
#

Which only clears the ones you provide on it

wraith pagoda
#

I'm still a bit confused as to why scripts are all higgledy piggledy all over the place with my script objects getting mixed in with them... why was this the design decision? Is it to make it harder to have custom scripts like hacks?

ocean kernel
wild glade
#

Which part of EntitySpawnParams.Tranform decides the rotation of the spawned prefab?

torn bane
#

0-2

wild glade
#

0 is x - 1 is y - 2 is z? if yes, how would I work with a vector if they are floats, or do i just convert?

torn bane
#

Transform is 4 vectors, vector at idx 3 is position, first three vectors are rotation and scale long all axis. use math3d helpers for simple yaw pitch roll angles

wild glade
torn bane
#

go into the class i mentioned and search for angle please

wraith pagoda
#

IGN:
10/10 could not wear more hats

craggy jolt
static vale
#

I can't get ClearFlags to work properly. I call clear flag it updates that flags however the entity is still visible. If i keep calling it once i'm near the entity then it will actaully make it invisible. Is there some kind of Update i need to force on entity for the flags to work??


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

    override protected void EOnInit(IEntity owner)
    {
        SetInvisible();
    }
    
    void SetInvisible()
    {
        IEntity entity = GetOwner();
        if(entity)
            entity.ClearFlags(EntityFlags.VISIBLE);
    }
}
dark ocean
#

why does const Foobar x = GetSomething(); work, but const auto x = GetSomething(); gives error: Trying to modify write protected variable 'x'?

river imp
#

I would guess that auto makes the variable write protected lol

west prism
#

can someone say how i can setup a custom marker on map for Trader?

high hawk
#

Actually hold up

west prism
#

its easy to add marker custom ?

#

i just want to add trader mark.

high hawk
west prism
#

i try it now

high hawk
#

Copy

high hawk
west prism
#

MyCustomMarker : SCR_MapMarkerEntity:
This line declares a new class named MyCustomMarker that inherits from the SCR_MapMarkerEntity class, which is the base class for all map markers in Arma Reforger.

#

To create a marker entry config class in Arma Reforger, you'll need to create a new config file and define a class that inherits from SCR_MapMarkerEntity

ocean needle
#

how would i go about getting every spawned vehicle (optionally occupied, can always be filtered) on the client?

next talon
#

Anyone have any idea what about this replication script causes my scale transform script to not take affect on servers?

rapid rivet
#

May be a fairly simple one. How would I go about creating my own custom Attachment types?

high hawk
rapid rivet
high hawk
#

Create directory in your project root - scripts/Game/Weapon ("weapon" can be anything, it's the scripts/Game dir that matters)

Right click, add new "script", name it with your attachment type.

Double click the new file, you'll be presented with a blank script.

⚠️ MAY BE WRONG WITH THE FOLLOWING, IM GOING OFF WHAT I REMEMBER WITHOUT LOOKING ⚠️

Copy the following into your script, change "MyAttactment" to what you desire:

class MyAttachment : BaseAttachmentType
{
}

Then compile, if you have errors, post here. Apologies in advance, I have been away at work for 3 weeks and haven't opened the tools so it's a little rough trying to do it from my phone haha

inland bronze
#

With ScriptedUserAction::HasLocalEffectOnlyScript() set to true, does that mean no replication whatsoever is possible within the useraction? Or am I just doing something wrong?

#

Running into the issue of needing it to be set to true because it's opening the inventory of the user entity, but need it to replicate to a component of the owner entity that the action was performed. And RplProp seemingly isn't working

balmy kayak
#

Does anyone know why Peer tools aren't receiving the correct values from instance attributes? My peer tool clients are only receiving updates after I apply to the prefab. Is this by design or a possible bug? I don't remember having to apply changes to prefabs in order for Peer tool to pick up the changes on an instance.

craggy jolt
#

Is there something similar to WorldEditorAPI but for Workbench preview, that I can grab to traverse entity hierarchy there?

west prism
#

can someone help me with create ?

minor agate
#

I thought you were dealing with Entity or Component

craggy jolt
minor agate
#

I will request for it to be added

craggy jolt
west prism
#

i dont have this in choose a class

inland bronze
# west prism

BaseContainerProps is not the class you need to search, it'll be the config class you created in script

#

so in that example, it'll be TAG_SuperConfig

inland bronze
scarlet iris
#

What would be the best way to make dead bodies unlootable?

minor agate
craggy jolt
minor agate
#

The World entity might be there, but it is not the active world

#

The World Entity is there because you created it for the world file you have open.

#

But no world is running nor assigned.

#

For example GetGame().GetWorld() should return null

#

The constructor of the entity and such will fire up yes, but at that point it is just that. An entity

craggy jolt
#

Component constructor log:

Workbench:

 ENTITY       : Create entity @"ENTITY:1" ('GenericEntity','Assets/Props/Crates/BoxWooden_01.xob') at <0.000000 0.000000 0.000000>
  SCRIPT       : TEST ent world = 0x0000024802269020 {}

World Editor (Prefab mode) of same prefab:

ENTITY       : Create entity @"ENTITY:3" ('GenericEntity','Assets/Props/Crates/BoxWooden_01.xob') at <0.000000 0.000000 0.000000> @"{2B1D0128ED660BE9}Prefabs/Props/Crates/BoxWooden_01.et"
 SCRIPT       : TEST ent world = 0x00000247E6D5CEA0 {}
ENTITY       : Create entity @"ENTITY:3" ('GenericEntity','Assets/Props/Crates/BoxWooden_01.xob') at <0.000000 0.000000 0.000000> @"{2B1D0128ED660BE9}Prefabs/Props/Crates/BoxWooden_01.et"
 SCRIPT       : TEST ent world = 0x00000247E6D5CEA0 {}
craggy jolt
#

Logged twice for some reason

minor agate
#

Yeah that misled you into believing world is active and meaningful in Edit Mode

#

In Edit Mode, it is just an entity like the rest.

craggy jolt
#
        WorldEditorAPI api = entity._WB_GetEditorAPI();
        bool isWorkbench = !api || (owner.GetWorld() != api.GetWorld());
```This is how I determine if entity is inside that workbench "world"
#

Anyway, my main goal is to get entity children, there is no Hierarchy component on them so that's not an option. There is no WorldEditorAPI so I can't use that. Any other option?

minor agate
#

Because of what I told you

#

Just do WorldEditorAPI.IsEditMode()

craggy jolt
#

From my test it worked properly, I could tell if entity is in workbench "world" or in World Editor world

craggy jolt
craggy jolt
inland bronze
# scarlet iris What would be the best way to make dead bodies unlootable?

I would think that you'd mod the SCR_LootDeadBodyAction or just simply remove the action from the ActionsManagerComponent in the Character_Base.et prefab

Action script:
https://enfusionengine.com/api/redirect?to=enfusion://ResourceManager/~ArmaReforger:scripts/Game/UserActions/SCR_LootDeadBodyAction.c

Character_Base.et
https://enfusionengine.com/api/redirect?to=enfusion://ResourceManager/~ArmaReforger:Prefabs/Characters/Core/Character_Base.et

minor agate
#

@craggy jolt I see what you mean now, I thought you were asking about Game active World

craggy jolt
# minor agate This is flawed for WB EditMode

Oh, it is flawed in a sense that owner.GetWorld() != api.GetWorld() does nothing, there is no API even if you have World Editor open, thought it would return the API even for Workbench entity

#

So just !api for workbench check is enough

minor agate
#

If there is no hierarchy, and the entities are not calling on the parent AddChild (Which is what Hierarchy component does) then there is no nice way to get it

craggy jolt
minor agate
#

GM PreviewEntity does this iirc

minor agate
#

It goes to the source where the entity was created from

#

Which means you get the configuration it had

craggy jolt
#

Got it, will try

minor agate
craggy jolt
#

Nothing like WorldEditorAPI.SourceToEntity

#

Guess I'm out of luck to easily get child entities in workbench then

#

GIB WorkbenchAPI

minor agate
#

But yeah there is no mapping

#

The thing is, that what you see in the world editor on the left, is for management purposes

craggy jolt
#

Well, at least I can figure out what entity is root through that

minor agate
#

It does not tell you anything about hierarchy

#

Hierarchy is not a thing there

#

Think of them as layers and sublayers

craggy jolt
#

Yeah I get that's its just a template to build playable world out of it, I was making editor tools for myself and needed that hierarchy outside of play world

craggy jolt
#

@minor agate May I bug you with something I can't figure out?

I store my data in component's class class and get it with TestComponentClass cl = TestComponentClass.Cast(GetComponentData(owner)); inside component. When viewing same prefab in workbench and world editor, root entity component produces and points to difference instance of that class class data BUT child entities with their own component and data point to same instance of that class class data

#

I built a quick repro project if you're interested, not sure if I'm just a dummy and don't understand it before trying to submit it anywhere

#

How I found it - Shape.CreateLines is contextual and it was creating debug lines in a wrong world

#

Was visually debugging class class data

minor agate
craggy jolt
#

Yes, but why its different for parent/root entity VS child entities?

minor agate
#

So it will be shared across everything using the same strand of inherited prefab or component prefab

#

They are probably different strands

#

ComponentClass is not the same as static

#

It's way more complex

craggy jolt
#

Also when I edit child component data in the prefab, it becomes different for children in WB vs WE and remains different even if I revert the change until I restart Workbench notlikemeow

#

Well, I guess I'll just live with it

minor agate
#

It's why we say to not test things in Workbench game

#

Just launch Dedicated Server tool. You will remove yourself from many issues.

#

WB playmode is more suited for world/terrain development

craggy jolt
#

I guess I'll have to call my Shape.CreateLines from different context then and never from class class data config

craggy jolt
#

Being able to specify world for debug shapes as you can for debug text would've been useful though

minor agate
#

Any modification you do down the line, creates a DataClass instance

#

And anything that inherited in prefab from that

craggy jolt
#

Would let me fix my issue without having to rearrange stuff now

minor agate
#

useas that one

#

If you modify an entity in the world on the data class values, then that one in specific will haave it;s own

#

@craggy jolt if you want individual data to each component, then just do the attributes on the component itself. Not on componentclass

craggy jolt
inland bronze
#

Does a RplProp have to be instantiated?

For example, can it be like so:

[RplProp()]
protected ref MyCustomClass  m_CustomClassVariable;
``` or does it always have to be
```cs
[RplProp()]
protected ref MyCustomClass  m_CustomClassVariable = new MyCustomClass();

I ask because my PropCompare() for the custom class always returns null when comparing it's variables if not instantiated. But additionally, I can't get the RplProp to replicate properly even when instantiated, so may be related to that as well 🤔

ocean kernel
#

I feel like if it's null it would just become instantiated when it syncs but I'm just guessing

#

I guess engine is not that smart

#

Or maybe the snapshots dont know how to compare when its null or something

#

I'm not smart enough

pliant ingot
#

None of my and most of the bis's props are not instantiated like your example

sleek dove
#

If you have custom encoding, you should handle the null case yourself of course, it will not do it by itself

inland bronze
minor agate
#

It destroys the object anyway whenever it gets synced

#

Then recreates it

#

Which is why you should never try to hold a weak or strong reference to the replicated object

#

As it it will be a new object every time it gets replicated to the receiver

minor agate
inland bronze
minor agate
inland bronze
#

beautiful, now if I can just figure out why the RplProp won't replicate when doing Replication.BumpMe()

silver acorn
#

yo is it possible to save file in $profile on console boys pls ?

minor agate
#

You can't call it from outside a method from within the class

#

Replication.BumpMe() is context aware of where you called it

#

It has to be called from a method that is directly under the replicated class

inland bronze
# minor agate It has to be called from a method that is directly under the replicated class

What I'm trying to do currently is, in my gamesystem, I set the custom class variable that is within a component. Then when it's set in the component, I call (from the component, not the system) Replication.BumpMe(). So is that supposed to work or not work?

// in GameSystem (system is set to "both")
void method()
{
  // blah blah
  containerComponent.SetContainer(container);
}

// in component
[RplProp()]
protected ref CE_SearchableContainer m_Container;

void SetContainer(CE_SearchableContainer container)
{
    m_Container = container;
    
    Replication.BumpMe();
}
// currently does not replicate
``` am I misunderstanding how to do it? Because it's how I've achieved it in the past 🤔 

I'm a little confused by your explanation, the way I understand your explanation is that `Replication.BumpMe()` has to be called from the RplProp class itself, like in this instance `CE_SearchableContainer`, which I didn't think was the case. But it's also 5am so lol
minor agate
minor agate
#

If you do it before the component is inserted and initialized by replication then it won't be bumped and updated

#

?

balmy kayak
#

Why is peer tool only getting prefab attributes? They don’t receive the instance attribute values.

nocturne wraith
#

Hello

balmy kayak
#

Only after I apply changes to my prefabs do the peer tools get the changes.

They don’t receive instance changes. So if I wanted a prefab with slightly different values, peer tool can’t see those ???

pliant ingot
#

So if your attribute is not synced elsewhere then it will be from prefab

balmy kayak
pliant ingot
#

Loadtime normally creates on both side with instance attributes

balmy kayak
#

Hmmm ok, I guess I need to read the page on the differences with those again. Thanks for your help.

wooden cape
#

Is it possible to reference the mission header on load/postinit? I'm hitting this issue on mission load.

#

class

private string m_sAuthorName;

OnPostInit

SCR_MissionHeader header = SCR_MissionHeader.Cast(GetGame().GetMissionHeader());
        m_sAuthorName = header.m_sAuthor;
#

Hmmmmmmmm. Okay, dug a bit deeper. This is only happening in the dedi server tool with the mission header defined. It does not happen on a live server enviro. hermmmmmmmmmm

#

Bug report worthy?

torn bane
wooden cape
#

Will try

#

Still happening without header set

wraith pagoda
wooden cape
#

Omg you're correct. Reading way too quick this morning haha

#

Same issue REEEEEE

None the less, minor issue. Just makes checking some logging stuff a pain where I need to do it on the server so no worries.

ocean needle
open pier
#

So for testing features in workbench, is the peer tool the closest I can get to simulating an actual DS environment?
I used the Dedicated Server Tool to test some features, since from what I can see atleast, its the same exact setup as running a regular server. Through this testing, I got a feature to work, put it into the game and it didn't work. Really trying to get over this hill of, "works in workbench, but not ingame" but it seems I lack some understanding somewhere.

wraith pagoda
#

So in the resource browser in workbench, I can create scripts in my own mod folders... but according to the documentation, no scripts will be loaded that are outside the default locations - why do I have the option to create scripts in locations that can't run those scripts?

wooden cape
#

Anyone know of a way to check the terrain name a mission is being played on?

dire sinew
dire sinew
dire sinew
wooden cape
#

Yeah, that's what I thought. I overrode the mission config and will just have mission makers add it for now.

#

Ty kex

wraith pagoda
#

It's also unclear if workbench plugins must reside in the workbench scripts directory, or if they can run / be placed in any directory.

inland bronze
# minor agate When did you call `method()`

The method() is called upon registering of the component to the system, which then processes the component into my custom class and sets the custom class variable for the container.

The registering of the component is called with a script invoker, that is invoked after TriggerAreas are done querying entities. And those trigger areas are set to start querying in EOnInit, which if I’m not wrong, is after replication is initialized..?

lusty sparrow
#

General question about scripts before I go diving into this new language (SQS veteran). Can scripts still create and/or destroy entities and/or prefabs in scenarios? If so: can scripts also create and/or modify specific components within named entities?

Example: a script, when executed, creates a capture point but is not initially capturable until said point is 'upgraded' via a secondary action.

dire sinew
#

Or you go with an ECS approach and let a system do all the handling that makes the point capturable. The point would then become capturable by registering it at the system.

errant wren
wraith pagoda
mighty kettle
#

Does anyone know how can I link the RankShortName data to TextWidget in overlay like PlayerName linked to Player's nametag data ?

#

How did they even linked it with player data

high hawk
#

@ocean kernel is probably on his 39th mental breakdown/ARMA Discord vent for the month (guestimation)

west prism
#

"Is there an option to copy and paste a prefab?
I want to copy a Rigidbody and paste it onto another one, because I edited it, and when I set up a new one, I have to edit it all over again."

inland bronze
#

it'd be nice though

west prism
#

u mean like this one_

#

?

#

like boris marshak

#

If copy-pasting doesn’t work, open both objects in the Inspector and manually copy over the Rigidbody values (mass, drag, damping, etc.).

#
  1. Save as a new prefab:
    After configuring the Rigidbody once, save the object as a new prefab.

Then you can reuse this prefab as a base, and change the mesh or other parts without redoing the Rigidbody.

#

u mean this way?

inland bronze
#

Yeah, you can use it as a base and create inherited prefabs from it. It'll inherit the rigid body to every child prefab, so no need to redo it

west prism
high hawk
inland bronze
fervent cedar
#

open your prefab in text editor is also epic solution

narrow aspen
#

any way to generate a dynamic forbidden zone in game?

inland bronze
# minor agate When did you call `method()`

upon further testing, it's not a timing issue as a test bool set as a RplProp replicates properly when called from that same method. So, something is up with the codec I have for the custom class, I assume

minor agate
#

Something somewhere is wrongly setup

high hawk
#

@minor agate question about world systems, is it possible to register a component to multiple systems depending on the state? Or even something like sub-systems?

inland bronze
# minor agate At this point share the whole project to see

all available on my github meowerSalute

Main GameSystem (Line 407 specifically where the custom class variable is set in the component): https://github.com/CashewSan/Central-Economy/blob/daily-backups/source/Scripts/Game/CentralEconomy/Systems/CE_ItemSpawningSystem.c

Component where the custom class variable is contained (Line 52 is variable, setter is Line 282): https://github.com/CashewSan/Central-Economy/blob/daily-backups/source/Scripts/Game/CentralEconomy/Components/CE_SearchableContainerComponent.c

Custom class script (a lot is commented out in the codec to try and locate the issue): https://github.com/CashewSan/Central-Economy/blob/daily-backups/source/Scripts/Game/CentralEconomy/CE_SearchableContainer.c

fringe prairie
#

Can I register to receive events from an arbitrary IEntity (such as getting an IEntity's EOnContact without having my own component on said entity)? I want to figure out if an object attached to my vehicle collides with something, this attachment may or may not exist but there is a component on the main vehicle which needs this info.

#

I guess maybe a RegisteringComponentSlotInfo might do this? Tried search and just am not sure where to go with this.

inland bronze
minor agate
minor agate
#

If you can do it in a scripted manager instance, then you can do it in a system

red escarp
#

@ocean kernel in restart server all loadout save hide but in profile i see baconloadout folder have saves

inland bronze
inland bronze
# minor agate You should have done RplSave and RplLoad on the component, not on the custom cla...

ah, hm, if I hadn't removed the custom class already, I would've tested it to see. But I'll keep that in mind in the future, thank you so much for your patience with me peepoLove

Also, I'm running into the issue with a useraction of opening the user's inventory and having it open on all clients. Which is solved by setting HasLocalEffectOnlyScript() to return true, but at the same time, I'm needing to set a variable within a component on performing the action, but it doesn't replicate automatically because of it being set to a local effect. And since the user is not the owner in terms of rpc'ing, it gets dropped since I'm calling it from client, correct?

Is there a potential way to work around this? Or am I just thinking incorrectly?

high hawk
torn bane
ocean kernel
#

(auto)Saves dont even use the name, only scenario GUID

wraith pagoda
#

Hi @torn bane - I have a quick question regarding scripting. If I want to create a whole new system/class, how do I get those c files read by the script engine so that they're acknowledged as new classes and types?

torn bane
wraith pagoda
#

I had them int he directory, but everytime I called the command to test, it just said type not found etc

#

Thank you

lime dew
#

Hello

I have asked Wyqydsyq for permission to do this.

I am having trouble with the random loadout script, everything works fine but on local server there is a clicking sound that happens when AI squad is spawned. I have narrowed it down to only when the weapon is equipped.

plus is there a way to make this code a little better for CPU usage ? my PC lags big time when AI are spawned and yet again the culprit is the weapon.

torn bane
#

For magazines and spawning multple consider using TrySpawnPrefab on inventory storage manager, it has a count parameter too

lime dew
#

I will look into your suggestion.

it may not be a scripting issue but any reason why the game makes a clicking sound when AI squads are spawned ? only on Local server (workbench & ingame) it doesn't happen on dedicated and it 100% related to this script when weapons are equipped by the AI.

wraith pagoda
lime dew
#

I don't think it it related to weapon sounds, I can hear it every time a squad is spawned, even if I'm ~1500m (1.5km) away.

#

let me try get a video of it.

ocean kernel
#

Looks like you are running with mods. Try disabling them before you try to repro.

lime dew
#

It is only with mods... more specifically with the RandomLoadoutManager, whenever a weapon is Equipped.

ocean kernel
#

Then the answer to your question is don't use the mod if the sound bothers you

lime dew
#

we trying to find out what is causing the sound so we can fix it. it is not present on dedicated server only local.

ocean kernel
#

Also do you mean the sound that plays once when you click? The vanilla UI placing sound?

lime dew
#

is that clicking/Buzzing sound from vanilla UI placing ? the same sound plays even if the squad spawns via SF SlotAI not just in GM.

craggy jolt
#

What's going on with event order after you recompile the scripts?

#

When you first open the World Editor its reliable:

  • First all Constructor -> OnPostInit
  • Then all EOnInit
#

When you recompile its all over the place, EOnInit gets called before other components Contstructor and OnPostInit

#

Log:

Component 1: Constructor
Component 1: OnPostInit
Component 2: Constructor
Component 2: OnPostInit
Component 1: EOnInit
Component 2: EOnInit

After recompile:

Component 1: Constructor
Component 1: OnPostInit
Component 1: EOnInit
Component 2: Constructor
Component 2: OnPostInit
Component 2: EOnInit
#

More specifically my entity components fire all their initial events before gamemode manager component events 😠

#

Can't use systems as I need this logic during WE Edit Mode

narrow aspen
#

I have a score system run on server and a scoreComponent in player controlled Character. The component will register to the syetem onInit and unregister from the system onDelete. But how can I handle the situation when player disconencted and reconnect to the same character?

craggy jolt
#

Tie score to player identity rather than units?

narrow aspen
#

can I use onPlayerDisconnect and OnPlayerConnect Events? Will the player spawn a new character or just connect back to the old one?

narrow aspen
craggy jolt
#

Player index probably

#

int playerId

#

Don't delete the player score state when they disconnect, just keep re-using it when they rejoin

narrow aspen
#

yeah. I have a json file with playerUID on server for every player. The problem is if a player disconnet and his charater is not deleted, when the player reconnect, I need to handle the register/unregister things, otherwise he will maybe have two score components or mixed his score.

wraith pagoda
#

Hey @torn bane a quick follow up question regarding scripting structures... why use core, game, gamelib etc...? What's the differentiation between those directories? Does it initiate the files differently? Does it determine when the script is loaded and executed?

#

and a follow up - if I placed a script in Core, would a script in Game not have any reference to it?

#

For example; if I were to create a new class in a script for a mod that runs only on the dedicated server host, and not any of the clients, would I create that in Core or Game?

torn bane
#

basically everything you do goes into game

narrow aspen
#

hello Arkensor, when player reconnected to a server in a short time, will he have the exactly same character entity and components when using find controlled entity function?

wraith pagoda
torn bane
torn bane
wraith pagoda
torn bane
#

that is why you want to keep it simple and not worry about this until you need to 🙂

narrow aspen
torn bane
#

character might die and then your data is lost on respawn of a new one. save the data per player identity

wraith pagoda
#

Like I don't want to go through weeks worth of scripting to find I'm actually scripting in the wrong place all along, and have to then convert and move everything and re-debug it all

narrow aspen
torn bane
wraith pagoda
torn bane
#

core -> gamelib -> game -> workbench game

narrow aspen
#

I think I can figure out it using OnDelected, OnConnect, OnDisConnect

torn bane
#

but most of what you need is in game so any logic placed in core or gamelib is super limited. just use game for your mods

wraith pagoda
fringe prairie
silver acorn
#

If someone have a solution to find current platform of a player (XBOX,PS5 etc...) on server side pls 😄 it will help me a lot !

silver acorn
azure tree
#

Would anyone be able to tell me how I can make a list of world entities in a component?
I basically have some entities in the map, which are going to be Faction dependent whether or not an Faction USSR MOB spawns next to it, or US MOB spawns there.
So I want to place those entities in a component which is attached to the mob, and then compare faction after the game has started to set variables in the map entities.
I tried to make an [Attribute()] variable of "protected array<IEntity>" (ref also didnt work), but it won't show up in the Object properties tab to allow me to add entities to it.

azure tree
#

Thanks for the super quick response, will check it out!

#

That unfortunately doesn't work, as it's connected to .config files and resources. I am talking about differentiating between map entities of the same prefab in a component

pliant ingot
narrow aspen
#

where can I find the menu UI script of vehicle service?

neon elbow
forest arrow
#

SCR_ScenarioFrameworkSlotClearArea
slotClearAreaComponent.m_aPlugins.Insert()

How to create instance of plugin? Or how to insert plugin to component from script?
For example, this plugin SCR_ScenarioFrameworkPluginTrigger

inland bronze
minor agate
minor agate
#

Core gets compiled first and its main function called, gamelib gets compiled second and its main function called and core is available to gamelib. Then game gets compiled eith main func called, and gamelib is available to game and thus core too is available to game

#

As a modder, game is all ypu need

wraith pagoda
minor agate
#

Just use game

#

Pretty much nothing that is not engine related should not be in gamelib or core

#

Also if you do core, you cant access anything on game or gamelib

solid hearth
#

😭 why... this can get stuck in an infinite loop.. SCR_BallisticTableDisplay

minor agate
#

And you will not have managed instances by default, by default you will have to manage your instances like plain pointers @wraith pagoda

high hawk
#

Or just stick to game

minor agate
high hawk
#

🫡

minor agate
#

We might block those script modules in the future

solid hearth
#

wait what Stare

minor agate
solid hearth
#

complaint, it's done in two parts and can get stuck in an infinite loop when using it on a turret not setup like a mortar.

#

That is a sin among sins to have a while loop like that

minor agate
#

Do it on feedback tracker

solid hearth
#

I hate the feedback tracker, been a year and my code fix to marker system still nothing done with it worryBack

#

But whats this about script modules suss pls no takeith

#

Pretty sure it's been over a decade and still nothing done about setvelocity causing violent crashing in a3, I can't trust the feedback tracker.

wraith pagoda
#

While I've got you here and posting @minor agate - can you confirm if we make a custom map, that the map would be available in Arma4 to port in?

minor agate
#

Eventually they get fixed

#

Otherwise you would barely see bugfixing ont the changelogs

minor agate
#

Pure entities and pure terrain should be fine. Specially of your own.

wraith pagoda
minor agate
#

Some things will be similar, some wont. I suggest to mod based on that some update process will be needed.

#

Enfusion stuff might be similar, but game stuff is hard given that A4 is a new game, not an update to AR

hallow atlas
#

Hi everyone, can you tell me if it's complicated to make a script for a server, that identifies a player who uses a key combination example “ALT + Enter” and if he uses it it does an action?

minor agate
#

Think of it as pre 2.8 blender and post 2.8. Similar, but not quite

hallow atlas
spark otter
#

Found this in scripts, made me lol! ```
Typos+in+Workbanch+parametrs

hallow atlas
#

Yep

minor agate
#

Its a method that each script module can call on its own when initialized

#

Function*, not a method

pliant ingot
minor agate
#

It's the entry point that you see here

minor agate
#

Like the one I mentioned were people are leaking memory because they do not know that classes in Core and Gamelib do not automatically inherit from Managed

#
  • The confusion it makes to new modders
craggy jolt
#

I want to re-use same code to work in WE Edit and WE Play

#

I guess you can't have controllers in WE Edit either?

inland bronze
#

Generally, within the same class, is it better performance-wise to set/get variables directly or through a setter/getter?

Like for instance, doing:

if (m_Variable)
``` vs doing
```cs
if (GetVariable())
pliant ingot
inland bronze
pliant ingot
#

not sure

#

personally I prefer to do direct access if it's defined in this class and there are no additional logic required

hardy silo
#

What would be the best way to create custom map markers for the in-game papper map, so i can display custom icons on the papper map instead of just text, also does anyone know why the in editor paper map wont open but the animation of me opening the map works, the papper map works outside of the editor just fine but not in editor

forest arrow
#

SCR_ScenarioFrameworkSlotClearArea
slotClearAreaComponent.m_aPlugins.Insert()

How to create instance of plugin? Or how to insert plugin to component from script?
For example, this plugin SCR_ScenarioFrameworkPluginTrigger

west prism
#

How can i off this arsenals ?

wraith pagoda
dire sinew
wild glade
#

Quick question: Which one of these functions will be run on the server and which one in client?
The Component is a ScriptComponent within the PlayerController

    [RplRpc(RplChannel.Reliable, RplRcver.Owner)]
    void RPC_DoSetUnitsNearby(int friendly, int enemy)
    {
        Print("SetUnitsNearby: " + friendly + " " + enemy);
    }
    
    void SetUnitsNearby(int friendly, int enemy)
    {
        Print("RPC SetUnitsNearby");
        Rpc(RPC_DoSetUnitsNearby, friendly, enemy);
    }
hardy silo
wild glade
minor agate
#

But given that it is PlayerController, you can expect RPC_DoSetUnitsNearby to be client that owns the PlayerController

#

Unless the client is also the server, like in WB playmode

west prism
#

"Does anyone know how to fix the ShopSystem Wallet? I can sell items without having a wallet.
and the money is simply gone."

wraith pagoda
#

@torn bane hey dude - sorry to disturb you again - I noticed you're the owner of EDF on github - and I can see that MySql is planned to be implemented in the mod.
Is there any intention to make database connectivity native in Arma4 so it's not a mod?

west prism
#

so before u can sell it check if u have a wallet

#

i think i got it

torn bane
# wraith pagoda <@181864632216977408> hey dude - sorry to disturb you again - I noticed you're t...

MySQL is something i will probably not be doing, though i will provide an example for relation database structs for the upcoming vanilla persistence system. document databases will be the better choice, also for A4. No we will very most likely NOT include any native database driver within the games and or servers executable, not even sqlite. Maintaining them across diffient distributions for linux is too much of a pain to justify and we would need to expose the countless options into script or else somone will complain that xxx flag operation is missing from the driver options.

Instead, a standardized http based data protocol is in my draft box right now with maybe some out of the box implementation for couchdb - as we use that ourselves at the company and it comes with a http api out of the box without the need for any middleware to translate request into query with connector and back.

We have improvements to the script exposed rest api client on our todo list as well. In Reforger we will try out this new built in persistence system and see how it integrates with community needs and adjust based on feedback. We will then very likely just port it to our shared projects to be used by Arma 4 and other future BI games that could benefit from such feature.

ocean kernel
#

Not having native database drivers is a good choice

#

Would love to see what you guys come up with for the http request model

wraith pagoda
west prism
#

need help with wallet check by sell items

bool PlayerHasWallet()
{
SCR_PlayerController playerController = SCR_PlayerController.Cast(GetGame().GetPlayerController());
if (!playerController) return false;

IEntity player = playerController.GetMainEntity();
if (!player) return false;

SCR_InventoryStorageManagerComponent inv = SCR_InventoryStorageManagerComponent.Cast(player.FindComponent(SCR_InventoryStorageManagerComponent));
if (!inv) return false;

array<IEntity> items = {};
SCR_PrefabNamePredicate predicate = new SCR_PrefabNamePredicate();
predicate.prefabName = ""; // получаем всё

inv.FindItems(items, predicate, EStoragePurpose.PURPOSE_ANY);

foreach (IEntity item : items)
{
    string name = item.GetPrefabData().GetPrefabName();
    Print("DEBUG: Inventory item found: " + name); // Отладка
    if (name.Contains("Wallet_era"))
        return true;
}
return false;

}

#

when i sell item and has wallet is still says i have no wallet on me

torn bane
west prism
#

omg i think i got it to work i try now on server

#

now it works fine in enfusion tools

#

need to publish

#

GPTChat nevergiveup 😛

#

got it to work

west prism
ocean kernel
#

How would I go about determining the rank of all the items the player is wearing, so that I can determine the highest rank item in their equipment?

red inlet
#

Hey I want to overwrite enum EEditableEntityLabel to add a new vehicle type label for a water vehicle arsenal. I tried duplicating the EEditableEntityLabel.c but it remains read-only. How would I write a script to overwrite the enum otherwise?

#

I was thinking I could just add it to the end of the vehicle types list as it only goes from 51-55

#

VEHICLE_CAR = 50,
VEHICLE_HELICOPTER = 51,
VEHICLE_AIRPLANE = 52,
VEHICLE_APC = 53,
VEHICLE_TRUCK = 54,
VEHICLE_TURRET = 55,

inland bronze
#

Is there a way to prevent items from being put in a storage, and can only be taken from the storage?

high hawk
#

CanstoreItem

#

I can't remember, just search canstore

inland bronze
#

Hm, I guess I need to be more specific. That works, yes, but not how I'm intending. Really need it to just not accept any player deposited items, but any deposited by script is fine

Don't know if there's a simpler way than going through the process of setting something in a component on the deposited item to allow it

red cedar
inland bronze
vernal moat
#
typedef func Log;
typedef func LogWorkbench;

void Log(string log, LogLevel level = LogLevel.NORMAL)
{
    Print("----- KOTH: " + log, level);
}

void Log(int log, LogLevel level = LogLevel.NORMAL)
{
    Print("----- KOTH: " + log, level);
}

void Log(Managed log, LogLevel level = LogLevel.NORMAL)
{
    Print("----- KOTH: " + log, level);
}

void LogWorkbench(string log, LogLevel level = LogLevel.NORMAL)
{
    #ifdef WORKBENCH
    Print("----- KOTH (Workbench): " + log, level);
    #endif
}

void LogWorkbench(int log, LogLevel level = LogLevel.NORMAL)
{
    #ifdef WORKBENCH
    Print("----- KOTH (Workbench): " + log, level);
    #endif
}

void LogWorkbench(Managed log, LogLevel level = LogLevel.NORMAL)
{
    #ifdef WORKBENCH
    Print("----- KOTH (Workbench): " + log, level);
    #endif
}```
wondering if there is a way to add current class / method / line to this ? like `__CLASS__`
red inlet
#

I created a new script and copied and pasted the original enum with the new label
VEHICLE_SHIP = 56,

#

No errors but its not appearing in the drop down when i go to the Authored Labels in EditableVehicleComponent

#

NOTE: I tried defining the enum as modded at first but got weird errors that i didnt know how to fix

high hawk
red inlet
#

no kidding?

#

ok ill try that thanks

inland bronze
# red inlet ok ill try that thanks

also, when modding an enum class, it's usually best practice to just do VEHICLE_SHIP, instead of assigning it a integer (unless you just absolutely need it to be 56 for some reason). It'll auto allocate it's number and allows for compatibility with other mods that also mod the same enum class.

Because if two enums are assigned 56 from two different mods, it'll cause incompatibility issues for said mods

timid citrus
#

How to enable player movement while a menu is open?

timid citrus
#

I got it. Use SciptedWidgetComponent

minor agate
#

For types, you need to get an instance of something, get the type then ToString()

inland bronze
#

Running into an odd issue...
I'm loading a config from the profile folder to a BaseContainer, then creating a instance from the container, and all loads fine most of the time (except there's always an error stating this, whether it loads fine or not):

 RESOURCES (E): Wrong GUID/name for resource @"{0000000000000000}$profile:/CentralEconomy/CE_ItemData.conf" in property "m_sDb"

But besides that error, noticing an issue where, at random seemingly, it'll not load the config from the profile folder, and instead load a config I use as reference from my mod's internal config folder..?
Here's my code for loading it:

if (Replication.IsServer()) // only create the config or load config if you're the server
{
    string m_sDb = string.Format("%1/%2", DB_DIR, DB_NAME_CONF);

    if (!FileIO.FileExists(m_sDb))
    {
        CreateConfig();
    }
    else
    {
        Resource holder = BaseContainerTools.LoadContainer(m_sDb);
        
        m_ItemDataConfig = CE_ItemDataConfig.Cast(BaseContainerTools.CreateInstanceFromContainer(holder.GetResource().ToBaseContainer()));
    }
}
#

I'm just not sure how it's getting the idea to pull from the config in my mod's internal config folder? A config that isn't even named the same

minor agate
#

The path has nothing to do if the respurce is registered (meta file generated)

#

Engine prefers to use the guids

#

Also

#

Dont do stuff in profiles

#

Profiles folder on itself is also another addon/mod

#

Game directory is treated as its own addon/mod as well

inland bronze
# minor agate Because thr guid might match

They don't, seemingly. The correct one I need isn't even registered (as that's why I'm getting the error in console), so it has no GUID. And the other one is registered and can guarantee it's GUID isn't 00000000000

minor agate
#

Any override you place there, will take effect like a nornal mod

minor agate
#

On which it obly cares about the path without your project dir

#

If you load it with local path, the the one that loaded last will take over

#

On which if no dependencies are set, can be random

#

If you want to avoid issues, register them

minor agate
#

Dont do a guid of 0, that is still technicslly valid

#

Just ignore the {GUID}

#

Also if you are using $filesysten then thr guid makes no sense

inland bronze
# minor agate Dont do stuff in profiles

the goal with the mod was to allow config adjustments without the need to override in a mod, which only seemed possible with creating the config file in a external folder (like profiles) and then pulling it from it. How would you recommend otherwise?

minor agate
#

Guid is for resource database resolution, which should not be used with exact paths

inland bronze
# minor agate Ehat are you feeding here in the file path?
protected const string     DB_DIR                     = "$profile:/CentralEconomy";        // directory name in the server profile folder
protected const string     DB_NAME_CONF             = "CE_ItemData.conf";                // config file name in the server profile folder
string m_sDb = string.Format("%1/%2", DB_DIR, DB_NAME_CONF);
``` m_sDb being the  container
#

so no GUID is even present in the pathing

#

And why I chose config over JSON? Config is easier to adjust and understand when loaded into workbench, and less likely to error when adjusting

minor agate
#

Dont use json except for when dealing with restapis and need to generate a file for them

#

Or for external services

#

I will go to pc and check your stuff later. Rn on phone and hard to focus rn

inland bronze
#

All good! I appreciate it peepoLove

minor agate
#

Very easily to clash with others, or even us in the future

west prism
#

"I need to know how to find which part of the car each collider belongs to."
which file of car i need to open? i cant find Engine

west prism
slate raft
#

What exactly is WorkshopApi.GetInGameScenario and why might it return null for workshop downloaded scenario? I'm trying once again to get my scenario save/load to work (for third time).

wild glade
#

Hi, is there a function or method to tell if a Character is unconscious (server-side)?

slate raft
#

Am I supposed to be able to debug the actual game with this? I have never gotten it to connect.

torn bane
craggy jolt
#

@torn bane Couldn't find an answer, are systems planned to be made available in WE Edit Mode world too?

#

Having to host logic that should be in a system in a gamemode component right now so its accessible and debuggable during edit mode

craggy jolt
#

What a bad decision

pliant ingot
#

😭

craggy jolt
#

Can't easily use components as singletons => Use systems
Can't use systems during edit mode => RIP

#

Might as well abandon systems all together then

#

And just do everything in components

ocean kernel
#

Just make a static manager of some kind, then you control when it is instantiated and when it isnt

#

If you rely too much on vanilla things you will suffer

craggy jolt
#

Yeah, ended up doing that, pretty annoying having to check if components are trying to call static methods from another world each time

#

Was also thinking about BaseWorld->Manager maps so static method redirects to proper component in that world

sleek moat
#

does anyone know if you can specify a custom / dynamic EDF_DbName in the persistence framework?

Everything I've seen is just running [EDF_DbName.Automatic()] which I think uses entity type, but I'm wanting to have them named as specific strings applied at run time

ocean kernel
#

It's probably a bit more complicated if your manager actually requires the world for something

#

Mine doesnt so I can just spawn it from inside the game mode entity if it doesnt exist and it's fine

craggy jolt
#

Yeah, map could be useful if you really need that manager in another world, not my case so far

#

Still, very bad idea to not allow systems in Edit Mode world, the world has everything except simulation, no reason it can't have non-simulated systems in it

#

Make systems have _WB methods similar to entities and components so they can be initialized and debugged during edit mode

#

Anyway, guess I'll just do it all in components

slate raft
west prism
red inlet
#

okay when i use this code
modded enum EEditableEntityLabel
{
VEHICLE_SHIP
};

it says scripts/Game/Editor/Enums/SHD_EEditableEntityLabel.c(1): error: Unknown type 'EEditableEntityLabel'

slate raft
#

Why does MissionHeader.ReadMissionHeader return null for valid mod mission header? Think it is what is blocking my scenario from being able to continue sessions.

#

omg its because mods are not loaded in main menu.

#

Is that an oversight? I can't be the only one who has ever tried to get save/load working locally.

red inlet
#

i feel like 1 line of code is kicking my ass way harder than it should

slate raft
#

devs plz 😭

minor agate
#

WE stuff should stay within the WE update loop, which is different than those intended for game

#

WE should be tooling only

#

Workbench stuff should always be kept separate from game stuff

craggy jolt
#

You can't debug the system without running it then? Do you just make a copy of a system as say component to say simulate how system gets setup when its gonna be run for real?

minor agate
#

Both sides work differently as well, so they are not nicely interfaced by a single way

minor agate
#

You can debug it, just run the game and connect the debugger to it

#

Or what do you mean?

#

It's not advisable to try to setup a test of this kind on Workbench Edit Mode

#

It works very differently than the normal game, it is not the same by any means

#

For quick testing, use MPWorld or a very minimalistic world

#

That way you do not have to wait minutes for even being able to test

#

For example for Campaign, we test on Campaign world. not on arland or so during dev

craggy jolt
#

I get that, the issue that its very inconvenient that you can't test system setup and initialization outside of play mode

minor agate
#

Do you want to test for misconfiguration?

craggy jolt
#

In my case I have components all over the map, I have areas designated on the map, my system will go through all components and configure them depending on components nearby, which areas they're in, put it all into gridmaps etc. But since there is no system in WE Edit mode I can't see how this initial configuration will work out, write the tooling to prepare my components and areas better, make system run through initial configuration again on changes, etc. I have to go into Play Move, do start menus, toggle diag menu bool (if it wasn't), go into Game Master, fly all over the map to see how it all works, etc. Then go back into Edit mode to adjust something and repeat it all again.

#

I don't want system simulated and doing frame events or anything like that, I want an instanace of it in edit mode, so world entities and components can call it and do the same inital data processing that system will do in play mode

minor agate
craggy jolt
#

If there is a better way to do this, let me know. So far it all points to just not use the systems and use manager entity/component as it works in both edit and play modes

#

And copy paste code from the system there?

minor agate
craggy jolt
#

Split that logic elsewhere and have both WB Plugin and System call it? Might as well just have it in a manager that's already available everywhere.

#

Well, I don't hope you guys will change your minds on systems, I'm just sharing that I think its wrong.

minor agate
#

It's just not how it works or was designed

#

WB should not behave like the game

craggy jolt
#

Systems can init on and operate world entities and components and it makes no sense to me why edit world with entities and components doesn't have a system that can at least init

minor agate
#

YOu have the game for that

#

If you want to test game stuff on game env, then do it there

#

If you want to setup things, do it in WB. If you want to test setups, do it in WB.

#

Game systems should not run in WB

#

As workbench is just a tool to build the game, and should be external and not tied to the game

#

That is why on our side, you also do not see us making this sort of interface.

#

If you want to test configurations, then we do plugins. Which run the neccesary sanity checks.

#

There is also the thing with workbench on that you should never deal with IEntity instances

#

That is just wrong, which makes the systems, component, entity thing not valid

#

In WB you use EntitySources and ComponentData

#

It's why I also mentioned this on the first or second modding bootcamp

#

As it;s common mistake

#

I showed an example of why not as well

craggy jolt
#

I get the design philosophy of it, but not having the system at least initialize (call constructor, OnInit) is going against it if you ask me

minor agate
#

There is no ECS in WB

craggy jolt
#

Imagine if you said no components can't be initialized in Edit Mode, run Play Mode for that, the best we can do is display a mesh from MeshObject for your entities.

minor agate
#

If you really want this, easiest way is to create a test world

#

And a plugin that auto runs it with the tests

#

If you are really dependant on the systems that is (Because or linkage or many other things)

#

So, you do not want the systems running. Just initialized in WB?

#

(Asking as if it makes sense to the design then it might be well to request it)

craggy jolt
#

Yes, I excepted it to run initialization in the same way as entities and components do

#

To be honest I'd be fine with a manager entity/component if not for unreliable initialization order

minor agate
#

Should do what you want

craggy jolt
#

WB restarted and such, no change

#

Only single usage in AnimateWidgetSystem, does it even work at all in our version of Enfusion?

minor agate
#

So treat it as obsolete i guess

#

From a enf dev related to this

Entities and components exist in the world. Systems do not. They are just meant to do the game simulation, and there isn't one in edit mode.

#

There are some plans for visualizations and testing based on what systems are setup. But that is probably too far in the game for AR

craggy jolt
#

Very inconvenient that you can't see how system initialization will behave in Edit Mode the same way as you can test initialization for entities and components

minor agate
#

It's just not there for AR

#

Same as with world controllers or the rest of world system

#

AR version is quite outdated for this

craggy jolt
#

Thanks for checking it out for me!

minor agate
# craggy jolt Thanks for checking it out for me!

Btw I might sound a bit negative about it, but I am just trying to make sure you understand that it is not a thing supported right now and why. But the idea of checking these connections and setups are valid. Just not in the way of running the systems as that implies there is game simulation in WE.

#

But the data is there, if it's there then it makes sense to be able to peek automatically. It's something that has been asked about internally as well so it is not so much of a corner case

craggy jolt
#

Glad I could express my point and maybe even influence it a little bit

inland bronze
# minor agate I will go to pc and check your stuff later. Rn on phone and hard to focus rn

~~Did you ever get a chance to peak at it? Here’s the GitHub link to the script handling the config loading https://github.com/CashewSan/Central-Economy/blob/daily-backups/source/Scripts/Game/CentralEconomy/GameMode/CE_WorldValidationComponent.c

Oddly, I seemed to notice a pattern earlier with it that it somehow uses the wrong config if my spawner entities are a child in a building prefab. One’s that are alone (only in the case of testing) seem to be fine. It’s as if the incorrect config is cached somewhere? But the only way to pull the universal config is directly through the component I sent the script for, so I’m entirely unsure. I’ll have to comb through it some more. Registering the config in the profile folder makes no difference, nor does directly assigning the config through an attribute~~

solved it, was due to a static variable that shouldn't have been static

GitHub

Central Economy, created for Bohemia Interactive's game "Arma Reforger", allows for dynamic spawning of items around the map with a master config file - CashewSan/Central-Economy

#

Was additionally thinking that maybe it could be a client vs server issue, as client is never set to pull the config. But even testing just as server localhost (no peers), the issue persisted

red inlet
#

error: Can't inherit class 'EEditableEntityLabel'

solid hearth
#

Can I get some info on this 9f768299-3838-4ce1-ab06-b661573d7adb curious how bad I screwed that one up shypeepo

solid hearth
solid hearth
#

worryHeh trying to fake it till I make it.. LightEntity is too limited so i'm trying to recreate it but hit a wall with how I should go about doing the projection

ocean kernel
#

Give up

#

Not saying this because I want to discourage you, but decals until the next engine update are kind of bad for projecting them on things that arent terrain

#

I mean I hope, I don't actually know

fervent cedar
#

maybe in arma reforger 2

ocean kernel
#

Anyways what are you tryna do in the first place?

solid hearth
#

Make a IR laser beam of course. I already use LightEntity for it but LightEntity sucks ass. I guess I can just go with option B which is spawn a little glowing ball lol

ocean kernel
#

the way I did it for giggles was drawing a mesh between the gun and the traced hit position

#

you can't use light for IR because then AI spots you

solid hearth
#

Well currently all my light sources are not done like how people normally use them, they're actually spawned locally for each client but what i'm doing right now is locally spawning in a small mesh, stretching it to the end of the trace and now I need to fill in the final gap which is the end projection. Decals seems to be going horribly wrong and I guess if I have to I'll just spawn a secondary mesh and put it at the end.

ocean kernel
#

I was able to draw like a 1 km long beam but collision detection is wonky

solid hearth
#

Or I guess I could put it into the current one..

ocean kernel
#

that means your mod is... multiplayer only? since in singleplayer they'd spot you

solid hearth
#

Suppose so but I never put single player in mind

ocean kernel
solid hearth
#

I'm a multi-player only person 😁

#

But with the new one it'd work.. since its just a mesh with a tiny emissive source or well the one i'm trying to work on.

ocean kernel
#

That sounds fair. Lights are cursed as well, they go through certain objects.

solid hearth
#

Yeah, that and they're limited to 100m so that's why I'm trying to break away from the lightentity whenever possible. The only thing that wouldn't work in SP I guess is the illuminator part but oh well, not my prio.

ocean kernel
#

If you draw/scale a mesh for the beam then AI dont care but it'll look quite weird on the receiving end

#

I think that's how arma 3 did IR lazors

ocean kernel
solid hearth
#

Ended up just attaching a small ball at the end, it'll have to do for now 😔

inland bronze
#

Since there's not multiple instances of a gamesystem class in the world at a time, if I called a method in the system from multiple components at the same time, would they overwrite each other?

fringe prairie
#

Obviously duplicate logic probably can just get handled by system and the methods simply give updates to the components

fervent cedar
high hawk
inland bronze
#

That's probably the issue I'm running into, it makes sense why it would be I think at least, but I guess testing is needed to prove it

fringe prairie
#

So yeah if you are returning data others might manipulate first, that would be one reason

#

but each call of the function is a unique instance, there shouldn't be any time where it's shared if that makes sense, the runs are sequential but order is not easily known in this situation

inland bronze
#

yeah, from testing, it actually doesn't seem to be the issue. So now I'm even more confused thonk My configs, that are separate instances of the same config class, are somehow getting mixed up in initialization sometimes and I can't figure out where or why

inland bronze
#

Solved it, I think. I had, at some point, set a variable in my custom class to static and didn't revert meowfacepalm Seems to work now

candid garnet
#

curious to why the design decision was made to make notifications function off of defined configs instead of displaying a passed string

ocean kernel
wild glade
#

Does someone have an idea on how AnimateWidget.Value works? I can't get it to work properly

inland bronze
#

@torn bane Got a, hopefully, quick question: with EPF, how could I go about preventing a persistent entity from spawning if a variable is set within it's component save data class in the database?

I assume I would need to override EPF_PersistenceManager::SpawnWorldEntity() and get the component save data through the entity save data, but I also assume it wouldn't be as easy as returning null if it's set and then all is well 😅

torn bane
inland bronze
#

Gotcha, will give it another look when I wake up. For now, it is bedge

I appreciate the quick response!

wild glade
# wild glade Does someone have an idea on how `AnimateWidget.Value` works? I can't get it to ...

For anyone having the same question, I got it working by creating a new Animation class (in my case for a progress bar):

// Copied mostly from WidgetAnimationValue
class WidgetAnimationValueProgressBarCurrent : WidgetAnimationBase
{
    protected float m_fValueDefault;
    protected float m_fValueTarget;
    protected float m_fValueCurrent;
    protected ProgressBarWidget m_pProgressBar;
    
    protected override void ReverseDirection()
    {
        float f = m_fValueDefault;
        m_fValueDefault = m_fValueTarget;
        m_fValueTarget = f;
    }

    // Changing this part to the needs (setting current value in ProgressBar in my case)
    protected override void Animate(bool finished)
    {
        m_fValueCurrent = Math.Lerp(m_fValueDefault, m_fValueTarget, m_fValue);
        if(m_pProgressBar)
        {
            m_pProgressBar.SetCurrent(m_fValueCurrent);
        }
    }
    
    void WidgetAnimationValueProgressBarCurrent(Widget w, float speed, float targetValue, float defaultValue)
    {
        m_fValueTarget = targetValue;
        m_fValueDefault = defaultValue;
        m_pProgressBar = ProgressBarWidget.Cast(w.FindAnyWidget("LiberateUnitProgressBar"));
    }
};
// Usage

WidgetAnimationValueProgressBarCurrent animCurr = new WidgetAnimationValueProgressBarCurrent(m_widget, 2, friendly, m_progressBar.GetCurrent());
        AnimateWidget.GetInstance().AddAnimation(animCurr);
frank matrix
#

Hi,

I have the following plan:

We would like to have a live map of the players where you can see how the players are doing and, in addition, a replay function so that you can better understand whether it was an intentional TK or an accident. We also want to use this for our group reward system.

Since I don't want to send the position data of 128 players to an API, I want the client to do that. The idea is to have the client load the current pos. data into an array every second, for example, and send it to the API after 10 seconds. (The API backend is not a problem (I can also validate whether the player is actually currently on the server). Do you have any tips? I have now created a script component for the player manager.
Do you have any tips?

dark ocean
# frank matrix Hi, I have the following plan: We would like to have a live map of the player...

my tip would be to do it on the server side, not on the client, which is a very, very bad idea

  1. it is a security risk (how do you know the request really comes from player X)?
  2. you expose yourself to a DDoS
  3. cheaters will just disable or fake this
  4. BI has stated in the past the API client in future will be server-only
  5. single request from your server carrying 128 data points is much less overhead for your backend
wild glade
#

Does anyone know an example or implementation of polygons/shapes on a map? In my case: I want to draw a circle (showing an Area of Operations) on the map

little anchor
#

Hi, when I try to retrieve the uid of the player in an interaction on workbench it works but when I try on a server it doesn't work, do you have any explanations, to retrieve the UID I use this : GetGame().GetBackendApi().GetPlayerIdentityId(playerId);

solid hearth
# frank matrix Hi, I have the following plan: We would like to have a live map of the player...

Well biggest flaw in that is letting the client have access to the api but excluding that pretty sure only the server can utilize the REST system so... yeah.. There's a few ways to approach this and one alternative that comes to mind is having a schedular on the server and a system on the client. The clients system will collectively record whatever data you want and the scheduler will periodically go through players and request the stored data from them, the client will respond and then empty their result to start collecting new while the server sends off what it received.

#

But honestly having the server do all of that isn't a big deal, its already actively collecting that type of information anyways look into the stat system there's a module specifically about calculating travel distance you can modify that to achieve what you want.

solid hearth
little anchor
solid hearth
#

Depending on how the action is setup its either running on the client, running on the server or running on all (client(s) + server).
These two methods determine who executes the action. If you want the client to know the UID the server will have to retrieve it on the actions execution and then through some method Rpc it to the client with the UID so yes some sort of component or add an rpc to the playercontroller. (The following below is the default setup for an action unless overriden)

//! Does this action only have client side effect?
event bool HasLocalEffectOnlyScript() { return false; };
//! If HasLocalEffectOnly() is false this method tells if the server is supposed to broadcast this action to clients.
event bool CanBroadcastScript() { return true; };
little anchor
#

I understand, but how do you configure the actions?

solid hearth
#

By overriding those methods in your custom action and returning either true or false. (Waking up a bit more) seems the default config is already set to run on the server and client that executed it so you just need to check if server -> Get player id from User -> Get UID -> Send that to player that executed

solid hearth
# little anchor I understand, but how do you configure the actions?

Crude example that should work...? By no means should you cram a bunch of rpcs into the player controller, this is just an example of a very specific use case of server->client. Ideally you would have a component attached to the CharacterBase and use that for more complicated things.

class TAG_MyCustomAction : ScriptedUserAction
{
    override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
    {
        // crude potentially unneeded safety but brain isn't fully woken up yet
        if (!Replication.IsServer())
            return;
        
        PlayerManager manager = GetGame().GetPlayerManager();
        int playerId = manager.GetPlayerIdFromControlledEntity(pUserEntity);
        SCR_PlayerController playerController = SCR_PlayerController.Cast(manager.GetPlayerController(playerId));
        
        BackendApi api = GetGame().GetBackendApi();
        if (!api)
            return;
        
        string uid = api.GetPlayerIdentityId(playerId);
        playerController.TAG_SendPlayerUID(uid);
    }
    
    override bool CanBroadcastScript() { return false; }
}

modded class SCR_PlayerController
{
    void TAG_SendPlayerUID(string id)
    {
        // Only the server should be using this method
        if (!Replication.IsServer())
            return;
        
        Rpc(TAG_RPC_ReceivedPlayerUID, id);
    }
    
    [RplRpc(RplChannel.Reliable, RplRcver.Owner)]
    protected void TAG_RPC_ReceivedPlayerUID(string id)
    {
        // do what you need to do
    }
}
wild glade
#

Is there a way to tell when an AIGroup goes "idle"?

ocean kernel
#

Define idle? You might be fine with combat state for example, or maybe you need to know if they are just doing nothing? Not even moving to waypoint

wild glade
ocean kernel
#

I got you standby

#

HM actually group has only threat measure. Maybe you could loop over all group members and fetch current threat state from the AI Info Component

summer quail
#

Is there a way to make it so the in game kill count, counts killing ai instead of player kills?

spark otter
#

There is something like has target, but I won't be able to share my code until after work tonight.

solid hearth
#

😔 You were right bacon, I give up on the custom light beam idea entirely. I got it to a point where it worked really well but unfortunately the performance impact is too high of a cost. I got the decal to work somewhat well but the only way to ensure it is with aggressive trace flags and layer masking otherwise the trace will sometimes slip through. I was happy till I seen my fps and went hmm.. that's a solid 60+ drop and i'm on a machine most don't have so yeah.. multiple sources maxyikes Back to the crappy lightentity I go sadgegun

sleek moat
#

@torn bane sorry for the ping, can I ask what dictates the file name of the save data jsons in EPF/EDF?

I'm wanting to hijack it and have a custom naming convention for specific data if that's possible

torn bane
sleek moat
#

ahh I did see that, instead of running "AUTO_GENERATE" is it as simple as calling EDF_DbName("customString")?

torn bane
#

yup

sleek moat
# torn bane yup

and that can be called in the save data dynamically in a function rather than above the class with [EDF_DbName(customString)]?

Basically wanting to have all the jsons in the folder name to 1/2/3 for example

torn bane
#

Forget nested folder structures, they will not be supported in the new vanilla persistence. one folder per collection type maximum.

solid hearth
#

new vanilla persistence ammmyea

torn bane
#

Example

solid hearth
#

coolDigiDisappointed flashbang warning

sleek moat
torn bane
#

But I would recommend against any random names etc, as the code performs best when it knows deterministic names/ids and only the data inside contains randomization.

#

My code is opinionated to guide you to good decisions. if something is not possible out of the box or documented as feature then i probably had a reason against it. my two mods support every useless operation under the sun, much more than they realistically had needed

sleek moat
#

ah so if type is myData, then set that name to what i want

sleek moat
torn bane
#

better idea, you can use the players id for multiple things. there can be a entry for typename "garage" and "character" with the same id, that way you know both belongs to the player. alternatively you store data on a meta struct per player and that knows character id, garage id etc and you fetch that first and then continue

#

a structure of ".db/players/ID/vehicles/vehicleid" is not gonna work out

sleek moat
#

that's kinda what I looked at too, but I couldn't work out how to set the "garage" typename to match the playerID

torn bane
#

you name a garage save data class, automatic naming, then you manually call SetId(playerUID) on the persistence component or scripted state that holds the data

sleek moat
#

i did try that but I think i did it within the save data class for some reason meowfacepalm guessing it will work if I call that from a normal class...

sleek moat
sonic burrow
#

i have a question, would it be possible to make a gamemaster mode where you can lock a specific faction? if so, any pointers?

sweet badger
sonic burrow
#

i mean lock the faction so you need to be whitelisted into it

#

i.e you have a FIA Faction, civ faction and US Faction. both FIA and US are whitelisted

ocean kernel
#

No nested folder structures sounds more like a bug. People will pay heavy cost for listing files in those folders if they need or want to and the number of files accumulates. Not sure what the benefits of not having it nested are.

#

It can already be reproduced easily with the playersave folder which is never cleaned up!!!! and just hosts hundreds of thousands of files minimum for busy servers

#

God forbid you are using network storage, even fast network storage

slate raft
#

Can probably also filter them from UI. Maybe SCR_FactionRequestUIComponent.ShowAvailableFactions.

torn bane
torn bane
# ocean kernel No nested folder structures sounds more like a bug. People will pay heavy cost f...

Access starts by known keys and expands by joining other ids. No blind query into all available data. The system works for console clients too who do not support nested folders. The platforms save data is much simpler. One container, with many blobs inside. That there is one layer of folders is a quality of life we added for windows server administration that already required us to do a lot of hacks.

In theory you can create sub sub folders but they will not give you any speed advantages. Under the hood it is all flattened out into a singular list of blobs.

Usage of the system with files is meant for small setups, running vanilla gamemodes. Anyone wanting to store plenty of data across a single playthrough will want to connect it to e.g. couchdb

#

And if you dislike this then you are free to implement your own scripted serializer and storage in what ever format you want, relying on the normal file IO operations. This then of course will not work for console. But those can't host games anyway, so probably not your use case

torn bane
slow acorn
ocean kernel
humble saffron
#

Is there an easy/quick way to enable/disable specific Prefabs, in SlotManager, using scripts?
For my intention is, for storyline and roleplay purposes, to create a custom action for the driver that once clicked, would "switch" one Prefab for another.
In Arma3 I used to do that A LOT, whether using "hideObjectGlobal" true/false , or just deleting using "isKindOf / typeOf x" and then immediately creating the new ones to be shown.

But I am completely lost regarding where to start to pursue similar results here in Reforger. I have performed several searches in Workbench, using "Jump to script definition", but got no clue at all. 🤦‍♂️

#

.
.
EDIT: I mean that checkbox in the picture, found within all slotManager's Prefabs. Either that or even creating/deleting a whole new slot using scripts, maybe.... 😬 🤔

neon elbow
#

Are you trying to swap out one entity for another or are you trying to hide the entity from players?

thick arch
#

Is there any significant difference between using RplProp with a .bumpme to update values or using RplLoad/RplSave with a broadcast method to update values?

#

Like, is one more efficient, or should only be used in certain circumstances?

neon elbow
#

sorry I just reread what you asked.

inland bronze
humble saffron
neon elbow
#

This one is kind of tough. If you hover over one of the slots you'll find that it is an EntitySlotInfo class. Inside you'll find the IsEnabled variable, which I assume you can toggle on and off with a user action. But getting to it is something that I'm having trouble planning.

wild glade
#

What exactly do these attributes do on SCR_ResourceComponent -> SCR_ResourceContainer?
Like what are the units here, or is it Resource Gain per Tickrate?

wild glade