MrSherenai
Member-
Content Count
25 -
Joined
-
Last visited
-
Medals
-
Inventory How to / Car shop?
MrSherenai replied to epicface11's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Inventory: Store the units items in an array and build a fancy GUI that displays it :). Nothing magic. Shop: Store the objects and prices availiable in an array that displays in a fancy GUI when the shop is opened. Add a "buy" button to the GUI that calls a function to reduce the players money by the items price and spawns/adds the object to the player. Pretty straight forward though if you just want the basics. But you should start with small steps as a beginner and not something like city life 2 in mind. You should write small independant functions/missions/scripts first to get used to sqf. -
Vehicle texture templates for retexturing?
MrSherenai replied to Majataka's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
I dont know what you mean by template but guessing that you want something like this . That is just not how texturing in arma2 works. For every model you create a UV map that defines where the textures out of the texture map will be applied. So all you can do is have a look at the texture file and do some trial and error to find out where the textures appear on the model. Someone who has a bit more experience with moddeling is free to bitch slap me just in case I'm telling bullshit. Just a last hint, this is one of many topics the community created tons of tutorials for. Just have a look at BIKI, OPFEC or other arma2 modding sites/communitys. For basic understanding of models, which includes texturing, I can recommend Mondkalb's Addon Tutorial. -
Road Barrier flashing Light
MrSherenai replied to Wofu's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Or for the quick and dirty way createa copy of the road barrier and replace the light source class with a blinking one. -
loadable permanent GUI?
MrSherenai replied to zapat's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
I didnt work much with GUIs yet to be honest but I would write a lightweight GUI handler FSM that listens to the variables that have to be updated and/or is suspended for a fixed amount of time. But as I said, no experience with GUIs so this is propably the worst way to do it :D. -
sqf programming beginner
MrSherenai replied to liebstpanzer's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
I would suggest not to start scripting with DayZ in mind. DayZ is pretty complex for a beginner to get used to the engine and requires at least some basic understanding about stuff like eventhandlers, functions, scopes and variables. It tends to be rather messy for a beginner to get the idea of what is going on and I can remember lots of evenings where I sat in my room thinking "how the fuck is this supposed to work" and not making any progress for hours^^. This is how I learned it and still learn: 1: This is the most important reference for all your needs and it nearly answers all your quetions, at least if you know where to search for the answer. The Community Modding Bible 2: BIKI, you can find the links to the BIKI in the link above but I assume you found it already. The BIKI features not only all the syntax with examples and detailed explanations contributed by the community and devs, it also features tons of tutorials for beginners and even advanced stuff like in depth code optimizing. You will not only find information about scripting but also config references and asset creation tutorials. 3: Learn from others. When you have a specific problem the easiest way is to search for people that made something simillar and have a look at how they solved the problem. This is no call for plagiarism but for inspiration. Getting started is the biggest problem as a beginner and this may help you with your first babysteps. And in the end you dont have to invent the wheel completly new every time. Just ensure to ask for permissions in case you want to use somebodys code or asset in your creation, dont take credits for other peoples work. 4: Ask the community. Use the forums, not only this but OPFEC, armaholic or clan forums. Get in contact with other modders. Everybody I asked about a problem I had was really helpfull. Its a great community. -
How to get the "direction" of a terrain slope
MrSherenai replied to zapat's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Nope, what you try to do there is create a vector that spans from _s to _pos and get that vectors direction. View this image as reference what the normale of a surface is: Click me! Imagine the vector returned by surfaceNormale as one of those little black arrows sticking out of a surface. You want to know the direction of the surace this little black arrow belongs to.The returned vector is normalized and just giving the 3D direction the black arrow is pointing to. If you want for example some kind of object to be 10 meters away from that surface and standing in right angle relative to the surface you can just multiply the vector returned by 10, add the position you used as input argument for surfaceNormale and use the result as position for the object. In your case all you want is to get the slopes direction what can be easily calculated out of the normale vector. Imagine a light source thats is somewhere straight over the origin of one of the black arrow. The arrow will cast a shadow similar to the one in this image (imagine the yellow arrow being the black surface normale, the shadow will be casted from the origin to the point where the blue and green dotted lines meet) Click me!. And the direction of that shadow, in the last image it is actually the bottom black dottted line, is what you want to calculate. Thus there is no need for you to struggle with positions and needless calculations, all you need is to get the angle alpha by calculating "atan(y/x) = alpha" . BIS added a function for this calculation that returns its output in degrees and thats the function atan2 I mentioned above. Be aware of that atan2 returns values ranging from -180° to 180° so if you want just positives you may have to add 360° when the angle is negative. I hope I didnt confuse you^^ -
Empty slots in magazines.
MrSherenai replied to Gonobob's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
You may find this usefull: getMagazineCargo -
How to get the "direction" of a terrain slope
MrSherenai replied to zapat's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
As the normale of a surface is always perpendicular to the surface itself you want to analyse the tilt of the normal vector. You just want it in 2D as you want to know the falling direction and not the angle. So all you need is this formula: _dir = (_s select 0) atan2 (_s select 1); -
getting info from the config and then comparing that to another object how to
MrSherenai replied to jakkob4682's topic in ARMA 2 & OA : ADDONS - Configs & Scripting
If the config path is correct yes. -
getting info from the config and then comparing that to another object how to
MrSherenai replied to jakkob4682's topic in ARMA 2 & OA : ADDONS - Configs & Scripting
For getting the screen name you can use this _dispname = getText (configFile >> "cfgVehicles" >> typeof _target >> "displayName"); with _target being the object you want the displayname of. You can use the very same method to get custom parameters you defined in the config. Lets say you made something called cfgVehicleWeight where the weight for each vehicle is stored under the same object name as in cfgVehicles and now you want the weight of your target: _weight = getText (configFile >> "cfgVehiclesWeight" >> typeof _target >> "weight"); You see it is pretty easy. You define the root with configFile and then use the >> operator to go deeper in class hierarchy until you reached the level the desired information is stored in. The datatype returned is called config. If you want an array, a number or a text just wrap your config search with one of these: getNumber(),getArray(),getText() and the return value will be casted to the given type. You can then just handle it like every other variable of the same type. -
Running into problems with for loop
MrSherenai replied to tryteyker's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Try to manually setPos the marker once created, I run into that problem once and for some odd reasons my objects got piled on the first position. -
Bad Vehicle Type
MrSherenai replied to octopos's topic in ARMA 2 & OA : ADDONS - Configs & Scripting
Not ment to sound rude but obviously not. You try to use a vehicle the engine simply does not know about, thats why you get this error. You simply CANT include any config.cpp in a mission, at least not when you want it to be broadcasted over MP. There is actually a missiontype (addon format) that allows addons to be included in the mission but those cant be downloaded in MP. While you can include some header files for dialogs for example you cant force the game to load any config related to an object. Those are loaded on gamestart, and only on gamestart. So even if you throw the config in the mission, #include it in the script or write its content in the description.ext the engine has no clue what to do with it, it simply cant process it. There is no way around dowloading an addon if you want to create new units. -
Check if vehicle's cargo indexed position is empty?
MrSherenai replied to BlenderRUS's topic in ARMA 2 & OA : ADDONS - Configs & Scripting
Then you could use the very same method to check which seats are occupied. When the UI has to be updated go through all the units inside the vehicle, get their models relative positions, compare with the seat positions and compute the free and occupied seats. -
Check if vehicle's cargo indexed position is empty?
MrSherenai replied to BlenderRUS's topic in ARMA 2 & OA : ADDONS - Configs & Scripting
How did you get the position for the UI? Did you do trial and error for the different vehicle types or did you find a way to get the position of the vehicles seats? If there is a way to get those positions you can try to use modelToWorld to get the positons of the crew and calculate the crew<->vehicle offset and then just compare those results to seat positions relative to the vehicle. -
Check if vehicle's cargo indexed position is empty?
MrSherenai replied to BlenderRUS's topic in ARMA 2 & OA : ADDONS - Configs & Scripting
I'm not complete sure about this subject, so I'm just throwing in some thoughts and hopefully you didnt try them out yet. I dont know how you handle the GUI, does it pull the data of the crew every time it is opened? Like does it check the crew every time it is opened or do you store the occupied seats in a variable that gets updated whenever a player jumps in a seat? That would be the way I would do it. Save the number of seats for the vehicle (I assume you can get them out of the config) with a bool that represents occupied or not and the object reference ( [cargo1,true,solider1]) You only have to ensure that the variables get updated like when a solider gets shot out of the vehicle, the seat is set to free again. Maybe the getOut eventhandler does trigger when a body gets thrown out of a vehicle? Or whenever the GUI gets opened you check if there are all the units inisde the car you have stored a variable for and if not check for the missing one and seit their seats as free? Another idea would be to use moveInCargo to check if the desired cargo position is availiable or not, like checking for the unit being in the vehicle afterwards or maybe it even throws an error when the desired slot is occupied.