Jump to content


  • Content Count

  • Joined

  • Last visited

  • Medals

Everything posted by MrSherenai

  1. 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.
  2. 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.
  3. Or for the quick and dirty way createa copy of the road barrier and replace the light source class with a blinking one.
  4. 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.
  5. MrSherenai

    sqf programming beginner

    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.
  6. 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^^
  7. You may find this usefull: getMagazineCargo
  8. 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);
  9. 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.
  10. 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.
  11. MrSherenai

    Bad Vehicle Type

    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.
  12. 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.
  13. 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.
  14. 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.
  15. MrSherenai

    Endless loop problem

    Yep, you can try it out though, just let it print the amount of iterations.
  16. MrSherenai

    AI open & Close Gate?!

    You can use gate animate ["dvere1", 0]; to open a door and gate animate ["dvere1", 1]; closes it again. You may have to do a little bit of trial and error there with the exact name (dvere,dvere1,dvere2,...,etc.) or when the gate is part of a custom addon have a look inside the model.cfg for the animation name used. For hanger doors (slide doors) use vrata as animation name. This does not make the AI open the door though, you could use a trigger and a waypoint to make the AI go to the gate and then execute the animate statement on it.
  17. MrSherenai

    Endless loop problem

    Refereing to this page: http://community.bistudio.com/wiki/Code_Optimisation the 10000 executions limit is given when the code is run non-scheduled. You can avoid this by using spawn, exec or execVM as they are creating threads within the scheduled enviroment. The tradeoff for this is a propably bigger delay between code executions in situations of high load because the script engine pauses for 0.3 ms between every execution of a script's statement within the scheduler. So for example having 30 scripts with 100 lines each loaded in the scheduler means that the scripts are rougly parsed from the top to the end every second. So having a loop in one of these scripts means that the loop can just be executed once every second.
  18. MrSherenai

    Taviana Island for ArmA 2!

    I will bring it to Martins attention. Thaks for the report :)
  19. MrSherenai

    Taviana Island for ArmA 2!

    Hey guys, I want to encourage you to report upcoming bugs and requests to the Taviana bugtracker ( https://dev-heaven.net/projects/taviana/issues ) . Most of you, if not all, know about Dev-Heaven so the advantage is quite obvious. I will upload all the backlog from this thread to it in the next days. Thanks, MrS
  20. MrSherenai

    Taviana Island for ArmA 2!

    Hey Martin, nice work, cant wait to see it finished. I would realy like to drop you a PM but your Inbox is full. Is there a chacne you can clear some space or another option to drop you a message? :P
  21. Is there a way to make this working in MP ? I can pick up my mate with the basket but when I trie to bring them in the cabin they just fall out ofthe basket :D. Okay, found it, in Getin.sqf change victim moveInCargo heli; to victim action ["getInCargo", heli]; Would you, murtoo , be fine with me editing the mod to be working on MP ?
  22. Hey, I have a little problem with my streetlamps. They emit light as they should but the bulb/lamp itself is dark. Is there any way to fix it? Here is the config I use: class CfgNonAIVehicles { access = ReadAndWrite; class StreetLamp { aggregatereflectors[] = {}; animated = 1; armorlights = 1; armorstructural = 1; brightness = 0.15; colorambient[] = {0.02, 0.02, 0.02}; colordiffuse[] = {0.9, 0.8, 0.6}; destrtype = "DestructTree"; model = ""; simulation = "StreetLamp"; class HitPoints { class HitBulb { armor = 1; material = 60; name = "lampa"; passthrough = 1; }; }; class Reflectors { class LampLight { ambient[] = {0.1, 0.1, 0.1, 1}; brightness = 0.2; color[] = {0.9, 0.8, 0.6, 1}; direction = ""; hitpoint = "lampa"; position = "Light"; selection = ""; size = 0.5; }; }; }; class StreetLamp_BaseWeakYellow : StreetLamp { colorDiffuse[] = {0.500000,0.400000,0.100000,0.000000 }; colorAmbient[] = {0.200000,0.150000,0.050000,0.000000 }; brightness = 0.100000; }; class StreetLamp_BaseMediumOrange : StreetLamp { colorDiffuse[] = {0.600000,0.350000,0.000000,0.000000 }; colorAmbient[] = {0.200000,0.100000,0.000000,0.000000 }; brightness = 0.200000; }; class StreetLamp_BaseMediumPale : StreetLamp { colorDiffuse[] = {0.600000,0.700000,0.800000,0.000000 }; colorAmbient[] = {0.060000,0.070000,0.100000,0.000000 }; brightness = 0.150000; }; class StreetLamp_BaseStrongPale : StreetLamp { colorDiffuse[] = {0.600000,0.700000,0.850000,0.000000 }; colorAmbient[] = {0.070000,0.100000,0.150000,0.000000 }; brightness = 0.330000; }; class Land_lampa_sidl : StreetLamp_BaseMediumOrange { scope = 1; model = "\ca\buildings\Misc\lampa_sidl"; }; class Land_lampa_sidl_2 : StreetLamp_BaseMediumOrange { scope = 1; model = "\ca\buildings\Misc\lampa_sidl_2"; }; class Land_lampa_sidl_3 : StreetLamp_BaseMediumOrange { scope = 1; model = "\ca\buildings\Misc\lampa_sidl_3"; }; class Land_lampa_ind : StreetLamp_BaseWeakYellow { scope = 1; model = "\ca\buildings\Misc\lampa_ind"; }; class Land_lampa_ind_zebr : StreetLamp_BaseWeakYellow { scope = 1; model = "\ca\buildings\Misc\lampa_ind_zebr"; }; }; And is there a "flicker" value or function that makes the lights flicker random? I cant find any ressource on this.
  23. MrSherenai

    Overwrite classes

    Working perfect, thank you :)
  24. Hey dudes, I' new to Arma2 scripting, so I started with analyzing existing mods to learn the basics because I cant find any good tutorials for the basics that teach the background of what is done. My first "project" is very simple I think, but I cant get it to work. So here is the situation. I want to make a fix that makes two mods compatible with each other without editing the mods itself cuz that would show lack of respect to the author IMO and I'm not sure about copyright at all. One mod overwrites some object classes, see this code: class CfgNonAIVehicles { access = 0; class StreetLamp { scope = 0; model = ""; destrType = "DestructTree"; simulation = "thing"; }; class Land_lampa_sidl: StreetLamp { scope = 1; model = "\ca\buildings\Misc\lampa_sidl"; }; class Land_lampa_sidl_2: StreetLamp { scope = 1; model = "\ca\buildings\Misc\lampa_sidl_2"; }; class Land_lampa_sidl_3: StreetLamp { scope = 1; model = "\ca\buildings\Misc\lampa_sidl_3"; }; class Land_lampa_ind: StreetLamp { scope = 1; model = "\ca\buildings\Misc\lampa_ind"; }; class Land_lampa_ind_zebr: StreetLamp { scope = 1; model = "\ca\buildings\Misc\lampa_ind_zebr"; }; }; The other mod is using the streetlamps so I wrote this to overwrite the overwritten class once again: // some basic defines #define TWest 0 #define TWest 1 #define TGuerrila 2 #define TCivilian 3 #define TSideUnknown 4 #define TEnemy 5 #define TFriendly 6 #define TLogic 7 #define true 1 #define false 0 // type scope #define private 0 #define protected 1 #define public 2 class CfgPatches { class reEnable { units[]={}; weapons[]={}; requiredAddons[]= {}; }; }; class CfgNonAIVehicles { access = ReadAndWrite; class StreetLamp { aggregatereflectors[] = {}; animated = 0; armorlights = 1; armorstructural = 1; brightness = 0.15; colorambient[] = {0.02, 0.02, 0.02}; colordiffuse[] = {0.9, 0.8, 0.6}; destrtype = "DestructTree"; model = ""; simulation = "StreetLamp"; class HitPoints { class HitBulb { armor = 1; material = 60; name = "lampa"; passthrough = 1; }; }; class Reflectors { class LampLight { ambient[] = {0.1, 0.1, 0.1, 1}; brightness = 0.2; color[] = {0.9, 0.8, 0.6, 1}; direction = ""; hitpoint = "lampa"; position = "Light"; selection = ""; size = 0.5; }; }; }; class Land_lampa_sidl : StreetLamp { scope = protected; model = "\ca\buildings\Misc\lampa_sidl"; }; class Land_lampa_sidl_2 : StreetLamp { scope = protected; model = "\ca\buildings\Misc\lampa_sidl_2"; }; class Land_lampa_sidl_3 : StreetLamp { scope = protected; model = "\ca\buildings\Misc\lampa_sidl_3"; }; class Land_lampa_ind : StreetLamp { scope = protected; model = "\ca\buildings\Misc\lampa_ind"; }; class Land_lampa_ind_zebr : StreetLamp { scope = protected; model = "\ca\buildings\Misc\lampa_ind_zebr"; }; }; As stated above this is not working at all. So, what did I do wrong? Syntax errors in the config.cpp? Do I have to find the standard config for the other lamp classes too to make them working again? (Forexample for class Land_lampa_ind_zebr ) Or is this the wrong way to solve my problem anyway? Greetings and thanks in advance