#arma3_scripting
1 messages Β· Page 186 of 1
Right will check that now then to make sure.
Instead of hard coding 22, you can also:
private _doorNumber = getNumber (configFile >> "CfgVehicles" >> typeOf _building >> "numberOfDoors");
_MaxDoorsInHouse = 22; //<----------------------- Maximal number of doors in da house - current 22 doors - CAN CHANGE!!!!
```I just used Open Door Module approach, I guess `numberOfDoors` wasn't a thing back then
The most proper way would be finding exact animation names you want to use and just iterating through that
but brute forcing 1 to 22 isn't a big deal either
Worked with server only ticked. Again thank you so much for the help.
Btw make sure another connected player can open/close door with "server only" tick, not just by running the mission as player hosted server
Right, will do
Worked as well.
Minor note, is there a way to get rid of the "Open Door" option on the door it self?
IIRC you can disable simulation on the building, but then that would probably interfere with your direct open/close.
You can disable simulation on the building, enable it just for your open/close, and then disable immediately after the animation plays.
Yo guys is there any script to make a bomb fall precisely on a building , i have drongos mod but the plane drops the bomb in a dumb way not accurately, like GPS
but physical plane needs to be involved
Maybe with Zeus enhanced ? I know You can place module that spawn a plane and it drop the projectile where you want it to be of course you want it to be scripted but maybe you can find what you want in the code ?
Group was the first thing I checked, it's only in the unit. The weird part is the error message changes.
But good call about the tags, might be some conflict. I'll try that later today. Thanks!
You can try correcting bomb's course if its close but not quite
Also depending on a bomb you can spawn target and setMissileTarget the bomb to it
so lets say I have a mod that drops a specific bomb from a plane on command, how can i integrate and set the target
Maybe it can work without valid target, there is alt syntax with force now
Basically, try setting you missile target to your target building after you fire it
okay so do i have ti modify thr mods funcs
it lets me select a bomb and target, and then drops it, but it drops it in a dumb wsy
so i have to make it like set missile target within the mods funcs
I want to do it as UAV controller/jtac
How do you drop it right now? Some kind of own script?
I have FIR AWS mod and Drongos air Operations
I can command the plane to bomb somewhere and then if its LGB i can lase with UAV
No idea about these mods
I just want to know what you do script wise in your mission
But if its GPS, the mods dont knoe how to put thr GPS target on the pylon
I hsve no scripts atm i use mods completely for this
I was trying to set te GPS data by script on thr pylon beforr bombing but im not able to decipher this mods functions
As a test concept, try putting needed setup in editor and add Fired event handler to the plane
And see if this command actually fixes it for you
You see ?
This UI only works for the plane locally
I m not able to set another planes pylons and targets
(Singleplayer)
No idea about these mods, never used them to tell
Can i specify it for a specific bomb ?
Sure, you get all kind of info in Fired event handler
so i can say if drongos air op mod brings this jet and makes him drop X bomb he needs to setmissile target that i set with the mod
You'll need to see how that mod sets the target to get it in Fired
and then I can bypass the mods GPS guidance and the bomb will go there
No idea if you can, maybe it does some manual guidance magic and it will ignore missile target
Wrll it would just be easier if we can set GPS data for the bomb
Then all we do is drop it
Thing is, guided projectiles can be manually assigned a target through script nowadays and you can try using that
You'll need to figure out how these mods work to integrate into them
Can't help you with that
Yeah, i still wanna use the mods becus of their UIs
Would you be willing to help out for a fee? I will compensate
Okay nice
We have a GPS munition script for our mission you can look at and try to copy:
Configuration menu action: https://github.com/spooker0/warlordsredux.core/blob/main/scripts/DIS/fn_setupGPSMunition.sqf
GPS setup (to enter the numbers): https://github.com/spooker0/warlordsredux.core/blob/main/scripts/DIS/fn_setupGPSMenu.sqf
Actual guidance to target: https://github.com/spooker0/warlordsredux.core/blob/main/scripts/DIS/fn_gpsMunition.sqf
Do I need to set AI subskills individually or setskill 0 alone does the job?
Hey folks, I have a question and maybe you have already a way better / good way to handle it.
My problem is when I have a Yes/No question dialog (with BIS_fnc_guiMessage) that is called by an HoldAction, most of the times you trigger the default answer because you were holding the space bar a tiny bit to long.
I solve this right now by putting in a little 0.5 sleep. It feels somewhat unresponsive but it is the only way I know to handle this. Is there any better way to handle this?
Not really. It's because the button is set to default = 1
you can try to set the focus to a different control as soon as the UI is available but that might be too late already.
Alternatively you can try BIS_fnc_3DENShowMessage
Oh, thats cool. I didn't know this. Thanks, I will experiment with that.
setskill sets the sub skills to same value so no need for anything extra
@formal grail eow really ?
would it be better to have my code in missionfile or in an external addon?
as for execution speed
Yes
yes, missionfile?
That's what I think, but I was talking about it with ChatGTP and he was convinced, that doing it individually leads to different results, despite me telling him, that both skill and skillFinal return same values, regardless if set individually or not.
It seems to me that AI skill in this game can be all over the place. Like playing same mission multiple times, same settings, same everything. But sometimes balance feels just fine and other times AI is like wiping floor with me
but I was talking about it with ChatGTP
For Arma 3 / SQF stuff you're better off asking your dog or a random toddler, its 99% hallucination based on function names
Banana!
the last argument to say3D isn't working, _songObject = _vehicle say3D [_songName, 300, 1, 0, 0, false]; (last false) if I'm reading the docs right should disable doppler shifting yet it still happens, it's exactly the same as if that argument is true - what stupidity am I commiting here?
cake is nice
dont know what to say... but its not complicated setskill is all you need if you are in hurry
I don't think it controls doppler shifting, I think it's speed of sound over distance, e.g. if you're x km away from the source the sound takes y seconds to reach you
I shoved the config for AI into description.ext then when I spawn in zeus I apply a default AI profile (I can change it globally) to everything - that seems to make it consistent in that everything has the same AI profile applied (I split it into infantry/crew profiles as well)
mostly so I can very quickly switch the AI skills based on whether players are curb stomping them or getting flattened by them
also lets me have automatic profiles applied for infantry, units I've marked as "spec ops" (skills boost) - to the point where when players see a boat screaming towards a beach they scream "SPEC OPS" on the radios π
To me it seems like AI skill is inconsistent despite playing same mission, at same difficulty settings and same skill set by setSkill. Like sometimes they seem to be faster and more accurate than other times. Can mission maker change AI skill outside of setSkill?
in theory yes (mods can as well) - I have some AI stuff in my missions that is unrelated to setSkill (I did some sneaky stuff with the AI's awareness when doing CQB to fill in some gaps) - in reality you might just be "lucky" in how the AI is evaluating in one run vs another
I've seen similar things in zeused ops, sometimes four players can clear a town and take one uncon, the next town they can get utterly smashed vs the same amount of AI with the same profile - it's fog of war/luck I suspect
yeah I don't get this say3D thing at all either it's not applying the argument to the call or it's simply not doing the thing the way I'm reading the docs that it should
So it looks like it's not just my imagination, if other people have similar experience
in those cases since it's a mission I built and I'm in the zeus slot, I know that setSkill isn't been touched - it's purely down to small variations in how the AI is perceiving players (I use lambs, I've turned debug on and watched it's evaluation loop), like (with lambs at least), if a unit spots you, it'll "inform" other units within range (which is configurable) - so if you get spotted a little earlier you are gonna have a completely different fight π - I actually like that variance, the less predictable it is for a player the more fun it is
ahh, so it's latency between X and Y by distance, so if you are 330ms and audio event happens at X seconds then it arrives X+1 seconds later
AI skill is also affected by the server's AI skill setting in the server config. It interacts with mission-level skill, and is not overridden by it. It's probably not changing between replays on the same server, though.
damnit, then how do I disable the doppler shifting π₯Ή
it's far far too aggressive, the pitch shift is way out of whack, a car passing at 10m/s ish shouldn't shift the audio that much
this is what I'm getting at https://streamable.com/3lshbc (listen to the freq change as the vic moves towards/away from the player)
There should be some variance, otherwise things might be to predictable. But shouldn't difficulty itself stay more consistent? It's a bit weird to easily clear town one time and other time get utterly smashed
I've played a lot of Arma and I don't know what you're talking about tbh.
not really, it really does depend on small variance in the input conditions - (in a sense it's chaotic, in that a small change in the input has a massive change in the output - it's not strictly speaking chaotic since it's deterministic but perfect repeatability from a players inputs isn't ever going to happen)
AI effectiveness doesn't depend only on the AI's skill. It's heavily affected by the players' skill. If they get themselves into a bad situation, or just fail to make their shots count, then they will die.
The obvious difficult gradients in Arma are things like static weapon vs small arms accuracy.
I've seen plenty of missions turn south in seconds because 3 guys in a row decided to feed themselves to an HMG
pretty much, also lambs has it's own meta layer on top, suppression, the way it communicates to other units, enters its planning loop can all change because you went 2 meters further left and an AI had a line of sight at the start - it's brilliant in that respect
Shoot the guy with the HMG a second too late and your squad is dead. Run around like an idiot in front of a few riflemen, no problem.
I spent a lot of time tuning my missions so that the players have an average K:D of ~5 (+/- 1) because they/we play as mercs and dying costs them money, and killing the AI earns them money π I wanted it to be relatively neutral so that they have to be smart to make a profit
Fair, maybe it just wasn't my day...
I've not properly tested it, but apparently suppression has a pretty strong effect. So if you start shooting first then it makes a big difference to AI accuracy.
for lambs it π― does π
so does courage/fleeing
For that reason it's really important to cut LOS to any enemies that you're not shooting at.
Leave one guy to shoot at you for free and things go badly.
Another weird Arma thing is that AI accuracy is very strongly dependent on the weapon they're using.
yeah, that is all over the place
it's why makeSniper does some horrible things in my code π π
There's a general principle that sniper/marksman rifles get much lower dispersion, but that means in some modsets the "basic weapons" are 5+ times more accurate then in others.
G3s in 3CB Factions for example.
I just did this - https://pastebin.com/LQTjwYZg
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
lets me make the AI lay in a bush wearing a ghille, shoot accurate, never fires tracer, never throws smoke (as lambs love to do because no sniper is popping smoke from their OP) - I've had 5 players bogged down for 25 minutes trying to find the sniper π
Precision German Engineering
I don't think many modders actually realise that weapon dispersion directly affects AI accuracy.
you can fix it with the AI multipliers but they don't.
dispersion in CfgWeapons is all over the place between mods as well, RHS and CUPS often have completely different values for the same basic weapon π€·ββοΈ is what it is, mixing CUPS/RHS is always pain - you end up having to carefully tune ACE medical or you get terminator Russians with their body armour
I don't care how good they say it is, it shouldn't take 7-9 5.56 center mass to put them down, I tune for ~3 max because no one is taking 3 5.56 to the chest wearing a vest and shrugging that off
Cool simple code, gonna use that
hey man, I think I know you from the lib discord (small world), ```sqf
params ["_unit", "_defaultStance"];
if(!(_unit isKindOf "Man" && alive _unit)) exitWith {true};
_newGuard = _unit;
// Set to watchful but not combat;
(group _unit) setCombatMode "YELLOW";
// Clear any existing event handlers
_newGuard removeAllEventHandlers "AnimChanged";
_guardUnitPosture = "";
switch (_defaultStance) do
{
case "prone": { _guardUnitPosture = "DOWN"; };
case "crouch": { _guardUnitPosture = "MIDDLE"; };
case "stand": { _guardUnitPosture = "UP"; };
default { _guardUnitPosture = "UP"; };
};
// Stop them moving around
_newGuard disableAI "PATH";
// Make them lie down
_newGuard setUnitPos _guardUnitPosture;
_newGuard setBehaviour "SAFE";
// If they try to stand up/crouch, make them lay the fuck back down
_newGuard addEventHandler ["AnimStateChanged",
{
params ["_unit", "_anim"];
if (canStand _unit) then {
_unit setUnitPos _guardUnitPosture;
};
}];``` similar thing but makes them guards (just a quick way to make them stay in one spot, in one animation state and not move off) - handy for guard towers or where you want to stick a dude with a PKM somewhere and have him not move
yep, from there hahaha
that trick with that EH I know xD very useful indeed
I'll have nicked it from somewhere as well, - taking mods apart to see how they do what they do is like 80% of how I figured out how to do the things I wanted to do π
(rest was biki and the forum...if they ever fix it π )
man Drongo does good work, he's released a mod that does a far better version of the thing I was gonna build this week for our next op π - now I just need to integrate my stuff into it
Drongo does everything good
he does, my killer drones where lethal enough before he made it so I can make the AI organically deploy them - https://streamable.com/s0xk3e π
Hey there ^^
Does anybody know a way to get the units of the createVehicleCrew
Thats how Ive did:
_sascha_crew_fzg1_grp = _sascha_crew_fzg1 createVehicleCrew _sascha_konvoi_fzg1;
_sascha_crew_fzg1_fahrer = units _sascha_crew_fzg1_grp select 0;
hint format ["%1", _sascha_crew_fzg1_fahrer];
But Im getting the return "any"
try _sascha_crew_fzg1_fahrer = (units _sascha_crew_fzg1_grp) select 0; maybe?
Also you can crew _vehicle
OMG hahaha
Return: "any"
I think thats the shorter way because I always will ne the driver
) after select 0
It doesn't do anything. The precedence was already correct.
If that's returning nil then createVehicleCrew failed to create a group with units in it.
I can see them
_sascha_crew_fzg1_fahrer = crew _sascha_konvoi_fzg1 select 0;
hint format ["%1", _sascha_crew_fzg1_fahrer];
Return "any"
_classes = (crew _this) apply { typeOf _x};
systemChat str _classes;``` if you want the array of classes for the crew works (I just tested it from zeus hence the `_this`)
Well, in this snippet, _sascha_konvoi_fzg1 is obviously undefined.
_sascha_konvoi_fzg1 = createVehicle ["rhs_tigr_sts_msv", [3430.88,12672.6,4.76837e-07], [], 0, "CAN_COLLIDE"];
_sascha_konvoi_fzg1 setDir 210;
_sascha_konvoi_fzg1 setVehicleLock "LOCKEDPLAYER";
so if I was doing it, I'd just cheat, spawn a vic of that class off map somewhere, spawn the crew, grab the classes of the crew (as above) then delete both
I've done worse things π
Ill have to read about apply and typeOf
no, your code should work. Checking it.
Im confused
apply is just map in any other language, takes an array, applies a function to it, creates a new array with the result of applying that function to each element, (hence why it's called map most of the time, it maps an arrary via a function to a new array) π
typeOf is just the class that was used to create the _entity - both are super common when working with units/vehicles via scripts
Works fine in debug console:
_sascha_konvoi_fzg1 = createVehicle ["rhs_tigr_sts_msv", getPosATL player, [], 0, "NONE"];
_sascha_crew_fzg1_grp = createVehicleCrew _sascha_konvoi_fzg1;
_sascha_crew_fzg1_fahrer = units _sascha_crew_fzg1_grp select 0;
_sascha_crew_fzg1_fahrer;
But yeah, if you're just trying to get the classname of the unit then you're doing it wrong.
You can get that without even spawning the vehicle.
I want to select the driver to do an doFollow with the driver of another vehicle
At all its a convoy
I think Does anybody know a way to get the units of the createVehicleCrew was what he asked, I took that to mean he wanted the actual classes of the composition of the crew but it looks like he just wanted the group that was created maybe
can just use driver for that after filling it with crew
#knowledgeGap
api surface on arma is vast π
been screwing with it for a year and I still find functions I've never seen before - usually from reading mod source code and a "huh...didn't know you could do that"
DoFollow works for convoys? 
@broken pivot https://community.bistudio.com/wiki/moveInDriver is handy in some contexts as well - I have a function that takes an array of crew classes and cargo classes (passengers) and will fill the vehicle (correctly getting the slots for crew/cargo because that's wonky) and I use that there to specify which crew unit drives the vehicle
assume you'd need to setFormation as well and some other bits but it might, I've never tried it
doFollow just switches units back to their default behaviour of following the group leader.
probably want forceFollowRoad and setConvoySeparation
Hello everyone, hope you're doing well. Dipping my toe into the world of writing some scripts myself, using various resources online. Long story short, I'm trying to create a mod that creates sectors which will be contested over by an attacking force and a defending force. Currently having issues with it; so basically my PBO structure looks as above with the PBO manager (I packaged this via Arma 3 Tools), my config file looks a bit like the 2nd image. However, when i start the game, i get "Script functions\fn_genSec.sqf not found". Any pointers?
In theory you can make a convoy by putting all units in multiple vehicles into one group and then using setFormation to get them into a column.
IIRC it works extremely poorly though.
understatement π they just go rogue and smash into trees
To be fair they do that even if it's a single vehicle.
There's a road south of Therisa where some vehicles do that tree lurch pretty consistently :/
Waw haha
In practice I need to know how I let a unit follow another one
I have ambient civs and there is a specific hill on Virolahti where the AI just crashes every time π so much so you just end up with a pile of destroyed vehicles...I could have blacklisted it but it was far funnier to just place a minefield there as an explanation for all the destroyed vehicles
players saw the destroyed vics, drove straight through the minefield.... π
I tried convoy just recetly. Vehicles in same group, formation for convoys, safe behaviour, limited speed for leading vehicle and it looked great
yeah, can do it from zeus as well as long as you make sure the front vic is group leader, all other vics are synced to him, set formatiton to column and then just drop a convoy params on it
that seems to be the most reliable way, is simple enough I never bothered to automate it
Its also only used for unit control inside their own group
if you have two vehicles grouped together, then you can just get unit that is the formation leader with formLeader on any vehicle - that's why you have to sync "behind" vehicles to the "leader" vehicle to use the Convoy Parameters stuff in zeus π
Haha im now reading about setLead
welcome to arma, ask for a banana, get the gorilla for free π
I wonder whether you're having the same issue than me some time ago. It seems that the A3 Tools (Addon Builder) happily excludes SQF files by default when you build the addon.
one day I'll add a !convoy command to my command line but it has pain written all over it (and I don't do it enough) that the time spent automating it will never be paid back from using it π
I already have enough commands (bottom left), π
There is a diffrent between groups and teams?
this came across my mind, but if i go into the PBO file via PBO manager to see its contents, they're included; first i was referencing the file path incorrectly in the config.cpp, but doesn't appear to be the case.
at first i thought i wasn't referencing, sorry
What teams?
Sent a DM
In Arma technical terms, yes. A Group is a proper group as displayed in the Editor. A Team is a sub-unit of a Group, but it's a system that was never really fully implemented and isn't useful for anything.
Team Member is a unique data type and isn't interchangeable with an ordinary Unit, so watch out for that if a command requires it.
Sometimes, in general usage, a Group will be referred to as a "team", e.g. "sniper team", but this is a doctrinal description, not technical.
you can split squad to fireteams and if you don't use it for some tactics its bad for you, very basic strategy is to make blue fireteam take good position and red team to harass enemies and lure them where blue fireteam take them out
What is not implemented about teams?
I thought it's purpuse was for easier commanding of multiple units, since you dont have to manually select then each time if you put them teams
Basic colour teams aren't the same as the Teams system
you assign them, then choose what fireteam to do what you want, what else u need ?
I'm talking about a specific technical thing, not the general principle of a sub-team.
The colour team system accessible from the commanding menu is not the same thing as the system I'm talking about.
you have all the space you want to tell us about the system u need
I don't need it. It exists, partially, and I'm trying to explain what it is in response to Monsterframe's question.
Colour teams: https://community.bistudio.com/wiki/assignedTeam
Unused Teams system: https://community.bistudio.com/wiki/createTeam
so thats it, a name instead of a color
There is a partially-implemented system for teams, with a unique Team Member data type, which was added in Arma 2 but never properly integrated into the game. It's not accessible through normal gameplay and is not very well-documented or generally used. However, script commands for it still exist, and they occasionally trip people up because of confusion over the difference between a Team and a Group.
did me ages ago briefly, then my mental model switched to groups of groups and a group that is a subgroup is a "team"
which is how it is in practice
quotes because it's all just groups
two hard problems in computer science, cache invalidation, naming things and off by one errors π
yes, because colors are better, fireteams are for tactics in the squad, not to make anoher squad inside the one existing
the only thing to improve is to access fireteams faster with a hotkeys
this is completely unrelated to color teams...
That might be why development of the Teams system was abandoned. Or maybe they just couldn't make it work. We don't really have much information about it.
The idea could have been to make Groups work for larger elements, so instead of having a platoon of several Groups each representing a subunit of the platoon, you would have the platoon as one Group made up of several Teams. In theory, that would let the platoon work as one cohesive unit, instead of the standard system of Groups being basically unaware of each other. But I don't know for sure.
uh yeah, splitting squad to blue, red, etc fireteam has nothing to do with fireteams, but your name is green so you are porbably right
In technical terms, the colour team system has nothing to do with the other Teams system, which is what the original question was about. Again, not really a discussion about the general concept of "a team".
@hallow mortar first try to command a squad, then think about platoons
Just to make it clear, I'm talking about the internal workings of the Arma engine and the AI. This isn't about doctrine or tactics. This is about a specific actual system that exists in the engine.
does
side cursorTarget;
give me the side of what I am looking at
like:
_some_ai_side = side cursorTarget;
//_some_ai_side ~== EAST
meaning I could eval:
side player != side cursorTarget;
// if they are not the same thi is true
???
thx
Good evening. Im puking about everything at the moment. What the fuck is wrong with the game if your tryna do a convoy.
There is a follow waypoints thats still on the Beta state of the game. Its just called "Waypoint" in every language...
If you try to attach waypoint then he wont refresh new positions. So hes driving to the point where its created and not move to the attached object.
Guys how can I let one unit follow the other? (Diffrent groups)
It feels like a gap in the engine... Or am I using "waypointAttachObject/Vehicle" wrong?
Do you really need vehicles in individual groups?
How do you attach waypoint? I don't think you can do that
So..... why does this action only show up on things that are on my side???
[
player, // Object the action is attached to
format ["<t color='#0000FF'>%1</t>", "force"], // Title of the action
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_secure_ca.paa", // Idle icon shown on screen
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_secure_ca.paa", // Progress icon shown on screen
"cursorTarget isKindOf 'Man' && alive cursorTarget", // Condition for the action to be shown
"player distance cursorTarget < 5", // Condition for the action to progress
{}, // Code executed when action starts
{}, // Code executed on every progress tick
{
[cursorTarget, player] remoteExec ["pada_fnc_force_surrender", 2];
},// Code executed on completion
{}, // Code executed on interrupted
[], // Arguments passed to the scripts as _this select 3
1, // Action duration [s]
100, // Priority
false, // Remove on completion
false // Show in unconscious state
] call BIS_fnc_holdActionAdd;
you add the action to the player, so the player will have the action
yes, but the action is supposed to only be shown if I am looking at a "MAN".
The action only shows on units of my Side eg I am blue and the AI is blue.
Does not show if I look at opfor.
I do not see nor understand why
"cursorTarget isKindOf 'Man' && alive cursorTarget", // Condition for the action to be shown
this is what makes the action "visible" and I do not see why it is behaving this way
press T to reveal the enemy, perhaps
cursorTarget is sensitive to whether or not you are "aware" of said entity
PS: use "CAManBase" instead of "Man" as "Man"β¦ can also be a rabbit π
copy, will try. ItΒ΄s a "knows about" thing?
And copy, will adjust to CAManBase
it is a knowsAbout-like thing indeed
that fixed it. It was driving me mad xD
thx alot!
I dont know. Ive lost the trust in the game. Im honest. There is a follow waypoint in 3DEN but not in command list. If you look at config viewer its there. If you use it: puff
Whats the best method to do a convoy of 8 diffrent vehicles with diffrent power?
What power?
Vehicles of different speeds?
Accornig to wiki waypointAttachObject doesn't work in A3
Enginge power/Horse power
Im so angry at this point
@broken pivot maybe you've missed the message #arma3_scripting message
It looks shit in my case. These fucking bastards take diffrent ways and drive against every wall. I HATE IT
the main syntax; the secondary one works π
Its my code. Wont work. The AI drives to the point where the waypoint is created in the moment it gets created.
And what's wrong with that?
It wont follow
It stops
Example:
Vec1 is at posA
waypointAttachObject triggers
Vec2 goes to posA during Vec1 goes on
Vec2 reaches posA waypoint is completed
WHAT DA FAQ
they should move, but the waypoint should not complete if the attachment is done
however
you are linking that to a trigger - that's a different command!
waypointAttachObject is to e.g attach a "destroy" waypoint to a building
I will add a disambiguation to the page π
Name of the command sounds to me like attaching object to the waypoint rather than other way around
Was wondering what the command is for
But whatever, back to the convoy. Why can't you put all convoy vehicles into the same group?
Like that: ?
_sascha_crew_fzg1_wp0 = _sascha_crew_fzg1 addWaypoint [[3079.82,12357.8,-3.8147e-06], 0, -1, "start"];
_sascha_crew_fzg1_wp1 setWaypointType "MOVE";
_sascha_crew_fzg1_wp1 setWaypointBehaviour "SAFE";
_sascha_crew_fzg1_wp1 setWaypointFormation "COLUMN";
_sascha_crew_fzg1_wp1 setWaypointSpeed "LIMITED";
_sascha_crew_fzg1_wp2 = _sascha_crew_fzg1 addWaypoint [[3664.38,11968.4,0], 0, -1, "start"];
_sascha_konvoi_fzg1 limitSpeed 50;
_sascha_crew_fzg1_wp3 = _sascha_crew_fzg1 addWaypoint [[4206.58,12238.2,2.28882e-05], 0, -1, "start"];
_sascha_crew_fzg1_wp4 = _sascha_crew_fzg1 addWaypoint [[4675.77,12859.3,2.86102e-05], 0, -1, "start"];
_sascha_crew_fzg1_wp5 = _sascha_crew_fzg1 addWaypoint [[5018.1,13686,0], 0, -1, "start"];
_sascha_crew_fzg1_wp6 = _sascha_crew_fzg1 addWaypoint [[5176.24,14480.6,1.33514e-05], 0, -1, "start"];
_sascha_crew_fzg1_wp7 = _sascha_crew_fzg1 addWaypoint [[6780.75,15433.5,0], 0, -1, "start"];
_sascha_crew_fzg1_wp8 = _sascha_crew_fzg1 addWaypoint [[7395.99,15425.9,-9.15527e-05], 0, -1, "start"];
_sascha_crew_fzg1_wp9 = _sascha_crew_fzg1 addWaypoint [[8893.38,14723.7,-0.000225067], 0, -1, "start"];
_sascha_crew_fzg1_wp10 = _sascha_crew_fzg1 addWaypoint [[9132.5,15786.8,-3.8147e-05], 0, -1, "start"];
_sascha_crew_fzg1_wp11 = _sascha_crew_fzg1 addWaypoint [
_sascha_crew_fzg1_wp12 = _sascha_crew_fzg1 addWaypoint [
_sascha_crew_fzg1_wp13 = _sascha_crew_fzg1 addWaypoint [[9078.48,16015,0], 0, -1, "start"];
systemChat "WP erstellt";
_sascha_crew_fzg2_wp0 = _sascha_crew_fzg2 addWaypoint [[3079.82,12357.8,-3.8147e-06], 0, -1, "start"];
_sascha_crew_fzg2_wp1 setWaypointType "MOVE";
_sascha_crew_fzg2_wp1 setWaypointBehaviour "SAFE";
_sascha_crew_fzg2_wp1 setWaypointFormation "COLUMN";
_sascha_crew_fzg2_wp1 setWaypointSpeed "LIMITED";
_sascha_crew_fzg2_wp2 = _sascha_crew_fzg2 addWaypoint [[3664.38,11968.4,0], 0, -1, "start"];
_sascha_konvoi_fzg2 limitSpeed 50;
_sascha_crew_fzg2_wp0 synchronizeWaypoint _sascha_crew_fzg1_wp0;
well, maybe π
Love you β€οΈ
The second vehicle just turned around after a while and started the waypoints from 0
Is it even possible to do convoy where each vehicle has it's own group?
I dont know but I do this for the case the players fale in ambushing so the convoy can continue after dismounting
But I gues thats tought too easy.
You could split them into separeted groups once convoy gets ambushed, if you really want to
At first I need to fix that they dont complete the waypoint
It just happens
Ahhh, if I synchronize them, all members need to complete the waypoint before the next begins.
Only logical to let the 1st vehicle stop so the following ones cant complete their ones AHHHHHHHHHHHHH
That's the point of synchnization doesnt it?
Yeah, thats that
Ill put them now into one group so we can copy your variant
Im getting aggressiv after 13 hours of this shit
This should do:
(units _sascha_crew_fzg2 ) join _sascha_crew_fzg1;
(units _sascha_crew_fzg3 ) join _sascha_crew_fzg1;
(units _sascha_crew_fzg4 ) join _sascha_crew_fzg1;
(units _sascha_crew_fzg5 ) join _sascha_crew_fzg1;
(units _sascha_crew_fzg6 ) join _sascha_crew_fzg1;
(units _sascha_crew_fzg7 ) join _sascha_crew_fzg1;
(units _sascha_crew_fzg8 ) join _sascha_crew_fzg1;
waitUntil {unitReady [_sascha_grp1_1, _sascha_grp1_2, _sascha_grp1_3, _sascha_grp1_4, _sascha_grp1_5];};
systemChat "Ready";
if (unitReady [_sascha_grp1_1, _sascha_grp1_2, _sascha_grp1_3, _sascha_grp1_4, _sascha_grp1_5])
then {
_sascha_crew_fzg1_wp0 = _sascha_crew_fzg1 addWaypoint [[3079.82,12357.8,-3.8147e-06], 0, -1, "start"];
_sascha_crew_fzg1_wp0 setWaypointCompletionRadius 15;
_sascha_crew_fzg1_wp0 setWaypointType "MOVE";
_sascha_crew_fzg1_wp0 setWaypointBehaviour "SAFE";
_sascha_crew_fzg1_wp0 setWaypointFormation "COLUMN";
_sascha_crew_fzg1_wp0 setWaypointSpeed "LIMITED";
_sascha_crew_fzg1_wp2 = _sascha_crew_fzg1 addWaypoint [[3664.38,11968.4,0], 0, -1, "start"];
_sascha_crew_fzg1_wp0 setWaypointCompletionRadius 15;
_sascha_konvoi_fzg1 limitSpeed 50;
_sascha_crew_fzg1_wp3 = _sascha_crew_fzg1 addWaypoint [[4206.58,12238.2,2.28882e-05], 0, -1, "start"];
...
I would expect all crew having same group and if you have for example infantry in truck, then that infantry should have own group and can dismount if needed just fine. But all vehicle crew needs to be in the same group
Thats done
But how do they keep distance if the speedUp is diffrent from vehicle to vehicle
Make sure first vehicle is slowest, you can do that using limitSpeed
Set it to something little smaller tham speed of slowest vehicle, so it can catch up if needed
Already in code. But if they drive up an mountain the acceleration fucks the formation
Im using 30km/h
Yeah heavy vehicles like tanks are gonna be a lot slower up hill
Formation is column and behaviour safe?
_sascha_crew_fzg1_wp0 = _sascha_crew_fzg1 addWaypoint [[3079.82,12357.8,-3.8147e-06], 0, -1, "start"];
_sascha_crew_fzg1_wp0 setWaypointCompletionRadius 15;
_sascha_crew_fzg1_wp0 setWaypointType "MOVE";
_sascha_crew_fzg1_wp0 setWaypointBehaviour "SAFE";
_sascha_crew_fzg1_wp0 setWaypointFormation "COLUMN";
_sascha_crew_fzg1_wp0 setWaypointSpeed "LIMITED";
_sascha_crew_fzg1_wp2 = _sascha_crew_fzg1 addWaypoint [[3664.38,11968.4,0], 0, -1, "start"];
_sascha_crew_fzg1_wp0 setWaypointCompletionRadius 15;
_sascha_konvoi_fzg1 limitSpeed 30;
So positiv
Maybe they not in correct order?
How to correct?
(units _sascha_crew_fzg2 ) join _sascha_crew_fzg1;
(units _sascha_crew_fzg3 ) join _sascha_crew_fzg1;
(units _sascha_crew_fzg4 ) join _sascha_crew_fzg1;
(units _sascha_crew_fzg5 ) join _sascha_crew_fzg1;
(units _sascha_crew_fzg6 ) join _sascha_crew_fzg1;
(units _sascha_crew_fzg7 ) join _sascha_crew_fzg1;
(units _sascha_crew_fzg8 ) join _sascha_crew_fzg1;
fzg=vehicle
Ok this seems to be correct
I thought one might be trying to overtake other to get into formation
Thats also my gues, but I cant find some hints that thats true
FunFact:
They do a shit after fucking up+
If you have them placed on the road and first is fzg1, second fzg2 and so on then it should be fine
In my testing they were driving just fine, staying on the road, not hitting anything
It might be them trying to overtake vehicle, which should be behind them
Please say that Im a massive idiot
Dont get it D:
Group members have numbers, those which you can select by pressing F keys, those same numbers determine where is units place in formation. Unit number two will be behind leader, unit number 3 bwhind number 2 and so on
so I say like:
driver _sascha_konvoi_fzg1 setToNumber? 1-8```
Also it might be them trying to get into formation, if formation is not column, but is seems like it is column based on your script
You dont need any special commands for that, just spawn them at correct order
Play the video in slow motion. They are
One by one from first to last car is getting filled up
Ok
I cry
I dont want this shit over and over again
Nothing just works or is kinda logic in this game
And no one is able to even imagine
Senceless
Another 14hours wasted
When I was doing convoy it took me couple of minutes and it looked just fine
You were lucky :P
Please do magic to my script Arma allfather π
They are not even driving on the fucking fuck fuck speed limit Ive set to them.
what can go wrong with a ```sqf
_sascha_konvoi_fzg1 limitSpeed 30;
Just senceless to do something in this game. I always thought that the issues come from the players that fill the sandbox. But what the fuck
Please explain me
# Please someone
It's travelling at 11km/h with a limit of 30? What's wrong with that?
Did Ive understood something wrong about this really simple looking command?
Isn't that group? LimitSpeed wants object
I think because setWaypointSpeed "limited" for not doing full throtle
limitSpeed only caps the speed. It doesn't force it.
You also saw this? @granite sky maybe youve got the idea
//Fahrzeuge
_sascha_konvoi_fzg1 = createVehicle ["rhs_tigr_sts_msv", [3430.88,12672.6,4.76837e-07], [], 0, "CAN_COLLIDE"];
_sascha_konvoi_fzg1 setDir 210;
_sascha_konvoi_fzg1 setVehicleLock "LOCKEDPLAYER";
I dunno, that's pretty much how I remember vanilla convoys working :P
I'm in bed, but I saved the scenario where I was trying that convoy
Maybe skip the waypoints for now. Just set them up with commands (setFormation, limitSpeed) and give the group a move order.
Is that a troll?
But I remember the Antistasi convoys used to use that shit and it never worked. I chucked it away eventually.
Removing waypoints and give move order is the same isnt it?
No
I don't know. Waypoints are an extra black box layer.
Some of them are clearly fucked, like GETOUT.
Black Box Layer?
Something where you can't see how the internals of it work
What the fuck youve did there @ArmaDevelops... why isnt there a follow command? The game engine is 20+ years old...
Those shitty vehicles cant even drive in a formation...
Anyone know if it's possible/how to make a #lightpoint or #lightreflector have this kind of effect?
This is my current
private _reflector = "#lightreflector" createVehicleLocal [0, 0, 0];
_reflector attachTo [vehicle player, [0, 6, -2.5], "light_l"];
_reflector setLightColor [1, 1, 1];
_reflector setLightAmbient [1, 1, 1];
_reflector setLightIntensity 1e6;
_reflector setLightConePars [50, 10, 1];
private _vector3D = [[[0, 1, 0], [0, 0, 1]], 0, -45, 0] call BIS_fnc_transformVectorDirAndUp;
_reflector setVectorDirAndUp _vector3D;
private _light = "#lightpoint" createVehicleLocal [0, 0, 0];
_light attachTo [vehicle player, [0, 6, -2.5], "light_l"];
_light setLightColor [1, 1, 1];
_light setLightAmbient [1, 1, 1];
_light setLightUseFlare true;
_light setLightFlareSize 5;
_light setLightFlareMaxDistance 500;
_light setLightBrightness 1000;
_light setLightIntensity 10;
Yes, tldr you need to find or make a P3D
ConeShape or something is the keyword to find the command
Nice okay, do you know if I'd have to add that as a 3rd light or add it to the first light?
It is a spotlight exclusive feature
I see a3\data_f\VolumeLightFlashlight.p3d as an example on the wiki, is there a way I can find and look in that data_f folder for more .p3d files?
Yes, unpack it
Advanced Developer Tools mod also has a file browser and you can render models with it
Thank you, I managed with PBO Manger thankfully, just had to dig around to find where dafa_f.pbo was first
Tip for convoys:
Turn the AI into bots.
Study this script, it's a working convoy and it has some element to prevent a stuck convoy.
Tip: waypoints, watpoints, waypoints... a lot of them
https://github.com/PiG13BR/PIG-Air_Supremacy_PVP/blob/main/functions%2Fobjectives%2Ffn_convoyObjective.sqf
Does including a memPoint in the attachTo function make the attached object more stable/stick better to the parent object?
If so, how would I go about finding all the "memPoints" for a modded vehicle? Cause right now the faster the vehicle goes the further ahead the attached objects drift :/
likely yes depending on what mempoint you attach it to and if you use an object and you can use https://community.bistudio.com/wiki/selectionNames to get all mempoints on an object
Thank you, unfortunately it only seemed to help with the actual floodlight object I have, the lights are still wonky and moving ahead :(
you may want to damage the floodlight/ delete its l ightsource and then attach a lightsource itself with https://community.bistudio.com/wiki/Light_Source_Tutorial
Sorry yeah, the floodlight is just a decoration, it's my #lightpoint and #lightreflector(s) that are drifting off
They're attached the same way as I do the floodlight
modify the offset of attachto till it appears good
It appears perfectly when the helicopter is at a standstill, when it starts moving that's when the lights drift away (further away the faster it's going)
oh i forgot this if its just a lightsource https://community.bistudio.com/wiki/lightAttachObject
Oooooh, didn't know there was a attach function for lights specifically, I'll give that a go thanks!
No. That command is outdated and you should be able to attachTo normally
is there a way to assign a variable to a listbox item added via lbadd?
lbSetData or lbSetValue
What is purpose of Game Logic object? Is that something I can use to spawn objects on, so I can see(and easily move it) in editor where the position is?
I've tried everything with attachedTo, I simply cannot prevent the light from drifting away when the vehicle is moving. Is that just how it lights work or is there a workaround?
might be the simulation type of the light or so, wasn't there a workaround of attaching something else in between with a different (faster) simulation type?!
I had similar problems with AI helis lifting a crate, before this update some years ago that fixed the desync for vehicle lifting, it was fine.
After the update, for AI the crate is desyncing in front of the helicopter, but for players it worked fine.
Game Logic is basically a placeholder object that really does nothing. However it does store its position, rotation, variable etc so some script can refer to it later
why would they make Game Logics, if it does nothing, that don't make sense, i think it does way more then nothing,,,,,
you think they said oh, lets put Game Logics in the game, so it does nothing
yet POLPOX is right! it is a virtual entity.
so your saying virtual entitys do nothing
no not nothing but not a lot
then why even put Game Logics in the game
π
so we could just use a marker and not mess with Game Logics
You could also use a Game Logic and not mess with markers?
I fail to see your point, its there if you want to use it. otherwise just dont?
my point is why would they put Game Logics in the game, there must be a reason
You could ask it two decades ago
You can store variables on a game logic. You can attach them to things. They are just an invisible object that on its own does nothing.
But there are things you can use them for when scripting.
agree
You could almost say its an object you can use for your scripted "game logic" π
and thats exactly what was said before? it itself does nothing but it does have all the perks of being an object
ok i see your point
ill think of it as like a reference object within the mission that can be used to store variables, call scripts or be linked to triggers as a comparative module game logic
Its basically the same as putting a hidden cube on the map somewhere, but slightly cleaner
back in the day (OFP) game logics could be used to script and help in mission making. But that was long a go so I cant remember any examples
oh yes i remember OFP big time
Some times i would put a game logic on the map named (Server)
yes
i think whats so cool about this game is there is many ways to do the same thing, some ways are better then others
kinda like real life or like the Golf swing he he
its so nice texting with all you Awsome people here in discord, i learned so much love you guys,!
I could use it to move other object on it from script. Using game logic's position and direction. While I can see in editor where it is placed, which can't be said about positions stored in array in SQF script.
Hidden markers could be used like that, but that's not marker's purpose. Also you have to use string to find marker rather than having variable referencing that object
you can use the debug console in the editor
also 3den enhanced allows you to execute scripts on editor
in the end, the editor is just an scripted UI over the game
so scripting work almost the same ( there are some diferences) but on a really simple level, its almost the same... you can use create vehicle and set pos... and that wont be saved on the mission ( unless you told so)
I have entire mission logic in scripts and I want to move objects to some positions from scripts. What are my options to store potential positions? I could use array, but that doesn't allow me to see where the position is in the editor and it's not convenient if I decide to change the position. Game Logic objects seems to be pretty good solution.
you can use any object, that wont be saved in the sqm
use create vehicle and setposatl to move in the desired positions.
i dont know how fluent you are with sqf to do all this from the debug console
i strongly recomend you to use either leopards dev tools or you can also use execvm to a file
And where those positions would be stored?
you want to see the positions randomly generated from a script? or you have the exact positions?
Exact positions I hand picked in the editor
if you already know the positions, what you want to see in the editor?
empty type of marker is suitable for this
looking for generating unique id for name for marker created by script. Want to create n number of markers on object/position.
private _marker = createMarkerLocal [ format [ "TAG_%1", _object call BIS_fnc_netId ], getPosASL _object ];
maybe use time + random, but that is not true unique
id use global variable and increment it's value. but there may be better ways
hashValue systemTime
It changes every millisecond, chance that you get a duplicate is very low
If you want to protect against same millisecond, hashValue [systemTime, player]
diag_tickTime could also work
It used to be the best way to do a hashmap.
what if you get systemTime/diag_tickTime inside a each frame event or another nonsuspening event, could the time remain same for that frame?
If you generate two markers in a row in the same script then it'll probably be in the same millisecond...
But in that case you'd use an increment so I'm not sure why the question exists. Needs more detail anyway.
Locality & timing of creation, specifically.
yeah just run this code and it seems to be that way: ```sqf
isnil
{
systemchat format ["-- %1 %2 %3", time, systemTime, diag_tickTime ];
systemchat format ["-- %1 %2 %3", time, systemTime, diag_tickTime ];
};
If you're generating a certain number of markers, then you're probably using forEach, for or similar commands. Normally they have access to an index (_i, _forEachIndex etc) and you can add that to your marker name to make it unique within that sequence.
In other cases you might use a global variable to store the last index.
Sometimes it's even valid to just generate a random number until you get a name that doesn't already exist.
anyone able to help write code for arma reforger mods on a dedicated server
Probably, but you'll have better luck finding them in a Reforger channel rather than Arma 3. Try #reforger_questions or #creators_recruiting
Anybody knows (on the fly), how the "Weight" of the Gear of Vehicles is beeing calculated (for example, the Bar in the Gearmenu)? (erm, i hope you get what i mean)
Gonna try asking a 2nd time cause I'm desparate and have tried a bunch of things now without success :/
I have 1x #lightpoint and 2x #lightreflector attached to a helicopter which look perfect when the helicopter is still but once it's moving the lights drift ahead of the vehicle (like shown in the picture)
I've tried attachTo (with/without memPoints), lightAttachObject
I've also tried attaching a IR strobe grenade to the helicopter and attaching the lights to the IR strobe grenade hoping that the positioning would be more consistent or update faster but it didn't change.
Really hope someone knows a way to fix it otherwise I'll just have to live with it unfortunately looking silly
private _lightDecoration = "Land_FloodLight_F" createVehicle [0, 0, 0];
_lightDecoration disableCollisionWith _object;
_lightDecoration attachTo [_object, _spotlightLocation, _memPoint];
private _decVector3D = [[[0, 1, 0], [0, 0, 1]], 90, -45, 0] call BIS_fnc_transformVectorDirAndUp;
_lightDecoration setVectorDirAndUp _decVector3D;
private _lightSpot = "#lightpoint" createVehicle [0, 0, 0];
_lightSpot attachTo [_object, _spotlightLocation, _memPoint];
// other _lightSpot settings..
private _reflector1 = "#lightreflector" createVehicle [0, 0, 0];
_reflector1 attachTo [_object, _spotlightLocation, _memPoint];
// other _reflector1 settings..
private _refl1Vector3D = [[[0, 1, 0], [0, 0, 1]], 0, -55, 0] call BIS_fnc_transformVectorDirAndUp;
_reflector1 setVectorDirAndUp _refl1Vector3D;
private _reflector2 = "#lightreflector" createVehicle [0, 0, 0];
_reflector2 attachTo [_object, [0, (_spotlightLocation select 1) + 2.5, (_spotlightLocation select 2) -3], _memPoint];
// other _reflector2 settings..
_reflector2 setLightVolumeShape ["a3\data_f\VolumeLight_searchLight.p3d", [4, 2, 4]];
private _refl2Vector3D = [[[0, 1, 0], [0, 0, 1]], 0, 128, 0] call BIS_fnc_transformVectorDirAndUp;
_reflector2 setVectorDirAndUp _refl2Vector3D;
Hmm. Does it render the lights further ahead when the heli is travelling faster?
Indeed, the faster it's traveling the further ahead in the same direction the lights are
Not jumpy, completely smooth?
A little jumpy but I'd much rather deal with the jumpyness than the drifting
Just trying to work out what sort of bug it is.
If I used lightAttachObject for example it's a lot more jumpy
Yeah ofc, sorry didn't mean it like that hehe
Fyi the "other light settings" I hid is just stuff like this due to character limit and _spotlightLocation is currently [0, 0, 0]; due to using memPoint
setLightColor
setLightAmbient
setLightUseFlare
setLightFlareSize
setLightFlareMaxDistance
setLightBrightness
setLightIntensity
sorry just randomly stumbled upon this.
Haven't tried it but my next idea would be to try to update the light position every frame manually instead of attaching it to the helo.
Seems like you already have relative position and direction of the light relative to the helo, next I would add an event handler oneachframe or whatever it's called and in there update the positions of the light.
vectorModelToWorld should help with rotation, modelToWorld with position
arma being arma I give it a low chance of working but maybe worth a try
sorry to be out of the blue but does anyone know how to make an explosive able to explode multiple times?
(Im trying to make an orb that explodes and dont want it to just be a one time thing)
so far it has a satchel charge with a hidden model that takes damage when you interact with the right thing, is there a way to keep the satchel charge?
Why not just spawn another one?
because im using a "this addAction" script
in short, i dont want to keep having to respawn the same object manually
We can't always have what we want.
You get the same issue
I'm not really sure what you're trying to do or why, but maybe put the addAction on a different object and have that spawning the explosives.
I've tried this same idea for cabin lights in vehicles
IIRC addActions even work on hidden objects, so you can disguise.
i mean is the object destruction of the explosive on taking damage hard coded or can that be changed
As far as I know it's hardcoded. I might be wrong.
If you were going to change that, it'd be in config rather than script, which is not an easy thing to get into if you've only done editor scripting.
You could just spawn a new satchel after some delay
- Charge explodes
- Wait X seconds
- Spawn new charge
- Run the same code in the original charge's init
Light objects are (designed to be) local-only, and should be created with createVehicleLocal and handled locally on each machine
You get the same behavior with local only lights as well
fair, i dont, exactly know how to spawn the satchels aswell, how would i do that?
createVehicle with the CfgAmmo class iirc
i tried looking at the createVehicle page on the BI but it didnt make much sense, im ngl.
whats the CfgAmmo class?
Probably easiest to place one and find the class with nearestObjects.
Although if it's vanilla there's not that much stuff in CfgAmmo.
You should still handle them locally in general
I think if an object class has a # then it's created locally only, even if you use createVehicle.
Yeah
Each client gets a copy
Not sure about server, never tested
Even if that's the case, the object references will still be different on each machine and need to be stored locally for any later manipulation
No one said not to handle them locally
# Hey people ^^
I want to change the behaviour of a group and cant continue since a while
Im using this this code:
//Group
sascha_grp1 = createGroup east;
//Waypoint
{_x disableAI "TARGET"} forEach units sascha_grp1;
sascha_grp1_WP_passiv = sascha_grp1 addWaypoint [[9078.48,16015,0], 0, -1, "PassiverZustandBesatzung"];
sascha_grp1_WP_passiv setWaypointType "HOLD";
[sascha_grp1, 0] setWaypointBehaviour "SAFE";
sascha_grp1_WP_passiv setWaypointFormation "STAG COLUMN";
//Return
_text = {behaviour _x} forEach units sascha_grp1;
hint format ["%1", _text];
And get the "AWARE" return from the [PHOTO1]
You probably meant units sascha_grp1 apply {behaviour _x} ?
If you wanted to see behaviour of each unit*
This is correct - your forEach implementation is only showing the return from the last unit checked, not all of them.
Also, there are a couple of different levels of AI behaviour mode, and it's possible you're checking the wrong one. The vehicle does have its lights on, which suggests the AI thinks it's in SAFE mode on some level; usually they'll go lights-off in AWARE or COMBAT mode.
You could try checking the combatBehaviour of the group instead.
setWaypointBehaviour appears to set unit behaviour rather than group behaviour.
Oddity in the code is that it's setting waypoint behaviour for a waypoint that isn't declared.
We don't know from the code which waypoints are activated and when.
setWaypointBehaviour may not apply immediately anyway. Waypoint progression happens at intervals.
If you just want to set the behaviour now, then set it now.
Isn't it needed on server too for AI? Light conditions influence AI's detection
Then add random 1 to it too
Im up again. After a cup of coffee Im going to test π
Little question about HashMap at this point. Because I think you are using the second syntax. Isnt it needed to place an { } around or is it some case of "auto-detect"?
It needs code. Either a variable with code, or a code block directly
Since units sascha_grp1 returns an array, the first syntax of apply is used.
Copy confirm. Thanks a lot π
Nice to understand π Very helpfull thanks 
It was useful to learn a bit and improve the return part
but Im looking to change the behaviour and do a double check with the return part
I gues something went wrong with the index or something in the command from [PHOTO1]
Hey @hushed turtle π
Maybe change to behaviour wasn't applied yet?
You could try sleep 3; and test it behaviour little later
Im trying to disableAI "TARGET" at a later point at the moment
It also seems like you are not aware of the fact that you can just change the behaviour on the group. Changing bahaviour though waypoints isn't the only way
These are the made tests:
Ive applied and instantly tested with in the same exec
Ive applied and delayed tested with in diffrent same exec
Ou thats good to know. how could Ive been missing that...
https://community.bistudio.com/wiki/setBehaviour
ouch But really good for progress. Ill try instantly and combine with the later disabledAI "TARGET"
Same goes for formation https://community.bistudio.com/wiki/setFormation
Can we find the max range of artillery
setCombatBehaviour changes group's behaviour, setBehaviour changes group's units behaviour. But honestly I don't have good understanding of what's the practical difference between the two
https://community.bistudio.com/wiki/setCombatBehaviour
I have a script that makes a "mobile" respawn point.
and that is in a InitServer.sqf
and contains:
[west,"Base"] call
BIS_fnc_addRespawnPosition;
how do I set up so I can have 2 mobile spawnpoints?
if you want to make vehicle a respawn point just pass that vehicle as second argument to BIS_fnc_addRespawnPosition
I think in first sight its important to grab the same kind of return. Because I gues its also
a diffrent of GroupBehaviour and UnitBehaviour.
Otherwhise there wouldnt be to commands if the GroupBehaviour otherwrites the UnitBehaviour.
Is this logical and understandable? haha sry bad eng
so.. like this? haha
[west,"Base"] call
BIS_fnc_addRespawnPosition;
[west,"Base1"] call
BIS_fnc_addRespawnPosition;
sascha_grp1 setBehaviour "SAFE";
sascha_grp1 setFormation "STAG COLUMN";
{_x disableAI "TARGET"} forEach units sascha_grp1;
systemChat "Kampfhaltung -> Sicher";
This one did it and kept the AI able to change it on their own.
like this: ```sqf
[west,vehicleNameHere] call BIS_fnc_addRespawnPosition;
just like in Example 1: https://community.bistudio.com/wiki/BIS_fnc_addRespawnPosition
if you pass a string thats a marker name
sorry but you lost me, IΒ΄m terrible on this..
I have, for now, a InitServer.sqf and in that one is
[west,"Base"] call
BIS_fnc_addRespawnPosition;
I really dont understand where to put that you wrote, is it supposed to be in the initserver? so I remove all my old regarding spawn and put your text there?
NVM, solved it..
Not sure about server, never tested
Run this function. It requires the classname of the arty and the shell type
it returns an array of [min range, max range]
Yes but it's extremely difficult.
Oh, someone found my code :P
Drop the +/-100 line if you want to replicate artillery computer ranges.
π«£
Just drop a rock in the water - that'll work π (if you know you know)
lmao
Thanks
Hey everyone, new here and excited to find others to help. I need to know if someone has the script to auto open (animate) and close the deck bay doors on the LPD-36 Amphibious warship. You can manually open the doors so I know the function exists, but checking the Config viewer and I'm kind of lost, help would be greatly appreciated, thankyou!
Ideally I'm wanting the door (big white square door in pics) to auto open and close based on a trigger
Animate should work; does it not?
Apply?
I was thinking about something else. That's what happens when my brain is on autopilot.
Youll have to forgive me, I've come pretty far in editor but still learning so im not sure what that is
Oh animate, I feel like that's where it is but I've not been successful, when I do the animate command it make the sound of the door opening but not the actual effect
animateDoor?
Shouldn't it be ship1 animateDoor ["Door_3", 1], not 0?
Hey 
You have several options to initiate animations on options, animate, animateDoor and animateSource. As the wiki entries for animate/animateSource both state, animateSource is the better option over animate.
To find the actual animation names, you can simply use animationNames (https://community.bistudio.com/wiki/animationNames) to get an array containing the names of all animations for an object.
Yeah tried that too, just in case
ooooooo it may be a source, you may be right, brb
Nope, I've got to be off by the tiniest amout
What is the return value of animationNames ? Perhaps you've got the wrong animation.
You'll have trouble doing it directly because the ship is actually composed of multiple parts. The thing you place in the Editor is actually a proxy base object that automatically generates the ship parts from itself.
I'm not sure how to find that
Empty array
Found what i believe is the part in the config viewer, and tried to adjust my code but still no dice, I can confirm the "hangar door" is the door in question
Because ship1 is the base part, not the hull_02 part which is dynamically created from the base object
I have personally had very mixed results with these composite objects. I usually steer clear of using them outside of background props.
Especially when it comes to animations
Yeah I was beginning to come to that conclusion too, which is why I hoped someone here would have experienced this and found an answer
The return value will vary depending on which part of the object you're checking.. For instance on the Destroyer you will get different (or no) animation names depending on whether you're checking the hull, interior etc.
You just need to find the other part. You know what type of object it is, so it's actually fairly simple as long as you don't have any other ships of the same type nearby.
Advice on where to go or what to look for in finding the accurate part?
private _shipPart = nearestObject [ship1, "Land_EF_LPD_hull_02"];
_shipPart animateSource ...```
Actually, if you'd like to make this slightly more complicated, you can find with certainty the exact object belonging to this ship, which will avoid any problems with nearby similar ships
The function that generates all the ship parts stores references to them in a variable on the base object, for pretty much exactly this purpose, so you can retrieve it from that variable
Where do i plug that script?
This^
You've got to make sure you're targetting the part containing the door and it's animations. Otherwise you will run into issues.
I was just looking in that comp folder in the config viewer btw, its the only mention of hangar door in the entire compositie, so I believe it lives where you found in that _02
Wherever you're trying to do whatever it is you're trying to do. In your trigger or whatever. This is the script you need to do the thing (except for animateSource being a placeholder for your actual animation thing)
I haven't got EF running at the moment, for reference: The Destroyer stores the references for all parts in bis_carrierparts.
EF uses the same function, so it's the same.
Oof my brain is short circuiting. So what is it I need to do from here?
Let's dumb it down and do this Barney style
There multiple animations for those doors
The script I posted is exactly what you need, except for completing the animateSource with the animation name, which you already have.
Either way, this is the script that does the thing. You put it in your trigger and it does the job. Don't overthink it.
Actually it's more complex than that for some reason. They don't just store the object in the array, they store something else too π€ first one will still work fine with no other nearby ships, I just need a second to fix the more complicated version.
Yeah that's exactly what I'd go with as well.. lol
private _object = ((ExampleDestroyer_1 getVariable ["bis_carrierparts",[]] select { (typeOf(_x#0)) isEqualTo "Land_Destroyer_01_hull_04_F" })#0#0);
(obviously this works with the Destroyer, not the EF ship but same principle)
This code does it, you could use just "door_hangar_1" alone, but that's not proper way.
private _shipPart = nearestObject [ship, "Land_EF_LPD_hull_02"];
_shipPart animate [ "door_hangar_3", 1 ];
_shipPart animate [ "door_hangar_2", 1 ];
_shipPart animate [ "door_hangar_1", 1 ];
You were just missing one more select 0. It's just an array of [object reference, variable string fpr the saved position]
Why would you say animate is the "proper way" instead of animateSource?
I'll give it a try, not sure if this helps but I finally found the actual user action call code for the animation, let me know if this changes anything...
Theres on for open and one for close (though its the difference in code between a 1 and a 0)
It should be animateSource I believe he was referring to just using one of the 3 hangar animations as not being "proper", which is correct. That wouldn't lead to door opening correctly.
But it should be animateSource instead of animate, for the reasons stated on the wiki.
There are 3 animations but they're all tied to one source. animateSource using that source manages them all.
This plus _object animateSource ["door_hangar_source",1]; is the most correct way of doing it
Oh, well, haven't tested it yet. I'm likely wrong then.
private _object = ((YOUR_SHIP getVariable ["bis_carrierparts",[]] select { (typeOf(_x#0)) isEqualTo "Land_EF_LPD_hull_02" })#0#0);
_object animateSource ["door_hangar_source",1];
This would be the complete solution, i concur.
YOU BEAUTIFUL SON OF A BITCH
HOW DO YOU GIVE YOU KUDOS IN THIS GROUP?
The code I initially posted would also have worked fine for most scenarios fwiw :U
Well the kudos belong to @hallow mortar.
Thankyou, I thought thats who this was, but YOU thankYOU for your time and help on this
Its incredibly infurriating
I was wrong about animationSource, given I haven't used it in a while and his Idea with nearestObjects would work just as well unless a ship was placed half way inside the ship you were trying to animate π
private _shipPart = nearestObject [ship, "Land_EF_LPD_hull_02"];
_shipPart animateSource ["door_hangar_source",1];
Moves all three parts at the same time
@icy ridge & @hallow mortar dropped a kudos for yall in editor, thanks again
With sleep 6; this look kinda nice how it opens slowly by moving one part at the time and briefly waiting before moving the other part
I would like some help making a basic script. I have a Commander unit with the variable name of unCMDR, I need a trigger to check if he is dead, then display a hint "The UN Commander is dead!" when he dies. I am trying to make my own but it seems to just not be working.
(Granted I am using a trigger, so
)
Any particular reason, why you would need to use a trigger for this?
A far simpler solution would be to add a killed eventHandler:
Because I have no idea what I'm doing an I assumed a trigger would be the best way lol
Alright, no problem. We all started out new 
Eventhandlers can be added to objects, units etc. and get triggered when a certain event happens. Hence the name event handler.
Wicked
Important question before i continue: Are you building a mission meant to be played in Multiplayer or Singleplayer?
Multiplayer
Alright. Does the unit get added during the mission or is it already present in the editor?
It is already present
I don't need anything super complex, as this op is literally just "go here and wipe out two faction leaders" lol
In that case you're still good with a regular killed eventhandler, as the unit's init field is the same for every player. In the init field of the leader unit you can simply add:
this addEventHandler ["Killed", {
params ["_unit", "_killer"];
hint parseText format ["The UN leader <t color='#3062b1'>%1</t> was killed by <t color='#b52600'>%2!</t>",(name _unit),(name _killer)];
}];
Wicked! Thank you
No problem 
@pale wagon To quickly explain what this does, as I think there is little learned from copying something blindly, a breakdown:
this, inside an init field, refers to the object itself and is thus more convenient than giving the object a variable name and then using that.addEventHandleris the initialization command for a new eventhandler. It is used by first giving it atarget(in our case we usethisas explained above) and then after the command the actual parameters are passed:type, which is a pre defined Eventhandler type (you can find a list of them here: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers) andcodewhere the actual code that gets run when the event is triggered gets defined.paramsis used to parse arguments that get "sent" to a function into pre defined variables. In this case the Eventhandler passes two parameters when triggered the killed unit and the unit who did the killing which is parsed into_unitand_killerrespectively usingparams.hintis a command you are more than likely familiar with already. It's used to display astringorStructured Textin a dynamically scaled window in the top right corner if a client's screen.parseTextis used to generate a piece ofStructured Text(basically a string but you can specify stuff likecolor,font,alignmentetc.)formatis used to insert variables into astringorStructured Textby referencing it with%indexand adding the variable after the string inside theparameter arrayin the case of this example the names of the killed unit as well as the killer are inserted into a piece ofStructured Texthighlighting the names with a defined color (hex color code).
So put together it is an Eventhandler waiting for the unit to be killed and once it is it displays "The UN leader NAME_IN_BLUE was killed by KILLER_NAME_IN_RED!".
Oh wow, thank you! Very informative
For further reference here are the wiki pages of the used commands:
addEventHandler: https://community.bistudio.com/wiki/addEventHandlerparams: https://community.bistudio.com/wiki/paramshint: https://community.bistudio.com/wiki/hintparseText: https://community.bistudio.com/wiki/parseTextformat: https://community.bistudio.com/wiki/format
Eventhandlers, their types and further info: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers
Explanation of Structured Text: https://community.bistudio.com/wiki/Structured_Text
No problem 
I doubt it's a thing, but is there a simple way for Zeus/Curators to see all chat messages? Primarily sideChat
Side chats of other factions?
Yeah
Outside of RCON I'm not aware of a simple way to achieve that ..
You could do something horrifying with a HandleChatMessage mission EH but I wouldn't describe that as a simple approach
Nah seems too convoluted and the wiki of that event says risk of recursion if you send additional specific types of chats within it
Was hoping there was some kind of toggle function you could do to allow them to see all chats, from a moderation standpoint
But I guess I'll just add some sideChat remoteExecs where necessary for the curator to see
Such a function has no real reason to exist in terms of moderation, due to BattlEye RCON.
Yeah either this or have an external bit of code to automatically pull chat messages from rcon and add them to a database and have a ctrl displaying them in game. But both of these are extremely out there in terms of viability, reliability and performance.
I think a handlechatmessage system would be quite reliable if properly designed, and not too taxing on performance as chat messages are relatively infrequent. I have a pretty solid idea of how I would approach it. It would just be annoying to make and certainly isn't a simple toggle.
Hmm, any particular reason why this _x moveTo _randomPos; doesn't work on dedicated server? The logic is all server side and worked perfectly on local MP
[trig_guard_dog_init] spawn {
params ["_trig"];
sleep 2;
while {triggerActivated _trig} do {
{
_randomPos = [["dog_area"], ["water"]] call BIS_fnc_randomPos;
_randomPos = _randomPos findEmptyPosition [0, 5];
_x moveTo _randomPos;
} foreach nearestObjects [_trig,["animal"],100];
sleep 30;
};
};
The dogs completely ignore the "moveTo" order and just wander freely
moveTo needs to be run where the ai is local
If it's a dog spawned from the Ambient Animals module, wouldn't that be the server?
# Hey guys π
Im into digging to the Big Bang..
Very simple question:
If sascha_math = 2 and I want to turn the value into 1 can I just do:
if (alive player
) then {
sascha_math -1;
};
No
Simple question. Simple anwser.
There is no sascha_math++ equivalent in SQF either
So no calculation at all
So its impossible to change the sascha_math value? Or did I misunderstood?
you just do
sascha_math = sascha_math - 1;
Waw
Drown in the 1.000 tabs hahaha
... Ill check
End of headsrcatching. But its only logic to first take the value I want to edit..
It uses very common way to operate such math in almost every programming languages
Im honest that Im a newbie. But Im motivated to learn. And YES I know Enfusion Engine is coming. But I want to learn also Digital Reality because there are more people like you who can help me to understand the basics who are always kinda the same.
So thanks bro π
I was now able to easiesy do my first automated calculations
I got a problem by reading out the return because Im only able to check it once with this:
if (!sascha_insassen_passiv
) then {sascha_mathe = sascha_mathe -1
} else {sascha_mathe = sascha_mathe +1
};
hint format ["Sascha Mathe ist %1", sascha_mathe];
My only idea is a while state to detect permanent. The problem would be that also the
value gets always higher permanent
Could this somehow work?
while {sleep 5; sascha_insassen_passiv;
} do {systemChat "Einheiten passiv";
sascha_mathe = sascha_mathe 1;
} else {systemChat "Einheiten aktiv";
sascha_mathe = sascha_mathe 0;
};
It would be like this:
You would have infinite loop
(while true) loop witch will run with a delay of 5 seconds.
And then check your condition and increment or decrement the number and print the number.
Also because you are using sleep command it needs to be in scheduled environment.
Also instead of having infinite loop that will run indefinetly have it so it incresses or decresses on EH or basicly when something happends.
sascha_insassen_passiv = true;
sascha_mathe = 2;
0 spawn {
while {true; sleep 5;} do {
if(!sascha_insassen_passiv) then {
sascha_mathe = sascha_mathe - 1;
}else {
sascha_mathe = sascha_mathe + 1;
};
hint format ["Sascha Mathe ist %1", sascha_mathe];
};
};
The problem is that I only accept 1 for driving. 0 for stoping and fighting
If I understand it right it infinite adds values so if we stay 20 secs in driving we have a total value of 4.
So we would need to be 20 secs in battle to finaly achieve battle mode
What exactly do you want?
Yea i am confused as well ?
If you only have two states you can use a Boolean or flip the int between 0 and 1
You will regret hahahaha
Im in line 348 - 373
Dont care about the rest -> It works and I need to be finished today
What has to happen:
The AI is in aware "SAFE" so sascha_insassen_passiv == true
Then the sascha_mathe needs to be on 1 -> 1 means driving because it triggers Start&Stop if-Cause.
If "SAFE" changes to "AWARE" or "COMBAT" the sascha_mathe turns to 0 -> 0 means stop&combat
Then post the relevant code. No one wants to download a file. Especially not on mobile.
Its the way to understand everything with the explanation about what we need to know. Everything can become relevant I gues because everything works with everything because Ive used bigger vars I maybe should transfer into functions (?)
If you use pastebin, people can at least read it without downloading anything
Ill read about
So this is in the file
https://pastebin.com/ujbGjYAM
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Does it work: https://pastebin.com/tFXQKB3e
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Yea it does.
Btw you just need simple Bool variable that will flip when something happends you dont need a increment in number or anything like that.
I guesed something and wanted to learn about calculation
Now Ive learned about and see that its maybe not the best way haha
Ill work something together and let you look about. Gimme a sec
Looking at the code. You also wann learn about loops
The best part is he has loops:
{
_x assignAsCargo sascha_konvoi_fzg2;
_x moveInCargo sascha_konvoi_fzg2;
} forEach units sascha_grp2;
π
hey hey
Im learning
hahahahhaaha
But it works!
Somehow...
Scheduled in hell
Fired at god mode servers that accept mistakes
It was a really nice moment Ive learned that forEach only takes the last value of an array you insert...
Ive learned that forEach only takes the last value of an array you insert
β¦no?
private _myArray = [1,2,3];
{
hint str _x;
} forEach _myArray;
```outputs "1", "2", "3"
And if:
Array1 = [1], [2];
Array2 = [3], [4];
{count} forEach [Array1, Array2];
or
{count} forEach (Array1, Array2);
or
{count} forEach Array1, Array2;
but not
{count} forEach {Array1, Array2};
that would be code and launch it and return the result of <any>
Can this work?
What it actually was, was that forEach only returns the return from its last iteration, not all of them. i.e. the difference between forEach and apply
Array1 = [1], [2]; equals Array1 = [1]; [2];
you may be meaning Array1 = [1, 2]; or Array1 = [[1], [2]];
Does that mean if i do this:
private _array = [1,2,3];
private _test = {systemChat str _x} foreach _array;
systemChat format ["%1", _test];
_test returns 3 ?
_return = { str _x } forEach [1, 2]; // _return contains "2"
_return = [1, 2] apply {str _x}; // _return contains ["1", "2"]```
ah in that case, yes
but abc = {} foreach xyz isβ¦ "advanced", or at least "not recommended" scripting π
I agree, but sometimes people try to do it because they don't realise it doesn't work like apply, and that's what happened in this case
No, because systemChat doesn't return anything. If you used something that did return something, then yes.
Im not the bast at abc examples
grp1 = unit1, unit2
grp2 = unit3, unit4
{_x setPosATL player} forEach [grp1, grp2];
If think thats what I want to describe @winter rose
It would be like this you need to append them or pushback them in 1 array:
private _grp1 = ["unit1","unit2"];
private _grp2 = ["unit3","unit4"];
_grp1 append _grp2;
{
systemChat format ["%1",_x];
}forEach _grp1;
grp1 = unit1, unit2 // wrong
grp1 = [unit1, unit2] // correct
(and don't forget semicolons)
Im back with something here it is:
sascha_kampf = false;
while {true; sleep 5;
} if (sascha_insassen_passiv
) then {systemChat "Einheiten passiv";
sascha_kampf = sascha_kampf false;
} else {systemChat "Einheiten aktiv";
sascha_kampf = sascha_kampf true;
};
//Start&Stop
sascha_anhalten = if (sascha_kampf
) then {stop script
};
sascha_anhalten = if (!sascha_kampf
) then {driving things
};
ouch (remember beeing a child changing Liberation the first times ~5-10years ago and searching for hours) fuck time is running
Is there a easier way if diffrent commands needs a diffrent input then just doing this?
your lines 26/27 are nonsense, delete them
Into it
Hi People o/. How can i remove a magazine from a players weapon when taking a weapon out of a normal Arsenal?
Remove Magazines doesnt seem to work for ammo in the gun
Thats there Ive used them:
{_x setBehaviour "SAFE"} forEach sascha_gruppen_array;
{_x setFormation "STAG COLUMN"} forEach sascha_gruppen_array;
{_x disableAI "TARGET"} forEach units sascha_gruppen;
If I remember right the other format wont work
that is because the last foreach is in the wrong format
the units part
{
private _group = _x;
{
_x disableAI "TARGET"
} forEach units _group;
} forEach sascha_gruppen_array;
you have to go through groups and inside that go through its units
the sascha_gruppen variable was just sascha_grp_1 here
You remember the first time I asked about https://community.bistudio.com/wiki/private?
Its time again to get it done finally
Its still a component Im a bit unsure about.
Isnt it similar to local or _local_var_created
Thats a clever way. You just unfold it inside a HashMap (correct designation?) -> {HashMap}
and give the return to the next outer one. Did Ive understood correct?
I don't really understand what you mean. Maybe removePrimaryWeaponItem?
https://community.bistudio.com/wiki/removePrimaryWeaponItem
nope, a hashmap is some "advanced array" if you will
do not worry about it for now π
Okay then I stay with -> {code}
OMG
hahaha It was late yesterday. Now I understand exactly why my sascha_gruppen was so heavy nonesense
sascha_gruppen_array = [sascha_grp1, sascha_grp2, sascha_grp3, sascha_grp4,
sascha_grp5, sascha_grp6, sascha_grp7, sascha_grp8];
return == sascha_gruppen
lol nothing changed
What is return?
If would grab it. -> Execute
I gues also this chapter is closed.
The var only exist until the code segment is executed
Are you just creating _group to fill something into the code of the last forEach to not create an error?
{
private _group = _x;
{
_x disableAI "TARGET"
} forEach units _group;
} forEach sascha_gruppen_array;
Or why not just using _x ?
It loops though all units from all groups from sascha_gruppen_array array
it was for the example to not mix up group and unit
Checked
Using private _group = _x; allows you to use _group rather then _x, which makes code more readable. Also every forEach has it's own variable _x, which means that you can't access variable _x of outer forEach code from within inner forEach code.
So you split content
you can write this, it works```sqf
{
{
_x disableAI "TARGET" // _x is unit
} forEach units _x; // _x is group
} forEach sascha_gruppen_array;
however, in the innermost scope, you cannot access the "_x group value" because "_x" is unit
So we dont need to split because it cant get overwriten because _x also plays already from its own in the innermost scope. Also checked
_number = 5;
if (true) then {
_number = 10; // Writes into variable _number declared before this code block
};
_number; // Returns 10
_number = 5;
if (true) then {
private _number = 10; // Declares new variable, which only exist within this code block
};
_number; // Returns 5
https://community.bistudio.com/wiki/Variables#Local_Variables_Scope explains it with colours and all π it can be tricky at first π
Yeah, it took me some time to understand that when I saw that for the first time π
Placed on the storage. Thats very well explained. This is one view one memory
while {true; sleep 5;
} do {
if (sascha_insassen_passiv
) then {systemChat "Einheiten passiv";
sascha_kampf = sascha_kampf false;
} else {systemChat "Einheiten aktiv";
sascha_kampf = sascha_kampf true;
};
};
I gues Im doing something wrong in changing the values
sascha_kampf = sascha_kampf false; wat
sascha_kampf = false; OK
also indentation
while { true; sleep 5; } do
{
if (sascha_insassen_passiv) then
{
systemChat "Einheiten passiv";
sascha_kampf = false;
}
else
{
systemChat "Einheiten aktiv";
sascha_kampf = true;
};
};
also logic
while { true; sleep 5; } do
{
if (sascha_insassen_passiv) then
{
systemChat "Einheiten passiv";
}
else
{
systemChat "Einheiten aktiv";
};
sascha_kampf = !sascha_insassen_passiv;
};
Does that even work? while { true; sleep 5; }, sleep won't return true, right?
Your right.
correct, should be while { sleep 5; true }
My chat isnt raped
I would put sleep either into start or end of the do code honestly
Why is my chat spamed 10 times a sec with this code:
while {true;
} do {sleep 5;
if (sascha_insassen_passiv
) then {systemChat "Einheiten passiv";
sascha_kampf = false;
} else {systemChat "Einheiten aktiv";
sascha_kampf = true;
};
};
This also effects nothing:
while {sleep 5; true;
} do {
if (sascha_insassen_passiv
) then {systemChat "Einheiten passiv";
sascha_kampf = false;
} else {systemChat "Einheiten aktiv";
sascha_kampf = true;
};
};
ou
are you running this code in e.g a trigger?
server-side how?
Debug Console and execVM
debug console cannot run that - try wrapping it in
0 spawn {
// code here
};```
0 spawn {execVM "EBER\Erweiterungen\Konvoi\EBERStadt-Agios.sqf";}; ?
no, the code above (while true stuff)
Ill read about spawn after
0 spawn {
while {sleep 5; true;
} do {
if (sascha_insassen_passiv
) then {
systemChat "Einheiten passiv";
sascha_kampf = false;
} else {
systemChat "Einheiten aktiv";
sascha_kampf = true;
};
};
};
Still under message-fire
But if I got spawn right it just effects anything if the scheduler is busy
Don't worry about scheduler
I just dont understand why the sleep isnt working
Dont matter if I add it to while itself or the do command it effects
It should work within spawn
Ive did it with this but it changed nothing
close Eden, reopen it, retry
my guess was that you ran it multiple times in Eden
the thing is, all the threads will keep running, they won't be "overridden" by the next one
so you kept creating threads messaging every 5s π
So those threads are still running on the server? π
Do I know have to do restart it every time? Because it still happens
well, if you create a thread, it runs
especially with a "while true"
You could use for block to limit number of cycles
but again, we don't know what you want to do
Logic called me.
I just want to check if the unit is AWARE or COMBAT and if so I want to stop the convoy
Or you can create global variable keepRunning = true; and then use while {keepRunning} and when you do keepRunning = false it will stop running
Until you finish your script
I totally forgot to bring back:
sascha_combat_cond = ({behaviour _x} forEach units sascha_grp1 == ("AWARE") or {behaviour _x} forEach units sascha_grp1 == ("COMBAT"))
&& ({behaviour _x} forEach units sascha_grp2 == ("AWARE") or {behaviour _x} forEach units sascha_grp2 == ("COMBAT"))
&& ({behaviour _x} forEach units sascha_grp3 == ("AWARE") or {behaviour _x} forEach units sascha_grp3 == ("COMBAT"))
&& ({behaviour _x} forEach units sascha_grp4 == ("AWARE") or {behaviour _x} forEach units sascha_grp4 == ("COMBAT"))
&& ({behaviour _x} forEach units sascha_grp5 == ("AWARE") or {behaviour _x} forEach units sascha_grp5 == ("COMBAT"))
&& ({behaviour _x} forEach units sascha_grp6 == ("AWARE") or {behaviour _x} forEach units sascha_grp6 == ("COMBAT"))
&& ({behaviour _x} forEach units sascha_grp7 == ("AWARE") or {behaviour _x} forEach units sascha_grp7 == ("COMBAT"))
&& ({behaviour _x} forEach units sascha_grp8 == ("AWARE") or {behaviour _x} forEach units sascha_grp8 == ("COMBAT"));
hint format ["%1", sascha_combat_cond];
Into the script...
In the end it should have condition which stops it once unit is aware or combat
Wat
Is there a reason why are you trying to check for unit's behaviour rather than group's?
Thats the part with the forEach thing again... That part is from yesterday
combatBehaviour sascha_grp1 == "AWARE" || combatBehaviour sascha_grp1 == "COMBAT"
This line returns true if sascha_grp1's behavior is "AWARE" or "COMBAT"
And you should be using arrays to store multiple related variables
My brain slowly melts
Now the game says that sascha_combat_cond is undefinded
yes, because this code is nonsense
also, does it need to be a global variable or do you only use it in this script?
I think there are bigger errors right now...
I use it only here but thought its nicer to work with
private _areAllGroupsAwareOrCombat = sascha_gruppen_array findIf { behaviour _x != "AWARE" && behaviour _x != "COMBAT" } == -1;
When writting you could be using global variables to see them more easily and change them to locals once you are done
Can you send me USB of your memory?
behaviour only takes OBJECT as argument
Im still confused whats going on exactly
With " != " your search for -> isNotEqual, right?
Then you look for and... thats the point where Im totally out.
And what does the -1
It won't work for other types of object
findIf gets the index of the first found case where it's different from aware or combat
if index is -1, it means "nothing was found", so all groups are aware or combat
Alright. That makes it easier
but
private _areAllGroupsAwareOrCombat = sascha_gruppen_array findIf { behaviour _x != "AWARE" && behaviour _x != "COMBAT" } == -1;
should indeed be```sqf
private _areAllGroupsAwareOrCombat = sascha_gruppen_array findIf { combatBehaviour _x != "AWARE" && combatBehaviour _x != "COMBAT" } == -1;
Indeed
So Im only getting a return if unit is in combat?
behaviour only works on units and not groups
Only units and groups have behaviour
cars are inert objects π
yes
engine-wise a unit is an Object
a group is a group
so using behaviour _jeep will return "ERROR"
https://community.bistudio.com/wiki/behaviour
Coffee keeps me allive
please don't π
(I don't mean "don't stay alive" :p I mean "don't rely on coffee to stay alive" :D)
Honestly I dont believe in the shakespeer theory that it makes creative. It just release drivin in thinking whise. Sometimes not helpful.
But thats not the right place. Lets continue progress
Somehow it makes me happy somehow it depress me that Im not that far on my own.
How can I stop it? My first thought: giving the while state a globe var and turn this one false like:
loop = 0 spawn {
while {sleep 5; true;
} do {
if ((sascha_insassen_passiv && !_LouMontana_combat_cond)
) then {
hint format ["Battle cond is %1", _LouMontana_combat_cond];
systemChat "Einheiten passiv";
sascha_kampf = false;
};
if ((!sascha_insassen_passiv or _LouMontana_combat_cond)
) then {
hint format ["Battle cond is %1", _LouMontana_combat_cond];
systemChat "Einheiten aktiv";
sascha_kampf = true;
if (isNil "sascha_konvoi_fzg1"
) then {
loop false;
};
};
};
};
Now its "finished"
Can this work?
Loop is a script handle not a boolean
Then this cant work
You want to have a boolean variable in you while condition.
While {myVar}...
If ....
MyVar = false
That would be a if-Cause
Also naming variables LouMontana makes the script run 42% slower.
EBER-Tags neutralize all negativ effects
test
huh thats weird i just sent a message but it told me i couldn't
I two questions regarding help with scripting.. both involving a dedi unfortunately. I'll start with the more simple question
I have a supply truck driving back and forth from an airbase to an fob, it involves a random so it could either one of the two locations on the map. As per usual, it works fine on a singleplayer and listen server, but on dedi it doesn't work at all.
I believe it might be the IF statements.. as the vehicle just goes Straight to the last waypoint and fails to fire the executable. is there something I've done wrong for it not to work on a dedi?
_waypoint1 = _group1 addWaypoint [getPosASL _randomLocation, 1];
_waypoint1 setWaypointType "MOVE";
_waypoint1 setWaypointBehaviour "CARELESS";
_waypoint1 setWaypointStatements ["true", "[[27, _driver], 'scripts\crate_script.sqf'] remoteExec ['execVM'];"];
_waypoint1 setWaypointTimeout [2, 3, 4];
if (_randomLocation == RESUPPLY_WP_LOGIC_DEPOT_FOB) then
{
_randomlocation2 = RESUPPLY_WP_LOGIC_DEPOT_FOB_LEAVE;
_waypoint2 = _group1 addWaypoint [getPosASL _randomLocation2, 1];
_waypoint2 setWaypointType "MOVE";
_waypoint2 setWaypointBehaviour "CARELESS";
}
else
{
_randomlocation2 = RESUPPLY_WP_LOGIC_DEPOT_NAVY_LEAVE;
_waypoint2 = _group1 addWaypoint [getPosASL _randomLocation2, 1];
_waypoint2 setWaypointType "MOVE";
_waypoint2 setWaypointBehaviour "CARELESS";
};
_waypoint3 = _group1 addWaypoint [getPosASL RESUPPLY_WP_LOGIC_DEPOT_BASE, 1];
_waypoint3 setWaypointType "MOVE";
_waypoint3 setWaypointBehaviour "CARELESS";
_waypoint3 setWaypointStatements ["true", "[[_driver], 'scripts\logistics\supply_script.sqf'] remoteExec ['execVM'];"];
};```
but when you alt-tab back the code looks like it should be working
Where are you setting _randomLocation?
I guess you gotta buy a BI plush to help you with rubber duck debugging =)
honestly i need to just post this stuff on a discord before asking questions, as soon as its on here - it sticks out like a sore thumb
on that same script however, it execs the crate_script.sqf which I know works because it was the last way point being triggered anyway.. but it's supposed to set a variable for "Cash" - I've noticed that even though I have it set to All machines, it doesnt really want ot set the variable for cash at all
I have it currently set as
_killpot = KILL_POT1;
_killpotcash = _killpot getVariable ["Cash", true];
_Cost = 1500;
_NewFunds = _killpotcash + _Cost;
_killpot setVariable ["Cash", _Newfunds, true];
sorry thats the full line for context
now from what i understand that True is global
is there any type of magic i need to do for that to work for an AI?
that is being run on every machine by remoteExec? seems like it should only run on a single machine
well i have it set to remoteexec 2 but I havent actually tested it now since the whole forgetting the random array
i'll just test that first before asking more, i think it was just wanting to make sure it was sound but with the code failing to trigger on dedi anyway i need to test it
Okay last question, I promise i'll leave for a month after this π
doing a weapon gui - works great on single and listen, usual speech
however on the dedi, everything displays correctly - it just doesnt give the player the weapon
BuyWeaponGUI =
{
params["_Control","_Player"];
_WeaponData = _Player getVariable "WeaponChoice";
_Price = _WeaponData select 0;
_Weapon = _WeaponData select 1;
_Mag = _WeaponData select 2;
_wItem1 = _WeaponData select 3;
_wItem2 = _weaponData select 4;
_Cash = _Player getVariable "Cash";
if(_Cash>=_Price)then
{
_NewCash = _Cash - _Price;
_Player setVariable["Cash", _NewCash, true];
[_Player,_Weapon,_Mag,_wItem1,_wItem2] remoteExecCall ["GivePrimary", _Player];
};
};```
now that last 'give primary' was originally
[_Player,_Weapon,_Mag,_wItem1,_wItem2] call GivePrimary;
but when it failed to give the weapon we changed it to RemoteExecCall because we thought the description fit the function but that too has flopped
just dedicated servers out to kill me apparently
I'm no gui pro, but I would assume it's running local to the client and not on the server?
I believe so as its called via hold action
I know you said you arent a gui pro - but should i change the call from execVM to remote execute?
What does the fnc GivePrimary look like?
And whats your use case looking like?
In other words, how does a player interact with your code?:
- How does he open the GUI?
- Where are the functions declared?
- Does the server handle anything during the interaction?
Can someone say me how I can return the units:
sascha_gruppen_array = [sascha_grp1, sascha_grp2, sascha_grp3, sascha_grp4,
sascha_grp5, sascha_grp6, sascha_grp7, sascha_grp8];
sascha_gruppen_units = {{units _x} forEach units _x} forEach sascha_gruppen_array;
ForEach doesn't return the content you interact with inside of the loop.
{
sascha_gruppen_units = sascha_gruppen_units + (units _x);
} forEach sascha_gruppen_array;
and don't forget to declare/initialize the units array with sascha_gruppen_array = []; before the loop 
forEach returns, as stated on the wiki:
Return Value: Anything - will return the value of last executed statement
Indeed, good point. If it isn't declared already you should do so BEFORE starting the loop.
Can also do this
_units = flatten _groups apply {units _x};
eyyy code golf
i had to put ```sqf
flatten (allgroups apply {units _x});
ye, now that i think about it, default precedence looks like (flatten _groups) apply {units _x}; according to https://community.bistudio.com/wiki/Order_of_Precedence
i wonder how fast that is
Very fast. In general array manipulations are fast.
Similarly the difference between deleteAt 0 and deleteAt N-1 is usually smaller than calculating N-1
I tryna understand fully but Ive got a step closer again. Lets get to work
I don't get why this is giving me an error, both _dog and _randomPos exist, cause the dog is playing the animation I want and moving to _randomPos, how come distance2D won't work?
waitUntil { sleep 0.5; (_dog distance2D _randomPos) <= 1};
what are the contents of variables? Error message kinda looks like you try to give it an empty array 
Hmm, turns out _randomPos isn't always set, which is a bit surprising cause this is the area marker, and this is the code to get a random position
randomDogPos = {
private _randomSafePos = [];
while { count _randomSafePos == 0 } do {
private _randomPos = [["dog_area"], ["water"]] call BIS_fnc_randomPos;
_randomSafePos = _randomPos findEmptyPosition [0, 5];
};
_randomSafePos;
};
I figured it would have plenty of room to get a "empty" position
welp, your assumptions are challenged by harsh reality π
What about that? (updated code), that should make it keep trying to get a position until it succeeds right?
good enough. Still has an assumption of "it will find the position eventually", but i suppose it's much less likely to fail π
Maybe increase the search area on each iteration
So I fixed the _randomPos stuff but the damn _dog moveTo _randomPos; doesn't work using dedicated server...
randomDogPos = {
private _randomSafePos = [];
while { count _randomSafePos == 0 } do {
private _randomPos = [["dog_area"], ["water"]] call BIS_fnc_randomPos;
_randomSafePos = _randomPos findEmptyPosition [0, 10];
};
_randomSafePos;
};
[] spawn {
sleep 15;
_dogArray = ["Fin_sand_F", "Fin_blackwhite_F", "Fin_ocherwhite_F", "Fin_tricolour_F", "Fin_random_F", "Alsatian_Sand_F", "Alsatian_Black_F", "Alsatian_Sandblack_F", "Alsatian_Random_F"];
_dogs = [];
for "_i" from 0 to 1 do {
_dogs pushBack (createAgent [selectRandom _dogArray, ([] call randomDogPos), [], 0, "CAN_COLLIDE"]);
(_dogs select _i) setVariable ["BIS_fnc_animalBehaviour_disable", true];
};
[[sideLogic, "Base"], "Guard dogs spawned."] remoteExec ["sideChat", allCurators];
{
[_x] spawn {
params ["_dog"];
private _animMovement = ["Dog_Walk", "Dog_Run"];
private _animStop = ["Dog_Stop", "Dog_Sit"];
while { alive _dog } do {
_randomPos = [] call randomDogPos;
_dog playMoveNow (selectRandom _animMovement);
_dog moveTo _randomPos;
waitUntil { sleep 0.5; (_dog distance2D _randomPos) <= 1};
_dog playMoveNow (selectRandom _animStop);
sleep ([15, 60] call BIS_fnc_randomNum);
};
};
} foreach _dogs;
};
I tried [_dog, _randomPos] remoteExec ["moveTo", -2]; as well, didn't work either
where do u run the code?
In initServer.sqf
Having some what seems to be weird behavior here and wanted to know if someone more experienced could help. I am writing code which will populate an area w/random civs walking around. I want some of these civs to have a weapon slung over the shoulder to emulate an eastern market kinda thing where not everyone with a weapon is a bad guy. However, every time i spawn the unit and give them a gun, they do not sling it and instead attack blufor with it. Here is the quick code I wrote to do this:
_civ = (createGroup Civilian) createUnit [(selectRandom C_civilians), (player modelToWorld [0,15,0]), [], 1, "FORM"];
sleep 0.5;
_weap = selectRandom C_weapons;
_mag = compatibleMagazines _weap;
_civ addMagazineGlobal (selectRandom _mag);
_civ addWeaponGlobal _weap;
_civ action ["SwitchWeapon", _civ, _civ, -1];
//C_civilians is an array of civilian classnames. C_weapons is an array of weapons which they will spawn with for ref.
Nevermind, fixed it with this:
civilian setFriend [west, 1];
west setFriend [civilian, 1];
However if anyone knows how to force a unit to sling its weapon to shoulder apart from how i'm doing it above, that input would still be appreciated
try sleep 1 before "SwitchWeapon"
negative, at most he appears to be starting the animation, but doesn't get further than lifting the weapon from lowered state
what if u do _civ setBehaviour "SAFE"; first, i have that in my code, then sleep
still no luck, only thing that seems to happen is now he begins the animation twice but doesn't complete and keeps the weapon lowered
ttried "CARELESS" behavior too to see if that helped.. No luck
the only workaround I can think of is spawning a weapon holder on the ground and hoping to attachTo it to the civ. but that is a lot of extra work for not the payoff that I want
this code works for me (I put officer on the map in editor): ```sqf
this spawn {
params["_npc"];
_npc setBehaviour "SAFE";
_npc removeWeapon (primaryweapon _npc);
sleep 1;
_npc action ["SWITCHWEAPON",_npc , _npc ,-1];
};
I think that the difference in your code and mine is that you are removing the equipped weapon, leaving the unit no choice but to be unequipped. Whereas I am trying to make the unit unequip their weapon and shoulder it
That only works for sidearms on AI, not primary
sounds like there is no easy way to accomplish what I want. Only other way i can think is by doing something like attaching a groundholder w/the weapon in it to the units back
I wonder how ACE/CBA accomplishes it π€
i mean NPC switches to the sholdered primary when i remove equipped secondary even after ```sqf
c disableAI "ALL";
c enableAI "ANIM";
might just scrap the idea
inb4 backpack with weaponholder model
eh that sounds like i gotta make a mod to get this gamemode to work
make a launcher version of every rifle
or simpleobject of weapon
Close lol, but the simpleObject has the fired animation as part of the model. The weapon shows the firing state (flames coming from barrel)
_simpleObject hideSelection ["zasleh", true];
Whats a script for making an ai gunner in a mortar fire at a specific position ?
do i need to make ai select firing mode for distance too?
or will this cmd do that for me?
if i have a position to fire at, rounds, ammo
it requires you to have: position, type of ammo (class) and rounds (number)
but what about firing mode?
if u try to hit a palce 5km away with firing mode 0 with max distance 1km, it wont work right
π€
no, maybe someone else knows
do you mean like "close, medium, far"?
ok well i did doartilleryfire and the guy is firing like, the shell very close whislt target is 1km away
with single1, first mode
well for me always worked fine, even with mods
don't know what kind of mods do you use for mortars
Is there a way to see the internal code on waypoint types such as SEEK AND DESTROY? Config viewer doesn't point to anything useful in cfgWaypoints.
doartilleryfire really not making ai fire anything
broken mod/wrong position/wrong ammo type/not in range (too much close or too much far)
check the range with this: https://community.bistudio.com/wiki/inRangeOfArtillery
Make sure you're within range
Something like this
params ["_unit"];
private _primaryWeapon = primaryWeapon _unit;
if (_primaryWeapon == "") exitWith {};
private _loadoutPW = getUnitLoadout _unit param [0];
_unit setVariable ["C_loadoutPW", _loadoutPW];
private _model = getText (configFile >> "CfgWeapons" >> _primaryWeapon >> "model");
private _simpleObject = createSimpleObject [_model, [0,0,1000]];
_simpleObject hideSelection ["zasleh", true];
_simpleObject attachTo [_unit, [0.45,0.550,-0.25], "weapon", true];
_simpleObject setVectorDirAndUp [[1,0,0],[0,0,1]];
_unit setVariable ["C_holsteredPW", _simpleObject];
_unit removeWeapon _primaryWeapon;
_unit action ["SwitchWeapon", _unit, _unit, 299];
Hy guys, back in SQF coding business, I fail to understand why I cannot easily put an "addAction" into a loop... it looks like a kind of lazy evaluation issue since all actions defined will behave like the last one...
I would like to write:
tv addAction["<t color='#1155BB'>Atelier 1</t>", { [[3513.02,6785.48,0], [3295,17620]] call atmtk_tgt_teleport;} ];
tv addAction["<t color='#1155BB'>Atelier 2</t>", { [[11312.8,5834.11,0], [11720,15209]] call atmtk_tgt_teleport;} ];
tv addAction["<t color='#1155BB'>Atelier 3</t>", { [[8322.2,14081.6,0], [9130,24795]] call atmtk_tgt_teleport;} ];
tv addAction["<t color='#1155BB'>Atelier 4</t>", { [[18614.9,4942.91,0], [17403,15848]] call atmtk_tgt_teleport;} ];```
in something more generic like:
teleport_locations = [
[[15728.2,12417.2,0], [15705,22658]],
[[3513.02,6785.48,0], [3295,17620]],
[[11312.8,5834.11,0], [11720,15209]],
[[8322.2,14081.6,0], [9130,24795]],
[[18614.9,4942.91,0], [17403,15848]]
];
{
loc = _x;
tv addAction["<t color='#1155BB'>Atelier " + str(_forEachIndex + 1) + "</t>", { loc call atmtk_tgt_teleport;} ];
} forEach teleport_locations;
The issue is all actions from Atelier 1 to 4 will teleport to the latest location, namely [[18614.9,4942.91,0], [17403,15848]]. Any idea?
loc stores the latest position. Pass position through arguments param.
Thank you!
Works better with:
tv addAction["<t color='#1155BB'>Atelier " + str(_forEachIndex + 1)+ "</t>", { (_this select 3) call atmtk_tgt_teleport;}, loc];
You don't need loc global var:
{
tv addAction [
format ["<t color='#1155BB'>Atelier %1</t>", _forEachIndex + 1],
{
_location = _this select 3;
_location call atmtk_tgt_teleport;
},
_x
];
} forEach teleport_locations;
Sure, I just hurried to test π
Sorry mate, had to run out earlier
- the Gui is opened with the Holdaction call
however we have tried using execVM and remoteexec to call it
Functions wise, hes did it in a sqf which is called by the button in the controls
we're currently on action = "[_this, player] remoteExecCall ['BuyWeaponGUI', 2]"; which seem'd to be working for taking money but not working for giving the players the weapon
the server is handling alive and stuff ontop of it but the other GUI is working, its just not wanting to give a player magazines or weapons
we thought it was because it wasn't set to Global, however its now no longer taking the money
we're fried with it at this point, it works perfectly fine on listen and single but dedi just seem's to not want to work and we've been at it for hours now
call{[
this,
"OPEN VENDING MACHINE",
"\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\meet_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\use_ca.paa",
"true","true",
{hint "Shop Status: Loading..."},
{},
{
hint "Shop Status: Complete";
[0, player] execVM "scripts\WeaponGUI.sqf";
},
{hint "Shop Status: Interrupted"},
[],
0.5,
nil,
false,
false] call BIS_fnc_holdActionAdd;
this setVariable ["R3F_LOG_disabled", true]; };```
thats the holdaction we're now back to using
it was this
call{[
this,
"OPEN VENDING MACHINE",
"\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\meet_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\use_ca.paa",
"true","true",
{hint "Shop Status: Loading..."},
{},
{
hint "Shop Status: Complete";
[[0, player], "scripts\WeaponGUI.sqf"] remoteExec ["execVM"];
},
{hint "Shop Status: Interrupted"},
[],
0.5,
nil,
false,
false] call BIS_fnc_holdActionAdd;
this setVariable ["R3F_LOG_disabled", true]; };```
Guys why is my ai mortar gunner so inaccurate he cant fire the 120mm pm 43 properly at trh target its always missing by 100s ofmeters
@regal kraken
Functions wise, hes did it in a sqf which is called by the button in the controls
we're currently on action = "[_this, player] remoteExecCall ['BuyWeaponGUI', 2]"; which seem'd to be working for taking money but not working for giving the players the weapon
Should just be [_this, player] call BuyWeaponGUI. I don't see anything in there that should be remoteExec'd.
The cash is handled by a global setVariable anyway.
okay i've changed that back to [_this, player] call BuyWeaponGUI;
I don't see anything here that initially sets the cash variable on the player, so that might be an issue.
that is handled in the initplayerserver
its literally just this
_GROUNDFUNDS = (paramsArray select 10);
if (_GROUNDFUNDS == 1) then
{
_PlayerUnit setVariable ["Cash", 10000, true];
if ( _PlayerUnit in Nothem ) exitwith {};
};
if (_GROUNDFUNDS == 2) then
{
_PlayerUnit setVariable ["Cash", 5000, true];
if ( _PlayerUnit in Nothem ) exitwith {};
};
if (_GROUNDFUNDS == 3) then
{
_PlayerUnit setVariable ["Cash", 2500, true];
if ( _PlayerUnit in Nothem ) exitwith {};
};
if (_GROUNDFUNDS == 4) then
{
_PlayerUnit setVariable ["Cash", 1000, true];
if ( _PlayerUnit in Nothem ) exitwith {};
};
if (_GROUNDFUNDS == 5) then
{
_PlayerUnit setVariable ["Cash", 500, true];
if ( _PlayerUnit in Nothem ) exitwith {};
};
we're trying to work towards persistant cash which is why it looks.. particularlly messy
Ouch. Whenever you duplicate several times the same thing, it means that it is time to use arrays or loops instead.
yeah i completely agree this could be entirely more optimised
So what's the issue at this point?
when the player uses the Gui - it takes the cash, displays everything
but it doesnt give you the weapon you chose
You should define an array like:
cash = [0, 10000,5000,2500,1000,500];
Then do it once :
... setVariable ["Cash", (cash select _GROUNDFUNDS), ...
After removing the remoteExecs?
BigWilk made a nice forum post and mod about that.
Yes
going to test it one more time just to double check
Hey all, I'm looking for a way to attach an object to the turret of a tank and have it rotate with the turret independed of the tank it's overall attached to. Anyone able to help?
(still on it -> 2am in germany)
I gues the attach part is interesting for you
https://community.bistudio.com/wiki/Category:Command_Group:_Object_Manipulation
https://community.bistudio.com/wiki/attachTo
You need to use the optional parameters for "mempoint" and "followBoneRotation". Find a selection that's part of the turret and attach the object to that.
Sorry I'm new to this, what am I doing exactly?
both
for attachto I'm using
BIS_fnc_attachToRelative
never been really all there with Arma scripting
A basic attachTo looks like this:
_childObject attachTo [_parentObject];```
That's the minimum. With this, the child object will be attached to the "base" of the parent object, not any of its sub-parts.
There are additional optional parameters for `attachTo` which give you more advanced functionality. You need to use them to do what you want.
The first is the **offset**. This specifies a 3D distance, relative to the parent object, to position the child object after attaching. In principle, we don't need it for attaching to sub-parts, but we have to provide it in order to reach the next optional parameter.
Next is the **memory point**. Arma models contain memory points and selections, which are used as reference points, proxies, animated bones, and texture selections. `attachTo` can attach things to memory points within a model. We're going to attach your object to a memory point that's part of the turret.
Finally, there's **follow bone rotation**. By default, when you attach something to a memory point that can move relative to the model base (such as one on the turret), the child object follows the memory point's _position_, but not its _rotation_. Rotation stays locked to the model base. This parameter makes the child object follow the mempoint's rotation.
A complete `attachTo` looks like this:
```sqf
_childObject attachTo [_parentObject, _offset, _selectionName, _followBoneRotation];```
ahh right I see
and how would I go about finding the specific bone?
i'm assuming it's MainTurret?
It might be, it depends on the vehicle you're using. You can use e.g. copyToClipboard selectionNames cursorObject in the debug console to see all the options, then try different ones until you get a good one.
QAV's Challenger 2 is the specific one I'm using
but I'll have a try at the mentioned method
The offset is going to depend on where you want the child object to sit, relative to the target memory point. You can do some 3D position maths with selectionPosition, modelToWorld*, and vectorDiff to base it on the current relative position of the objects, or you can specify a position [x, y, z] to do it manually.
The follow bone rotation parameter is a simple boolean and we want to set it to true.
classic
Well you might as well just do selectionNames cursorObject and copy it from the return line, it's less annoying than stringifying the output
that worked, thanks
yea its mainturret
Quick Q
do I NEED the full
_parentObject, _offset, _selectionName, _followBoneRotation
or can I just use?
_followBoneRotation
You must have them all. Some of them are things we specifically need to make this work (the parent object, the selection name), and the offset must be specified because the array of parameters is interpreted sequentially. The game knows that the third parameter is the selection name; if you skip one before that, it'll be wrong.
You cannot skip one to write later ones
Well, according to your investigation, it's "mainturret"
apologies for all the questions, I actually haven't a clue what the fuck I'm doing lmao
So
this attachTo [CR2, _offset, mainturret, mainturret];
is that correct?
Also if you didn't specify an offset, the child object would be attached at the exact position of the memory point, which in this case I expect would be somewhere in the centre of the vehicle
this attachTo [CR2, [0,0,0], "mainturret", true];```
You're getting there.
this attachTo [CR2, _offset, "mainTurret", true];```
Note that `_offset` needs to be replaced with an actual offset `[x, y, z]`, either by dynamically doing maths to generate one, or by specifying one like POLPOX showed. (Probably don't use `[0, 0, 0]` exactly, for the reason I mentioned above)
Yea just tested it, it worked but rotated the item on it's 0,0,0 position but that's fine I can fix that
thanks so much troops, mega
!code
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";