#arma3_scripting
1 messages ยท Page 342 of 1
ModTrack1Pos is the name of a Task Destination Module, which is what I can't get to move. vSmuggleTruck1 is the name of a vehicle, the one it's tracking.
I'd use a trigger, which does work when I have modTrack1Pos setPos (getPos vSmuggleTruck1) in the Activation Code, but I want it to activate every 60 seconds, like a ping, so I was doing it this way.
Yet everything else in that while { if { statement works :(
How did you determine that the module did not move to the position of the truck?
When I go within range to activate the Task, the Task's destination has stayed the same (that being the origin point of the Destination Module, not where it should have moved to)
That said, I could quickly debug the two locations.
If you execute:
modTrack1Pos setPos (getPos vSmuggleTruck1)
via debug console, does the tasks destination move to the position of the module?
Interestingly, visually it does not move at all.
But the getpos for both the modTrack1Pos and vSmuggleTruck1 position are the same.
Then I conclude that moving the task destination module does not move the tasks destination.
Which is what I'd expect.
Yet the task's destination is tied into the Task Destination Module, is it not? I mean, if you're using that module anyway.
Because it works if through a trigger.
Which is the odd part.
No, it's not.
A module is just a game object that executes a piece of code at the mission start.
The module probably uses it's starting position to set the destination position of a task.
But there is no loop that updates that position. A loop would be needed.
The bit of code I sent before; is that not a loop? Because it loops.
No, the piece of code is invisible and hard coded into the module.
It's nothing you wrote.
I admit, I'm mostly throwing stuff against a wall and hoping it sticks, so my understanding of the language is rather poor, sorry.
Right.
So would you kow anyway to update a task's location in a way similar to what I was attempting?
Sadly I can get everything else to update every minute, including markers and such, which I'm also using just in case, but I'd really like the task system in place too.
class ModuleTaskCreate_F: Module_F
{
function="BIS_fnc_ModuleTaskCreate";
I think this is the modules classname, right?
ModuleTaskCreate_F
Right?
I'm not sure, sorry.
You can check in the editor.
If you could guide me to where I'd be able to see the classname, that would be great.
Oh.
Sorry, yeah, you're right.
Found it:
class ModuleTaskSetDestination_F: Module_F
{
function="BIS_fnc_ModuleTaskSetDestination";
"ModuleTaskSetDestination_F"
And all this module does, is execute this function:
private _logic = _this param [0, objNull, [objNull]];
private _units = _this param [1, [], [[]]];
private _activated = _this param [2,true,[true]];
if (_activated) then
{
private _modules = _logic call BIS_fnc_moduleModules;
private _module = objNull;
{if (typeOf _x == "ModuleTaskCreate_F") exitWith {_module = _x}} forEach _modules;
if (isNull _module) exitWith {false};
private _task = _module getVariable ["ID", ""];
if (_task == "") exitWith {false};
private _destType = call compile (_logic getVariable "Destination");
if (_destType == 1 && count _units == 0) exitWith {false};
private ["_dest"];
if (_destType == 0) then
{
_dest = position _logic;
}
else
{
_dest = [_units select 0, true];
};
private _showNotification = (_logic getVariable ["ShowNotification", 1]) == 1;
[_task,nil,nil,_dest,nil,nil,_showNotification] call bis_fnc_setTask;
};
if you set a unit as task destination, does the task not follow the unit around?
I don't know. And the goal is to update it every 60 seconds.
Those modules are weird and their scripts suck. I'd just not use a module for this.
Yeah, was hoping to avoid it, but most of the basic task structure is module-based.
theyre pretty simple functions luckily
you can just have an infinite loop that calls the same function and sleeps every time
I tried tskLocateTruck1 setSimpleTaskDestination (getPos vSmuggleTruck1) too with no luck.
Well that's pretty much what I have. A function that loops every 60 seconds.
better off if you use the function
Or, something that loops every 60 seconds anyway.
[taskLocateTruck1,TRUCK] call BIS_fnc_taskSetDestination
local effects, so if this is for MP you have to remoteExecute the function
[modTrack1Pos, synchronizedObjects modTrack1Pos, true] call BIS_fnc_ModuleTaskSetDestination;
This after updating the position of the module?
Thanks, I'll give that bit a try.
why even deal with the module at this point?
Idk. It's moving atm.
if its MP youre gonna have issues if that module isnt local, i think
Well, it's being run through players that meet a certain condition, so maybe it's local?
Yeah, network traffic of everyone moving the module.
it wont be local, Luro
[taskLocateTruck1,TRUCK] remoteExec ["BIS_fnc_taskSetDestination",SOMETARGET]
The module object exists on every machine and is local to the server.
Global object owned by the server.
Rip
Ive had the pleasure of toying around with a lot of task stuff just last week so if you have questions about the commands and stuff, feel free to ask
Thank you.
Just to clarify about that SOMETARGET part though. If that what the destination should be, or? because I feel TRUCK would already do that.
Sorry, function confused me. I haven't had any experience with them, or their formating.
SOMETARGET is the channel you want to execute the function (here: BIS_fnc_taskSetDestination).
You can just remove it from the array and it's done everywhere.
yea i assumed in MP some players might have other tasks or something, look up remoteExec on the wiki for whats all allowed
Oh
I'm an idiot.
I probably should have left it as SOMETARGETS then. I didn't realize what it meant.
No, SOMETARGET is just a placeholder by cptnnick and it would error if you copy pasted it into your script like this.
^ yes
you can put a side, object, numbers, arrays of objects, all kinds of stuff if you look on the wiki
Yeah, I didn't copy it. Sorry, I meant i interpreted it to mean the location I wanted the task to go to, not the people who should execute it.
Yeah, poor wording on my part. Sleepy me.
yea no left side is what gets fed into the function itself
TRUCK is the location
[arguments for function] remoteExec ["function",TARGETS]
which translates to [arguments for function] spawn function on the client
Yeah, got that. Now I'm back to an older issue haha. No biggie though.
Modules are a pitfall for beginners.
theyre ideal. in SP.
Ha, yeah. Now my issue is that it doesn't exist yet, so the game is going all mental at me.
I mean, I know what the issue is, and I had ways around that.
Actually.
Yeah, figures. Now my issue is that, the task doesn't exist when it's doing it's loop, so it's calling it an unknown variable. Yet if I assign a variable name to the task, the function you guys gave me fails.
Where did taskLocateTruck1 come from?
From the completion of another objective.
Well, it's created from the trigger that ends the last task.
modTrack1Pos getVariable ["ID", ""]
You can use this to get the task from the module.
If i was using [tskLocateTruck1,vSmuggleTruck1] remoteExec ["BIS_fnc_taskSetDestination",west];, is the modTrack1Pos module even needed?
Triggers, modules... You made this unnecessarily complicated. If you did it all by script, it would be a hundred times easier to handle.
Ha, I'm sorry!
is the modTrack1Pos module even needed?
Don't think it is.
what module is truly needed though
Good question.
have you made a diagram of what youre doing? it helps me sometimes
just write up in your own words what happens in each step
Nah, I haven't made any diagrams, sorry. I think it's just because it's trying to call on the function too early, but even when I have measures in place to delay it until it's needed, I still get the error.
For example, trying this, while even waiting until the number = 1, which is clearly after the task is created, still gives me the undefined variable issue with the task's ID / name.
[tskLocateTruck1,vSmuggleTruck1] remoteExec ["BIS_fnc_taskSetDestination",west];
};```
does that variable exist on other clients?
Which one? the tskLocateTruck1?
whichever one it complains about
Oh, it's saying tskLocateTruck1 is an undefined variable
Well, the server creates the task, I'm assuming globally, or at least on the west side.
I'm assuming globally,
The task is created when the previous task's objective is complete, which is done via a trigger and a sync.
Oh, I didn't know that.
Right. So I'm not sure where to go from here, outside of trying to get the task to be declared globally, or scrapping it all together.
Man, I don't get why I can get a marker and shit to follow a target at intervals so easily, but a task? Nope.
because you dont have the string that is the task everywhere
markers are global so theyre everywhere, tasks not nevessarily so
thats why its a bit more involved
For yourself, draw out the workflow, what functions you call, what you execute, what variables are set in a very global manner so you have your structure clear
youre getting bogged down in minor details struggling to solve an error that likely can be avoided if you have a clearer picture
Yeah, for something that I think should be so simple.
Its simple when you wrap your head around it
but theres a level of understanding needed and just drawing / writing the structure out might help you with that
I'm not even sure where to start with that.
I mean, the system I was trying to implement isn't evne necessary.
It was just something I wanted because I figured it would flow better / look nicer.
yea so go for it man, youll end up learning something from it too
Maybe another day. I'm a little too tired I think. But thanks for the help though.
np
When using the foreach command on an array? What do I put in the array so it will be used on my entire squad?
eg _myArray = [?];
_myArray = units player;
I want it to be used on multiple AI groups using this to call on the script
null=group this execvm "charge.sqf";
Are you sure that will work?
That will not work, that returns the player's current squad.
even if i use it on AI controlled squads?
Is it possible to set the frame color of a RscEdit control? Or do I need to just get rid of its frame and add my own RscFrame over it
@undone turret [group this] execvm "charge.sqf";
That will pass the group of the unit the script is running on to the script.
You could access that in the script by changing line 1 to
_myArray = _this select 0;
not working for me
is there a way to change the execution of the script so that I can pass the entire group into the array?
How are you starting the script in the mission?
Alrighty. The script is aimed at working on the units in the group, but the function is only passing the group itself. First put in the square brackets. Things that are inside the square brackets before the script runs are passed to the script as parameters.
null=[group this] execvm "charge.sqf";
This passes the group of the squad leader to the script. The group is its own entity, it's not an array.
You could change the script to take that group and get the units in the group.
_myArray = units _group;```
or
if you want to pass the units that make up the squad leader's group, you could use
`null=[units this] execvm "charge.sqf";`
and in the script
`_myArray = _this select 0;`
ok it works thanks
Does anyone have an idea how to reactivate the Incoming Missle Warning System of Hummingbirds?
@indigo snow After some sleep, I got it to work!
I realized I could use call BIS_fnc_taskExists to set a variable to true or false, and make it so the destination updates using call BIS_fnc_taskSetDestination only when the variable is true \o/
Thanks for all your help last night. Was downright stressful, but I'm grateful for the assistance, and for the knowledge of functions haha.
Yea no worries, its all a bit of learning, and executing stuff only on select clients isnt always trivial
And now the task icon moves and players will never know the blood sweat and tears that went into it haha
Ha, yeah, sadly. Especially when this mission will probably only be played once.
The idea was nice, and getting it into reality was fun, but how it'll play out I have no idea.
You know the trick for next mission too, now
Yeah, pretty much. Was actually using some code from a mission I made over a year ago as it was.
I actually think you helped me with that one too, if I remember correctly.
Or toy around with it, only update the icon when the vehicle passed certain checkpoints or has been spotted
I waste a lot of time in here its true
I think you helped me on Reddit actually.
But yeah, the way it is set right now is that the task destination will only update when the blufor are within range of the tracker, and only every 60 seconds.
If its player controlled, have it update everytime someone in the vehicle uses their radio (if you use acre or tfar)
Oh damn, it was two years ago you helped me. Found the thread haha.
That would be interesting, we do use TFR a lot.
I was thinking if there was any way that it would only be tracked based on the quality the short range radios would have.
But then the thought of having to figure that out hurt my head.
Sounded neat though. If you were just in range, you'd get an area marker which covers a broad range, but the more you narrow in, the smaller it becomes.
Sure, and the SF forces might be able to deploy fake beacons or destroy the listening posts
Makes sneaky missions a bit more doable for the hunters
I like bullshitting about mission ideas if you hadnt noticed
Yeah, that would be neat. I guess I probably should explain the basics of the mission. Resistance has the objective to locate and deliver two armed prowlers, containing smuggled goods to their leader, who is hidden away. They know they're being pursued, hence the armed vehicles. Two of them.
Blufor on the other hand has the objective to assassinate the leader, but they don't know where he is. They do however have trackers installed into the smuggled goods, because of received intel blah blah blah.
That's the basics of it though. It started out as a 'Prowlers vs Littlebirds' fuckfest though.
anyone know a more fancy way to get "30_0" from "30_0_23_134" without using splitString and selects? Substrings don't work either since number of digits per part is variable
Currently have the below but it feels meh..
_tmp = "30_0_23_134" splitString "_";
_tmp = format ["%1_%2", _tmp select 0, _tmp select 1];
_tmp;
_string splitString "_" select [0,2] joinString "_"
parenthesis should not be needed
oh cool totally forgot about the array "substring" like thingy select ranges ๐
thanks
Always the same number of digits?
always 4 numbers but the number of digits per number vary
@indigo snow parenthesis aren't needed but I like it more with them for clarity ๐
nice weather outside on a saturday? time to make scripts that generate csv data for excel charts and run experiments! https://media.discordapp.net/attachments/139754664768831488/346033746811551744/ss2017-08-12at04.53.44.png
What does that mean
Client groups, is that like how many groups are on the client?
also which side is fps?
and <30 client fps?
I'm a bit skeptical.
42 client fps with 100 groups of 5 at 12000 meter view distance not even cached yet. How did you test these results? @tough abyss
maybe he has like 100s players and that's the median?
100s of players? 0_0
Mad speculations, I can't think of another way to achive, what he has
No clue ๐คท
while {alive count _myArray} do {};
Guys need help using an Array as condition, What would be the syntax in the codition above using the Array as the condition in a while loop?
_myArray is all members of a squad
{alive _x} count units _myArray
keep getting error
this is my code
trying to make a charge script
where it used on the entire squad
it won't work
why?
You want your units to switch between lying down and standing up?
at the moment yes
I want it to pick a random unit out of the squad to sqwitch between going up and down
Why are you using a number return value as a condition for while ?
and can you even use special variables with while ?
not really sure, what do you mean by number return value?
Haven't really tried working on the statement of the while loop yet
trying to get the condition to work first
ok
If you still stuck after that, just ask ๐
ok, thanks
hmm
It won't work as intended
while {alive _x} do
This means it will not go to the next unti until the first one dies
I don't think that's your intent
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/addMissionEventHandler#PlayerConnected
Lads, if I was using the PlayerConnected eventhandler, and from that I wanted to get the object that the player was. How do I go about that? I can grab the uid and the name. If I were too with that uid or name, loop through allPlayers to then find out which they are? surely theres a better way?
@peak plover maybe, they seem to be randomly proning atm though
I'm currently using what sickboy suggested here https://forums.bistudio.com/forums/topic/105969-server-target-a-player-object/
but thats 7 years old now, i'd imagine some updates since then have made an easier/faster solution
@daring pawn https://community.bistudio.com/wiki/onPlayerConnected
try example 3 with
https://community.bistudio.com/wiki/addPublicVariableEventHandler
@daring pawn handleDisconnect is the only one that has a player object passed
but Nigels concept is better if it works.
I'm using this in a missionEventHandler. Trying to get the player's object when they connect/disconnect so I can save/load data I have to inidbi
while {alive _x} do {
hint "working";
_currentElement = selectRandom _myArray;
You are doing the event for a random unit from your array, while a certain unit is alive...
what is the certain unit that is alive?
forEach _myArray;
is it the enitre array?
The first unit in the list... until he dies, it will be the 2nd unit and so on
thats what I wanted
But it will run the up/down to random units until they are all dead
thats what i wanted(for now)
It's wrong. I'm having trouble explaining why...
I got hacked ._.
(units _myArray); //otherwise you're just selecting the group
already made a varible for _myArray with units in it
it's a bit slopy. why not just do
_myArray = units (group _this select 0);
ok
trying to make the AI charge, why the hell did BIS change careless behaviour to make them walk ๐ฆ
can't make the AI break combat and retreat as well because the dam AI just walk, even when set to speed full
@undone turret https://community.bistudio.com/wiki/behaviour ๐
Set them to aware if you really want to get picky
ok aware works, as it seems
Do you want them to charge or break contact?
- enableAttack false
I want them to charge
"RED" (Fire at will, engage at will)
_group1 setCombatMode "RED"
_group1 enableAttack true;
Hey, I'm sorry, but you think anyone could help me understand this? I was running my mission a few times, changing one or two things with tasks, but nothing that should have caused this, which seemingly came out of nowhere. http://i.imgur.com/BSSuo6Q.png
private _destType = call |#|compile (_logic getVariable "Destination...'
Error compile: Type Number, Expected String
File A3\modules_f\Intel\Functions\fn_moduleTaskSetDestination.sqf
[BIS_fnc_moduleTaskSetDestination.sqf], line 28```
There you go, sorry about the image before.
Ah, so nothing on my part?
Yep if it's an A3 root error then nothing on your part
Just seemed a little odd, but thank you.
best thing to do is to file an issue report in feedback.bistudio.com , yep.
Yeah, will do. Thank you.
Yep.
Well dang, that means my mission is out for now :C
Well if you send it in and have them review it, they won't ever not fix it. But it may take a while for a hotfix maybe
I actually found out what specific module that was breaking stuff.
setTaskDestination ?
Yeah, I did just add one more of those modules and sync'd it to a task module I had.
For some reason, that one specific taskDestination module broke, despite me using them elsewhere.
could be completely conditional I guess
Hello, I created a vehicle with weapons in it :
Weapon = "GroundWeaponHolder" CreateVehicle [0,0,0];
Weapon AddWeaponCargoGlobal ["srifle_LRR_SOS_F",1];
Weapon AddMagazineCargoGlobal ["7Rnd_408_Mag",3];
Weapon SetPos (GetPosATL Player);
Now i'd like to detect if the weapon is in or not. something like :
if (Weapon hasWeapon "srifle_LRR_SOS_F") then {
OR
if ("srifle_LRR_SOS_F" in Weapon) then {
But it's not working. Can someone help
Look through the page with arma commands:
https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3
You'll be interested in the commands that have Cargo in their name. For weapons it would be getWeaponCargo to return an array of all weapons in the groundweaponholder.
where do JIPs spawn if their units start in vehicles?
i.e. what happens when vehicle is destroyed
or someone occupies their seat
@indigo snow tried this but not working ether Content = getWeaponCargo Weapon;
if ("srifle_LRR_SOS_F" in Content) then {
look at the wiki page for the getWeaponCargo command, it's probably a different format than you expect
@indigo snow it returnes this : [["srifle_LRR_SOS_F"],[1]]
right so you have to select that first array inside of that array to use the in command
so something like _content = getWeaponCargo Weapon select 0
could use https://community.bistudio.com/wiki/weaponCargo instead
@indigo snow if ("srifle_LRR_SOS_F" in (Content select 0) then {
??
or use the command that Tommo linked and I forgot about
@indigo snow @delicate totem Sure but I don't understand how it works ... To me it's ... the same thing as GetWeaponCargo
look at the return value on the wiki, its a different structure
@indigo snow @delicate totem but you still have to select in the array don't you ??
no because the weapons wouldnt be in a sub array
you dont have to ping me every time btw
yeah sorry ^^ bad habit. i'll try this out
weaponcargo returns one single array of all weapons in the container. If the container had three of those weapons, it would return
["srifle_LRR_SOS_F","srifle_LRR_SOS_F","srifle_LRR_SOS_F"]
So you could skip to
("srifle_LRR_SOS_F" in (weaponCargo Weapon) then {
YEAH ! It's Working ! Thanks Guys !
hello everybody
my 1 have problem
problem: pixel photo
original : https://i.hizliresim.com/jWG8jj.jpg
How should size be?
whats the resolution of that picture?
you probably need it in size of power 2 (512, 1024, ...)
Is it possible to return the sounds a vehicle has associated with it? Cant find any config values for it. Im trying to find a sound of a vehicle which I want to use with playSound/say3D, hoping thats possible
theres a sounds subclass
You can download the samples tool from steam and look at the car sample
@indigo snow Samples tool? Not sure what tool you're referring to
in steam, go to Library > Tools > Arma 3 Samples
it contains a bunch of sample configs
Ahh yep I see ill download now and have a look
if you browse the car example, theres a sounds include file
i can see a bunch of engine noises and stuff
Alright ill see if I can see what im looking for. Trying to find the sound refuel trucks use when you refuel a vehicle with one
I doubt its possible to find out what sounds are being played at a time?
Hey guys,
Trying to figure out where I'm going wrong
I've put some script into my initserver file to add custom textures to billboards
the billboard spawns but the texture doesn't, I have the whole "cannot load texture" error
This is the script
private _signs = [
["Exile_Sign_WasteDump", [1966, 2462.09, 22.897], [0.852215, 0.523191, 0], [0, 0, 1], false, [0, "zbay.paa"]]
];
{
private _sign = (_x select 0) createVehicle (_x select 1);
_sign allowDamage false;
_sign setPosWorld (_x select 1);
_sign setVectorDirAndUp [_x select 2, _x select 3];
_sign enableSimulationGlobal (_x select 4);
_sign setVariable ["ExileIsLocked", -1, true];
_sign setObjectTextureGlobal (_x select 5);
}
forEach _signs;
The items you put in containers and your inventory are in CfgWeapons. The soldier models are in CfgVehicles. They are cross-linked with a config entry in both.
Either way, I still think it's very weird and not an optimal system
Containers and inventory doesnt justify it being called CfgWeapons in my opinion
They do. And yes, it's very convoluted which is explained, by uniforms being an afterthought in A3 from the original system (A2 and older).
Yep, still think that stuff like that should be sorted.
Maintain the code and make it up to date
Kinda late for A3.
Not like ArmA 3 is not going to run for 5 more years
You could strangle someone with a pair of pants, that's enough to call them a weapon surely
Ughh... I'm having hard time understanding preprocessor commands
dont use them
// --- SETTINGS ---
#define PLUGIN settings
#define PLUGINF(fnc) PLUGIN##_fnc_##(fnc)
#define PLUGIN_PATH #plugins\PLUGIN
#define PLUGIN_PATHF #plugins\PLUGIN##\files
#define PLUGIN_PATHFNC(fnc) #plugins\PLUGIN##\files\##fnc
#define PLUGIN_PATHS #PLUGIN_PATH##\settings.cpp
Is this in any way correct?
Sorry, but is it possible to teleport something to their starting location without markers?
Without respawning, I mean.
Yeah, should have expected that. Thank you.
How would I script custom AI to spawn with the "Spawn AI" module?
Try one of the 100 ai scripts available on biforums instead. You might find something you need faster there
Sorry, but this should work, right? I'm getting '2 elements needed, 5 provided,' which is odd, because the wiki says it supports up to 5 elements now.
titleText ["<t color='#00F700' size='5'>Green Team Scores!</t>", "PLAIN", -1, true, true];
isStructuredText (Optional): Boolean - true to switch support for Structured Text formatting. Default: false (See Example 3. Available since Arma 3 v1.73.142260)
Current version is 1.72
Oh, you're right. By the way it was written, I just assumed otherwise - thanks!
@little eagle Current version is 1.74 not 1.72
Then I guess the change didn't make it into stable for 1.74
I can try. I'm on 1.77 dev...
It's all good - if it's not in now, it doesn't really matter :D
Works on dev.
Ah, awesome. Thanks.
#define PLUGIN settings
#define PLUGINF(fnc) PLUGIN##_fnc_##(fnc)
#define PLUGIN_PATH #plugins\PLUGIN
#define PLUGIN_PATHF #plugins\PLUGIN##\files
Would this work? Because PLUGIN is not a string, will line 2-3 wrork?
So im working on this server and i have this issue come up (http://imgur.com/a/nrDU2). It causes players to spawn in the middle of no where on the map, but when they hit respawn a proper spawn menu and they can choose a spawn point
nigel that really doesnt look correct
but did you try
just push it through eliteness' linter
The what now?
you dont use ## correctly
\ already is an escape character for defines
so you dont need to ## before them, but after them
#define PLUGIN settings
#define PLUGINF(fnc) PLUGIN##_fnc_##(fnc)
// settings_fnc_(fnc)
#define PLUGIN_PATH #plugins\##PLUGIN
// "plugins\settings"
#define PLUGIN_PATHF #plugins\##PLUGIN##\files
// "plugins\settings\files
?
I assume
PLUGINF(fnc) PLUGIN##_fnc_##(fnc)< using fnc twice is also retarded btw, just use var1,var2 for input etc, im not sure how that gets resolved atm
and im not sure at all about trying to immediately stringify the entire thing with the pound sign, youd normally use a separate QUOTE macro for that
Would anyone know how to redress AI when they spawn? Since the module does not support custom spawning, I could use a script to redress the AI with the modded equipment
You have the objects, you call code on them
If you spawn them yourself eith a script just use the returned objects
Ok thanks...
#define QUOTE(var1) #var1
#define PLUGINF(var1) PLUGIN##_fnc_##var1
#define PLUGIN_PATH QUOTE(plugins\PLUGIN)
#define PLUGIN_PATHF QUOTE(plugins\##PLUGIN\files)
#define PLUGIN_PATHFNC(var1) QUOTE(plugins\##PLUGIN\files\##var1)
#define PLUGIN_PATHS QUOTE(PLUGIN_PATH##\settings.cpp)
I understand that ## adds the two on left and right together
No, I'm having trouble understanding
have you tried the first ones instead of immediately wanting them all?
I don't want to try and find a fix by bruteforce. I want to learn ๐ฆ
play around with it a bit
Alright thanks a lot
Does ## work for strings at all?
nvm.
You can merge two macros or text and a macro together
So I can't add strings
Just macro to string or macros
"a"##"b" ->> "a""b"
Very nice
would you make sure a HD call gets processed as fast as possible, and outsource non damage return related code to a separate thread (spawn), or just handle everything in one go
@velvet merlin i use spawn in my code
would
{_x disableUAVConnectability [_uav, true]} forEach allPlayers;
work globally?
if executed from one client
The wiki doesn't mention locality but I would personally assume it has local effects / arguments
(which means executing it on only one client isnt enough)
Right, ill just use my first method to disable it
@tough abyss In case the command does not only support local effects it should work yes, however chances with a command like that is slim that it would have global effects
You could just remoteExec the command and have the same effects, however that would probably affect in more overhead, but I don't think you have an option.
Well im setting a variable for the UAVOwner on serverside and i have a thread (a decent sleep to prevent lag) and just checking if they have isUavConnectable availible, i disable it then
thats how im doing it now
Ew new thread
Run it unscheduled
Performance effects
Better to run it unscheduled in something like OEF
Unless I am terminating thread after said work has been done, I always run in like OEF
So I usually have no threads running more than a couple of seconds
I.e. for waiting for confirmation from a player or w/e
@everyone So im working on a new life server and I have this issue come up (http://imgur.com/a/nrDU2). It causes players to spawn in the middle of no where on the map, but when they hit respawn a proper spawn menu appears and they can choose a spawn point
Well, that is relative @tough abyss
@tough abyss I looked into that, and it wasnt the issue
Thats why you don't do things in every frame in OEF
Depends on precision
Whatever is best for the task
Doesnt mean you have to execute everything at once
You mostly got Draw3D for visual stuff
But as I said, as long as you are not executing things in the same framecount etc etc you don't need to worry about FPS
You can change the precision to whatever you want
can anyone tell me why this script wont work?
this removeMagazinesTurret ["4Rnd_Titan_long_missiles", [0]]; this addEventHandler ["Fired", {deleteVehicle (_this select 6); _this execVM "Flak\flak.sqf";}];
Im trying to make a flak effect
flak? @tough abyss
First off, I would suggest using params instead of select for more readability
Also execVM is not to recommend, first off because it creates a new thread, and second you should store that flak.sqf in a function for easier calling.
Also you are placing this in an init of an object in editor, hence the this, yes?
@SimZor#5644 I'm going to be honest i just used someone else's script and i couldn't figure out why it didn't work and was hoping for someone to correct the script so I could use it in my mission.
@SimZor#5644 ^^
_firednear = forEach _myArray addEventHandler ["FiredNear", hint "fired near" ];
trying to use an event handler on _myArray
this is the first time i used an eventhandler
anyone tell me whats wrong with my script?
_x addeventhandler ["FiredNear", {(_this select 0) hint "fired near"}];
} forEach _myArray;```
@undone turret you need to look up the syntax for commands on the wiki, you cant just string words together and hope for the best
^
Not really, just have the wiki open and look up every command you use
@Quiksilver#5042 the precision and execution speed of OEF comes at a cost of system resources, ultimately affecting FPS Unscheduled Performance is literally the same as scheduled. It's just that scheduled scripts might get..... scheduled.
theres very little that really needs to be executed each frame ... mainly UI stuff for visual smoothness Or stuff that needs to be done right now and not in 10 minutes.
Who were you writing to?
I've seen that message but only when PMing someone
spawn your code and add a waitUntil {player isEqualTo player};
the eventHandler is run on the server in initServer however
and the inidbi addon is only run server side too
Ouhh
Okey.. uhm
waitUntil {!isNull getByUIDstuff}; ?
Could create problems though if player disconnects before that condition goes true
spawn your code and add a waitUntil {player isEqualTo player};
That always reports true, dedmen.
Should report false before postInit
Wrong.
Hmmm...
objNull isEqualTo objNull
-> true
Or you could just use any postInit script which guarantees the player exists and don't worry about it.
Yeah, resonable
I'll try waitUntil isnull on the getByUID. I've never used it before so i'mm not really certain how reliable it is
its also weird behaviour fromm the eventhandler doing things twice
I don't know why its getting that output seemingly fine first then null the second time
oops.. Thought I could replace == but yeah.. isEqualTo can copare null's
@little eagle postInit script with PlayerConnected Eventhandler on the Server?
The script in the screenshot is doomed to fail based on the first two lines. If nothing changed in the last year, PlayerConnected is executed on the server only.
Thats part of my issue. So I do need it to execute on server only, because the mod (inidbi2) runs server side to allow me to save some information. My problem is, I need the object (a player) to load it onto. And i'm struggling to work around and get that when that player connects
I think I read it wrong. The second line is pointless. The eventhandler will only ever execute on the server.
oh the isServer?
Yea I was under the impression due to what you can see in the rpt snippet that you can see it happens twice, that its happening twice somewhere on the player
You maybe added the eventhandler twice by accident. Or the player returned to lobby and picked a slot again.
Nah the eventhandler only exists once. In regards to returning to lobby, its a mission event handler, so should only be added upon mission start once? When the server runs it?
and nah the "player" is me joining the dedi server and seeing that happen
So, BIS_fnc_getUnitByUID reports null is the issue?
Correct. I'm using it, as the other method I was using to get the object of whoever the UID is, was also reporting null
// Parameters
private ["_uid"];
_uid = _this param [0, "", [""]];
// The shooter
private "_unit";
_unit = objNull;
// Go through all units and find matching UID
{
if (getPlayerUid _x == _uid) exitWith
{
_unit = _x;
};
} forEach allUnits + allDeadMen;
// Return
_unit;
^ this is the script
thats the functions code?
Yes.
well fuck thats basically what I was using as my own function previously
What you should do is use initPlayerServer.sqf event script instead of the eventhandler. initPlayerServer reports the avatar and PlayerConnected doesn't.
Oooh hey yea thats an idea
Wait... Bohemia......
They are searching for a Player by UID... And they check every AI and dead body?!
AI's don't have a UID
allPlayers
Yes. Should be
Old function?
Maybe. allPlayers was added in 1.48
@tough abyss don't get me wrong, I do use scheduled threads, however I try to use it as little as possible and not having new threads run for the whole mission.
And use OEF when applicable instead of scheduled
New "threads" actually don't hurt that much. Extremly cheap if they are sleeping via sleep/uiSleep or.. as cheap as the condition in waitUntil
I also think OEF is easier to handle, like removeMissionEventHandler when not needed etc
Pretty much the same as having a script handle, but still
The biggest difference with unscheduled is that it doesn't have the 3ms limit. Which is a safety net for all the noobs. But if you are careful about your runtime then you are just fine in unscheduled
You mean scheduled
no
unscheduled = no 3ms limit = no safety net
scheduled = 3ms limit = safety net
The "Which is a safety net" sentence can be confused to mean unscheduled.. I also saw that when writing but thought it wasn't that bad
But if you are careful about your runtime then you are just fine in unscheduled
yep
Oh I see what you mean
like as long as you don't run your unscheduled scripts longer than 3ms per frame then you don't cause any lag. Lag being what most people complain about when doing unscheduled. But if you're careful that doesn't happen. Needs more skill though.
Well I would never come close to 3ms in unscheduled
I would try to stay under 1ms
allPlayers still has this bug that it reports [] at the start of a local hosted MP game.
if (time > 20) then {allPlayers}
BIS_fnc_getUnitByUID is fine, but you could make a wrapper for caching.
Oh really, there is a BIS function for that
I made one myself
Guess I will use that from now on then
params ["_uid"];
if (isNil "commy_UnitUIDCache") then {
commy_UnitUIDCache = [] call CBA_fnc_createNamespace;
};
private _unit = commy_UnitUIDCache getVariable [_uid, objNull];
if (getPlayerUID _unit != _uid) then {
_unit = _uid call BIS_fnc_getUnitByUID;
commy_UnitUIDCache setVariable [_uid, _unit];
};
_unit
This could help if you use the function multiple times in the mission and have a large amount of units.
You can schedule all stuff that needs to finish some time in the future
You have to schedule stuff that you want to finish in the future. That is basic reality.
That cache doesn't help in willithappen's care though. Because his code executes once per player
Yes.
In willithappen's case, you don't want to use the function at all. initPlayerServer.sqf instead.
You also can run it in non scheduled environment @little eagle
But that is not required for everything
I have no idea what you're talking about.
Still no idea. Is this still about BIS_fnc_getUnitByUID?
Dedmen sent a message about scheduler
I answered
You added some random note
I sent some other stuff
Cookies!
Good idea
You tagged me...
I need some help, I'm lost with scripting and i just need someone to help me out. I don't know why but this script doesn't work: this removeMagazinesTurret ["4Rnd_Titan_long_missiles", [0]]; this addEventHandler ["Fired", {deleteVehicle (_this select 6); _this execVM "Flak\flak.sqf";}];
Im trying to make a flak effect
this removeMagazinesTurret ["4Rnd_Titan_long_missiles", [0]];
this addEventHandler ["Fired", {deleteVehicle (_this select 6); _this execVM "Flak\flak.sqf";}];
doesn't look wrong to me
what is insdie flak.sqf?
Is it there, right folder, does a systemChat work, does the projectile get deleted, what is 'doesnt work'?
What of the works is the one that doesn't? #sohfunneh
What's the beneficial thing of running code in unscheduled other than it being ran to completion in one go?
i mean thats the difference, in when it gets executed
@little eagle
I'm much closer now
0:59:39 "#1 -- B Axe 1-1:2 (MAJ Davis) REMOTE"
0:59:39 "#2 -- PMF_Player_76561198051383016"
0:59:39 "#3 -- false"
Moving my previous code to initPlayerServer and selecting the player object from there (_this select 0) I get the above output.
diag_log format ["#1 -- %1",_this select 0];
_p = format ["PMF_Player_%1",getPlayerUID (_this select 0)];
diag_log format ["#2 -- %1",_p];
PMF_DB_Players_Data = ["new","inidbi"] call OO_PDW;
["setDbName",_p] call PMF_DB_Players_Data;
_existspd = ["loadPlayer",_this select 0] call PMF_DB_Players_Data;
diag_log format ["#3 -- %1",_existspd];
if (_existspd) then {
["loadPlayer",_this select 0] call PMF_DB_Players_Data;
["clearInventory",_this select 0] call PMF_DB_Players_Data;
["loadInventory",[_p,_this select 0]] call PMF_DB_Players_Data;
};
Problem now is the existence of REMOTE. I'm curious as to why that is now part of the object information? Additionally i'm getting false when checking if the players DB exists. Although that part is probably for code34 as its his addon, unless you happen to know about OO PDW
the REMOTE probably tells you the object isnt local to the server but the players computer
Ah yes possibly
If that is the case. I'm sort of back in a similar position
Nearly worth going to write my own just using the base INIDBI2 to achieve what I want
instead of this extra script
Just need to pass and read a position and a loadout
Not sure if you'd know what I could do there about the locality @little eagle ? (also scuse my lack of Params :P)
It might be a fault of the OO PDW system, or a problem with the locality that its not correctly loading the player in a dedicated environment now
player objects are always local to the player client
its how the game works
you can run a lot of commands on them just fine
Yea you can run commands from a server onto player objects just fine ik. in this case, when the player connects, they need this to be run on them. But i'm shit out of luck having it work on dedicated at the minute
script seems to run just fine with the diag output
god knows what those functions are doing though
I'm doing quite a lot already with INIDBI2 to save some arrays and such over sessions
im not familiar at all, im just saying the script works fine
if theres issues with that framework contact the author
It doesn't seem to be the framework though, well it does, but it seems like its a locality thing
then the framework doesnt work with non-local objects? surely the author can tell you more about how it works
from a scripting perspective non-local units are just fine
(and its not really something you can influence either way)
hmm alrighty. On a similar note, lets say I created a function that ran parts of the above, can I remoteExecCall a function the client doesn't have but the server does?
no
alright. I'll try figure something out. Thanks for baring with my madness cptnnick and commy
@indigo snow It says there is no 'Flak/flak.sqf'
well then obviously the file isnt present in the mission folder
Makes sense
Cute name
(it also gives a bit more to work with than 'doesnt work')
@indigo snow Would i need a file called Flak/flak.sqf or something. I'm not that good at scripting and i don't know what to do to make this work.
well yes
the script isnt included with the game
youd have to download it and place it in your missionfolder
The REMOTE suffix in the stringified object is normal and expected. It would be worrisome if the suffix wasn't there.
@indigo snow Thanks, that is all i really need to know
it's cool
wherever you find / download that script will probably also have a quick howtouseit explanation with it
@indigo snow http://www.armaholic.com/page.php?id=28654 that is were i got the script from
see Installation / Usage:
@indigo snow I extracted the file and put it in the mission file and it doesn't work still but i no longer get the error msg
Ok. do the bullets it fires get deleted? Is it actually a tigris vehicle?
the init line bit itself is fine, and the files are in the folder, so if that doesnt work it might be with the script itself
Yes, the bullets get deleted and Yes it is a Tigris
Aight then it seems like the problem lies with the script itself. you gotta either dig through it or contact the author
alrighty
Is there a simple way to prevent an object from being added to zeus with addCuratorEditableObjects? As in something that can be placed in the object init or similar?
no
is it possible to use a string variable inside a addaction condition?
@grizzled spindle yes, but your string has to end inside the condition string.
"Strng = ''"
Etc
okay ill expand a little
_infostand addAction[_scrollText,{[_this, _x] call RRP_fnc_processAction},"",0,false,false,"", _reqItemsString];
Either has to be your double quotes "" or the single quotes ''
_reqItemsString = format ["%1 license_civ_%2 && !life_is_processing && !life_action_inUse",_reqItemsString, _x];
Change the second _reqItemsString to str _reqItemsString
There you go.
^^
so
_reqItemsString = format ["%1 license_civ_%2 && !life_is_processing && !life_action_inUse", str _reqItemsString, _x];
Wait, that is a totally different line
that one?
Yes, lgtm
Yeah not working mate
str STRING will double up the quote marks. Basically a string that contains a string. This way the string will be correctly "escaped" after put in with format
format ["%1", 0] // "0"
format ["%1", "0"] // "0"
format ["%1", str "0"] // ""0""
Sorry I think i explained my question wrong
I have my conditions in a variable because i used a forEach to build the condition. Once i have built the condition using format and put the variable into conditon it does not work
Sounds convoluted.
So why arent you using the magic variable _x ?
Can you post the full code or at the least the block?
{
private _scrollText = getText(missionConfigFile >> "ProcessAction" >> _x >> "scrollText");
private _reqItemsString = "";
private _requiredItems = getArray(missionConfigFile >> "ProcessAction" >> _x >> "MaterialsReq");
{
_reqItemsString = format ["%1 life_inv_%2 > 0 && ",_reqItemsString, _x select 0, _x select 1];
} forEach _requiredItems;
_reqItemsString = format ["%1 license_civ_%2 && !life_is_processing && !life_action_inUse",_reqItemsString, _x];
_infostand addAction["nope",{[_this, _x] call RRP_fnc_processAction},"",0,false,false,"", _reqItemsString];
} forEach _itemsToProcess;```
%1 life_inv_%2
^ this part doesn't look like it can work. The space looks wrong after the %1.
What is %1?
I did a diag_log of _reqItemString
" life_inv_cannabis > 0 && license_civ_marijuana && !life_is_processing && !life_action_inUse"
_reqItemsString is "" then
used nope to check the scrolltext
But what is the problem now?
The condition is probably false then
cursorTarget addAction["test3",{[_this, _x] call RRP_fnc_processAction},"",0,false,false,"", _test];```
it does work
which is making me thing maybe its to do with _infoStand
_infostand undefined or null in that script?
anyway to check actions on a object?
You also have to add these actions on every machine. So if this is done in a script that runs on the server only, it won't work on a dedicated client.
It has to run everywhere.
you can use a remoteExecCall addAction, and put in the condition to display it a variable that will make it unavailable later on (after activating for example)
Or just remove the isServer check or put this code before it.
it wouldnt work for jip though would it?
so lol whats the best way of making it global?
Not a server addon, but you can also use:
[object, arguments] remoteExec ["addAction"]
Yes, you can JIP remoteExec(Call)
[object, arguments] remoteExec ["addAction", 0, true]
then for JIP
awesome
ty
Will try now!
Thank you so much @little eagle @dusk sage @winter rose
apreciate it
Ugh can someone give me an opinion on
//-----------------------------------------------------------------------------
// --- SETTINGS ---
// ----------------------------------------------------------------------------
// Setting: mission_settings_cool
// Description:
// Sets the settings as cool as opposed to not cool
// Values:
// true - the setting is cool
// false - the setting is not cool
//-----------------------------------------------------------------------------
#define SETTINGS_COOL true
//-----------------------------------------------------------------------------
// --- PARAMETERS ---
// ----------------------------------------------------------------------------
// Parameter: p_settings_real
// Description:
// Will this be a real parameter?
// Values:
// 1 - True, the parameter is real
// 0 - False, the parameter is not real
//-----------------------------------------------------------------------------
#define SETTINGS_PARAM_REAL_DEFAULT 1 // Parameter default setting
//-----------------------------------------------------------------------------
Trying to think of bettter ways of doing settings
I think I'll do 1 file which defines all of these (default values) and then 2nd one where I would change them specific for the mission
waitUntil{!isNull (findDisplay 46)};
chucksays = (findDisplay 46) displayAddEventHandler ["MouseButtonDown","hint 'add';_this call S3_mouse_f;"];
(findDisplay 46) displayRemoveEventHandler ["MouseButtonDown","hint 'remove'; _this call chucksays"];
i am sorry i forgot the syntax code for discord, anyone have anyideas on how to make this work?
```sqf
code
```
waitUntil{!isNull (findDisplay 46)};
chucksays = (findDisplay 46) displayAddEventHandler ["MouseButtonDown","hint 'add';_this call S3_mouse_f;"];
(findDisplay 46) displayRemoveEventHandler ["MouseButtonDown","hint 'remove'; _this call chucksays"];
That is not how displayRemoveEventHandler works
check wiki
lol i grabbing at straws on this one now, i had a working example, twice, lost it twice, due to doing this too many hours in a row. thanks tho ๐
Try to understand what it does and then you will be able to reconstruct it yourself the next time. ๐
Also the third line looks wrong to me. Id is a number and not a string.
And chucksays appears to be the id. But it's called like it was a function...
He thinks removeEventHandler will call a script
Very weird.
Just didn't take a look at biki. that's all
Syntax:
display displayRemoveEventHandler [handler name,id]
Parameters:
display: Display -
[handler name,id]: Array -
Having two "MouseButtonDown" event handllers right after each other is weird too. Could just be one calling multiple functions.
Maybe it's supposed to be a one time fire only event handler?
It looks like he wanted a eventhandler that's fired when somebody removes the MouseButtonDown eventhandler
What he probably really wants is MouseButtonUp
Hard to tell.
i was under the impression to make it work i had to remove then point to the add,
the goal. like last week, find a way to get past the mouse button use it for something else.
at this point the couple times i did cancel the mouse, it could have been a glitch.
mousedown worked, when it worked, but for the life of me, i cant get it to cancel and call the other function , i only got it to either call the function with no cancel, or just a straight cancel.
this is all because i cannot find the action assosiated with pilot when he release missiles in manual mode, it is primary action, up until he switches to manual, then its something else, couldnt figure it out
what is "cancel"?
id like the mouse to not use its regular function, but call this function, while being a pilot in manual fire
there is a gui of sorts it could be attached to as well
so, in the two cases i did get it to work, i was able to pull trigger on wepon and have nothing happen,
You mean block the input? Disable the weapon?
We went over this already. It's not possible for helicopters in manual fire mode.
And MouseButtonDown does not overwrite the input. keyDown does. But that doesn't work for the mouse buttons. You cannot overwrite the mouse buttons in this game.
The only thing you can do is overwrite DefaultAction by using it as the shortcut for a custom action menu entry that is set to overwrite.
But that doesn't work for helis in manual fire mode and there is nothing you can do about.
like i said i may be chasing a unicorn, and the couple times it did work it could have been a glitch, dunno.
MouseButtonDown definitely cannot overwrite the weapon.
like i said, at this point, could have been a glitch, i have one measly screenshot of when it did work, and i was too tired to rember to save it in the good pile..
No repro = didn't happen.
lol like i said with the one measly screen i have of it happening, and no way to repro, it could have been a glitch. you were not here to say whether it happen or not unfortunatly
instead of doing it like this do you have a non abrasive way to prove it wont work? or why mouse events are handled differently? id rather understand than just be told it wont happen.. if you know why.. can you enlighten me?
Prove that MouseButtonDown doesn't block the input?
You could add a MouseButtonDown eventhandler, press LMB and see that it didn't block the input
There is no "why" to explain here really. Check the wiki. keyDown can block input. MouseButtonDown can't.
It's because that is how it was programmed in Czech a long time ago.
but could key down feasably block mouse, or just not possible?
damn...
i just looked
hbm2
screw ecc
No, keyDown only triggers for keyboard keys. A mouse button doesn't trigger keyDown. Therefore, keyDown cannot be used to block a mouse button.
ok, i have read things like this. im not disagree with you, but the flipside to that is, some mods to achieve freeing up the mouse button, temporarily for other things.. i find it hard to see as imposible, i dont want to use it free like this, it would in all likleyhood be attached to a gui of sorts, (the brackets on the target) in a perfect world the override would only be used if there was a locked target. no this isnt a mod, but it may be at somepoint, if its not possible to kill mouse, its incomplete.. people will use mouse, lose a missile per pull.. we are using an addaction to fire guided for now.
if we were to make it a mod would it be easier to achieve?
player addAction ["", {true}, [], -99, false, true, "DefaultAction", "commy_blockLMB"];
commy_blockLMB = true;
To me, the only thing hard to believe is, how stubborn you are about this.
So, I'm having a bit of a server issue here. If I host a file locally, or online via my PC, the scripts all run fine. However, if I put it on my friend's bought server, the isServer scripts don't initiate. Even when I export the file to MP Missions, it'll work for me, but not on the dedicated server.
Post the servers RPT fille.
File?
sorry, referring to If I host a file locally
Probably mod.
Or that
can complie used for macros?
No, preprocessFile(LineNumbers) can. And only these.
as in ```sqf
_macro = "MYMACRO" call fnc_retrive_macro;
//
#include "macrolist.cpp"
_result = compile _this;
_result
You have not understood how macros work
parsed == analyzed
So during preprocessing (cfgFunctions) it replaces MACRO with what it's defined as?
Sorry, mission file, not compiled or anything as .pbo.
I figured out the issue though.
waitUntil {!isNull player}
?
Nah, it was mostly the hint system, wasn't working because obviously the hints would only show for the server, not the players
stubborn maybe, but like i said, had i not seen it work, i probably wouldnt still be chasing .kk method does work, on ground, but as i said, the dafault action doesnt do it for a pilot, after he switched to to manual mode.
preprocessing is not compiling @peak plover
And yes. A macro is usually replaced by it's definition.
Does anyone know how to get a list of GEO lods for use in addAction?
No worries found it -
selectionNames _veh
@little eagle is this wrong?
waitUntil{!isNull (findDisplay 46)};
(findDisplay 46) displayAddEventHandler ["MouseButtonDown", "_this call fnc_mouseDown_13"];
cool
When you actually make this a mod.
Then add OFPEC tags to your global variables.
fnc_mouseDown_13
we see if we get there lol, i dont want to release something half ass, if it confusing for player or they lose missiles, right now i can work as this as a fallback, and try to get people to use the addaction, the problem with mouse is, some choppers fire doubles one will goto target and one is a flier,, most cases its not an issue but there are a few where it is
while im here i have another question we have a higly scripted ai environment, we use DOM_squad to control groups and joining groups of ai. would there be a way to get the bis group menu to work in the same way? join and command ai groups ? we set the amount of units and groups in params before mission launch
I think the command menu is all hard coded except from radio commands on 0.
i dont want to screw with the commend menu, the way our mission layout currently works is that it uses this DOM_squad scripting to allow you to group with the ai, so for example you spawn in goto crate select your class and while this menu is up press ctrl-k it allows you to join one of the groups of ai, and command them. my one big goal is to replace all older functions with newer ones that didnt exist when this template was conceived. it may not be possible with this one .. group menu (u)works, but i cannot see the existing groups of ai, to join, let alone command them
If this group menu is from the mod, then you can change it to whatever you want.
no its not a mod ,
I don't know what you are referring to then.
id like to use the dynamic group menu system as opposed to selecting groups with ctrl-k on the crate, but im not sure if that system is as flexible as required. it doesnt see the ai groups let alone let you command them.. as is anyhow
So hello once again, i try to find out more about the return array of vehicles is there a site existing explaining the returned value especially the hex one? I think its like an object id
sure was already there but it does not really explain the first number it seems diffrent every time?
first number?
https://community.bistudio.com/wiki/Dynamic_Groups
If you mean this one, UD1E, then I don't think it's flexible enough. But you can make your own menu or even amend this one if you're skilled enough.
With a mod that is.
There are no numbers in vehicles. Only objects.
[1a6f6c080# 1675075: apc_tracked_01_aa_f.p3d, 15cf3c080# 1675076: apc_tracked_01_aa_f.p3d]
Alright there you go sure there is an .p3d which is the object but i talk about the very first number
That is how these objects are represented in the gui.
There is nothing to explain. It's a unique object id
commy2 this is exactly what i wanted to hear
Don't try to use it for your scripts. You'll make a mess.
It may helps me to get further in my project . I needed an unique id for my DBs
Then use this instead:
_vehicle call BIS_fnc_netId;
we have a menu it is not a mod, it has its own gui and all of this, it is just outdated.. the more vanilla i can make things look the better, if i can replace an old function with something new and probably less taxing for server, i would lol. and as you know i like to chase unicorns.. the "template we work from has about 100 files lol, any i can remove is for the best
may be like you said just write something that works the same just looks nicer, i think DOM_squad is from a2
Anyone know how to keep a texture's aspect ratio when applying it to a button?
pretty sure the whole texture will always be on the button.
So there's no way of moving it or scaling it so it's not stretched? Right now I can't see the whole thing as it stretches out of the button.
what is faster/better design in general?
_string in ["TEXT1","TEXT2",...,"TEXTX"];
or
_string == "TEXT1" or _string == "TEXT2" or _string == "TEXTX"
(case sensitivity is ensured to be fit)
count ([_string] arrayIntersect ["a",...,"z"]) > 0
in is probably faster
but it depends if your array of "TEXT" is of knows size?
definitely in, but then it becomes case sensitive. It wasn't case sensitive with ==.
I think 2 elements should already be faster with in.
hi guys. is it possible to check which resolution lods you're on? I want certain scripts to run only on the highest res lods
but how about if (polucount < 1500) or something
impossible? no hack/workaround for this?
No @nocturne basalt
Ok
@little eagle that's how my texture looks on the button: http://i.imgur.com/eKuBwpX.png
That's how it's supposed to look: http://i.imgur.com/teoweix.png
The top left of the texture corresponds to the top left of the control etc. There is no way to scale this yourself differently.
How do people make super good looking menus with textures on their buttons then? I have just tried shrinking the texture and that just made it pixelated. It's still weirdly stretched.
Maybe your button control is not a square. Then it will be stretched.
The picture you showed doesn't resemble the texture at all. Wrong image path?
No the path is right.
It's the same texture, it's just REALLY weirdly stretched.
The left half is stretched but the right half is shrinked to fit the whole texture in.
Never seen that.
I don't understand how that happens.
After playing with the scaling of my button, the texture looks like this: http://i.imgur.com/P26dKlh.png
There's no more shrinking in the right half.
w = 0.0575 * safezoneW;
h = 0.1045 * safezoneH;
That should be square right?
That would depend on the aspect ratio of your screen and possibly UI size
Always square would be to use the same entry for w and h
Isn't the safezone 4:3 24/7?
w = 0.1045 * safezoneH;
h = 0.1045 * safezoneH;
^ this would be a square. Because w=h.
It's not the worst thing I've heard today^^ : P
Ok, I might be doing something completely stupid and please tell me I am, but that's somehow not square
w = 0.1045 * safezoneH;
h = 0.1045 * safezoneH;
Hey guys, is there an easy way to check how many times the same string is in an array?
So if "string" is in array 2 times, I wanna get that, how would I do that?
I guess I could pull out that from a array where it matches, and then count
Okay
or use CODE count ARRAY and skip a step
{_x == "string"} count ARRAY
if youre interested in pure multiples, you can also intersect the array with itself and check how much shorter it became, since arrayIntersect removes doubles
^ this requires the array to be made out of strings only.
I've tried asking the admins over at GrandTheftArma (as they have something similar to what I'm trying to achieve) and the response was negative. I'm running out of options here.
@tardy yacht what are you trying to do?
Have a button with a texture on it that's not stretched.
use the inherit ctrl from Bohemia
RscPictureKeepAspect
And then put a background on it
If that is what you want to do
I'm unsure what you mean
Then you should understand what I told you
Well that means I don't know what both of these things are.
Do you know what a ctrl is?
Or a inherit class?
You: > Yes
You: > to both
What's RscPictureKeepAspect?
Its a class Bohemia uses
Take that
Then inherit from that class to your button
And use some type like that supports actions
or ButtonClick evh
Also, a tip is not to ask communities for help, better to ask here since they will most likely not give you the answer. @tardy yacht
@rotund cypress I'll keep that in mind, but I've had help from a french server before when I asked nicely. A surprise to be sure, but a welcome one.
@rotund cypress I've been trying to use it with my button. But it doesn't seem to change anything. I'm using type = 16. Does that change anything?
@rotund cypress
class appButton : RscPictureKeepAspect {
idc = -1;
type = 16;
style = 0;
default = 0;
shadow = 0;
text = "";
x = 0.8733 * safezoneW + safezoneX;
y = 0.6015 * safezoneH + safezoneY;
w = 0.1045 * safezoneH;
h = 0.1045 * safezoneH;
animTextureNormal = "contacts.paa";
animTextureDisabled = "contacts.paa";
animTextureOver = "contacts.paa";
animTextureFocused = "contacts.paa";
animTexturePressed = "contacts.paa";
animTextureDefault = "contacts.paa";
[...]
class TextPos {
left = "0.25 * (((safezoneW / safezoneH) min 1.2) / 40)";
top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2";
right = 0.005;
bottom = 0.0;
};
class Attributes {
font = "RobotoCondensedLight";
color = "#E5E5E5";
align = "left";
shadow = "false";
};
class ShortcutPos {
left = "(6.25 * (((safezoneW / safezoneH) min 1.2) / 40)) - 0.0225 - 0.005";
top = 0.005;
w = 0.0225;
h = 0.03;
};
[...]
};
copy the class
either go into arma files
or run [] call BIS_fnc_exportGUIBaseClasses; in debug
It will be copied to your RPT
then copy that into your description.ext or something
and call it like mamie_RscPictureKeepAspect
Cant you also use copyToClipboard ?
Ehm....where to get the classes from then? ๐ค @subtle ore
That ([] call BIS_fnc_exportGUIBaseClasses;) already copies them to the clipboard.
Copied to RPT?
.rpt file that is external to the game?
Because you can just copy data to the windows clipboard without having to access the rpt.
Yeah, that makes more sense.
Either way though, you questioned cant you just use copyToClipboard
Which it already does then
Well, from what i had read so far: i didn't. so that is why i did
icic
RscPictureKeepAspect inherits RscPicture and only adds style to it. These are 0x800 + 0x10 + 0x20. If I just changed the style of my button to this line
style = 0x800 + 0x10 + 0x20
would that work?
Just copy the rscpicture class aswell
Use all classes
Just make a file with RscControls or something
include that in description.ext
done
and just add your prefix to all the shit
Need help with the whole _name = worldName script
Can someone join out TS for assistance on that? PM me if you can
@everyone
_enemyArray = [b1, b2, b3, b4, b5];
_myNearestEnemy = (_enemyArray select 0) findNearestEnemy player;
{
if((side _x == west) && (player distance _x < 100) ) exitWith {hint format["nearest enemy %1", _myNearestEnemy];};
} forEach _enemyArray;
anyone know why this is retruning <null-Object> when being executed?
Add a private
private _myNearestEnemy = (_enemyArray select 0) findNearestEnemy player;
To begin with
And are all the units in the enemy array defined?
You also might have this backwards, as you might want to define the nearest enemy player in the foreach, otherwise you will always get the nearest enemy of b1
@undone turret
yes at the moment just want the first element of the array
All the units in the array have variable names of b1, b2 ect
its still returning null object
anychose to use nearestObjects instead
is there an event for player chat/messages?
nvm figured out a way
No
So I've just started using Arrays for the first time, and while I understand very little of it, I was hoping someone here might be able to proofcheck it for me, for any mistakes or critiques. I'll give you a comparison of what it was, compared to what it is with arrays, for a better understanding of what has changed. There are still a few parts I'm rather unsure about.
Well, if anyone wants to, here is the old script https://hastebin.com/tiwujuvudu.sqf, and this is the new one https://hastebin.com/ukenerebur.sqf. I'll be going to clean up in a second, so I'll reply when I get back!
Okay, so I was able to finally test it, and after tweaking it a little, the part that I was unsure about doesn't work, and I'm not sure how to get it to work.
_x setPos (_x + "Origin"); is my main issue, where I'm trying to get it to set the position of the helo to "vHelo1Origin", which should work, but doesn't. I've tried adding vLoc = str _x and changing it to setPos(vLoc + "Origin", but that doesn't work either.
hey, quick question for anyone who knows. On the BIS wiki page for the player command (https://community.bistudio.com/wiki/player) it says this : "on dedicated server this value is null.". I was wondering if this was refering to the fact the command "player" would return null if executed on a dedicated server, or if it meant that on a dedicated server non of the player command wouldn't work on any of the clients
So if i had a function that used the command player and was executed locally on the client's computer. Would it work or not?
the command "player" would return null if executed on a dedicated server this
So if i had a function that used the command player and was executed locally on the client's computer. Would it work or not? yes it would work.
If you execute a script on a client then it is by definition not "on dedicated server"
@spice kayak _x setPos (_x + "Origin");
if _x is "vHelo1", that'll return
"vHelo1" setPos "vHelo1Origin"
(missionNamespace getVariable _x) setPos (_x + "Origin");
That looks wrong ^
But:
object setPos position
yeah
Positions don't have strings
@delicate totem what is vHelo1Origin ?
What is vHelo1 ?
That's what I think his script will do when it mashes the _x together with "Origin" which is a string.
hat won't work because setpos needs an array of coordinates to work. So you need to get it to something like
"vHelo1" setPos [x,y,z]
answer questions please
That's what I think his script will do when it mashes the _x together with "Origin" which is a string.
ah... It's not your script it's @spice kayak
Yes.
Sorry.
vHelo1 is the name of the Object.
Sorry, was still cleaning up - didn't think anyone replied.
_x setPosASL getPosASL (missionNamespace getVariable (vehicleVarName _x + "origin"));
???
The inner parenthesis are optional.
Cut down my script by, god knows how many lines.
@spice kayak What is "Origin" in your script by the way? Is it another vehicle, a marker?
vHelo1Origin is just a variable within one of the vehicles.
To mark where the vehicle spawns, basically.
Yeah.
Then you need to change the script.
Ah, that makes a lot more sense.
_x setPosASL (missionNamespace getVariable (vehicleVarName _x + "origin"));
^
And you need to change how you determine the position to getPosASL.
Ah, thanks.
You probably use getPos, but getPos and setPos work in different position formats. AGLS vs AGL
I didn't know, thank you.
with something like this, how would I add helicopters to this as well? nearestObject ("LandVehicle")
Like, nearestObject("LandVehicle" or "Helicopter") I tried 'AllVehicles,' without realizing that included Men too.
why is there https://community.bistudio.com/wiki/magazinesAllTurrets but no weaponsAllTurrets?
Luro, you can't use multiple classnames for parents in nearestObject, but you can with nearestObjects (not the S).
And I think they are sorted by distance, so you just have to add
param [0, objNull]
to the right side to get the nearest object.
feelsgood.jpg
kju,
params ["_vehicle"];
private _weaponsAllTurrets = [];
{
private _turret = _x;
{
_weaponsAllTurrets pushBack [_x, _turret];
} forEach (_vehicle weaponsTurret _turret);
} forEach ([[-1]] + allTurrets _vehicle);
_weaponsAllTurrets
I think this is the closest you can have ^
yeah. sorry was more like a little rant about the inconsistency from BI again
What do you mean? vehicles does not report persons.
AllVehicles does, doesn't it?
AllVehicles is a classname. And Land inherits from that and Man inherits from Land
What are you trying to do?
I want to respawn the closest vehicle to me, be it either a LandVehicle or a helo.
Ah, it's nearestObject again, but with multiple classes.
It was just vDestroyedVehicle = (getPos player nearestObject "LandVehicle"); to get the variable set, but because I wanted to add helicopters to that list, I got confused.
nearestObjects [origin, ["Car","Tank","Plane","Helicopter"], 50] param [0, objNull]
^ this is essentially the same, but with multiple classnames.
The reason to use nearestObjects (S) over nearestObject (no S) is, that this one supports multiple classnames. And then you select the first one, because they are sorted from closest to farthest. The 50 is just the hard coded range of nearestObject. You use param instead of select, so you can determine the default value of null (otherwise it would be undefined, nil), because the array can be empty if you stand in the desert.
@little eagle Does [] select 0; result in error and stopped execution or error and continuing execution with nil?