liebstpanzer
Member-
Content Count
12 -
Joined
-
Last visited
-
Medals
Everything posted by liebstpanzer
-
My first mission script pre-creation questions.
liebstpanzer replied to liebstpanzer's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
First, thank you two for replying I appreciate all of your information. tryteyker: "If it is A-G, you can use arguments that are not local to the machine where said command is executed." Sorry, I do not mean to be rude but I understand the programming concept of local and global functions. What I really meant by my questions about locality was how can I call a function and make sure that a specific player is passed through as an argument or returned as a result? I.E. A player joins the server and I want to send a message only to his client or force his client to draw a GUI menu. SavageCDN: "My uneducated guess is that you can't get a position from a trigger like that? " I am able to successfully send my commandMove or doMove to a soldier that I had placed on the map through the mission editor ONLY. Below is my real function, SOLDIER is being created while Smith was placed on the map during the mission editor: SOLDIER = "Drake" createUnit [position player, GRP]; hint "Successfully created unit."; sleep 5; (SOLDIER)commandMove(position Trigger_MoveHere); (Smith)commandMove(position Trigger_MoveHere); hint "Successfully sent move order to unit."; Also, just so there's no confusion-- Smith DOES move, SOLDIER does NOT move. -
My first mission script pre-creation questions.
liebstpanzer posted a topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Hi, I'm relatively new to the community as well as programming in SQF, but I've been coding lua for about two or three years now. I've decided to broaden my knowledge and begin working on my first mod for ArmA2. I'm almost at the end of FOCKERS CHAP2 ArmA3 scripting guide so I'm starting to get the hang of the syntax and I'm also beginning to like it as well for it's simplicity. I've read the introduction to scripting on the bistudio wiki and it had recommended that you plan out your mod and understand how you want it to function before writing it. I'm pretty handy with arrays in lua so I'm kind of excited to start a project that will make use of them in SQF. So, I'd like to take a second and describe the game play that I hope to achieve then I'll ask specific questions about what I'll need to read up on or reference to in order to successfully create this mod. If people reply and help me I'll keep this thread open with questions and problems which might come up while I write the mod. The game play mechanics for the mod I would like to implement should be similar to Warfare as I'd like to have territories in which will be captured and fought over by groups/teams. For the most simple explanation I'll say that I'll have two teams to begin with Red && Blue team. The main purpose of my modification and what I'd like to accomplish from it is a functioning economy in which money, weapons, ammo and misc items will be the core of the economy. Both teams will consist of players and NPC. Teams will also have a base inventory which will be set from game initialization, this is where teams will pull their weapons from. NPCs should have a limit to what they can grab and what they grab should make sense (I.E. If an NPC grabs a M16 with a grenade launcher he should have x amount of nato rounds and x amount of grenades.). Players should have to purchase their weapons from this inventory pool and can receive discounts for completing missions or depending on their rank. I want to make it so that there's a pool of NPCs that will be created on the map. Each Team will have an on-map and off-map list of team-mates, teams should also be able to recruit citizens from controlled areas to be in their faction. Each citizen will have a chance to either accept or decline the invitation (This chance will be affected by the teams reputation.). Team reputation will affect the teams enemies and off-map abilities(I.E. If a team is bad and kills citizens they'll be allowed to purchase weapons from a different source, this means they'll have different weapons.). Off-map resources will come in through specific areas that have ports or airfields. Teams will be able to buy resources with money and this will spawn a resource crates filled with the items or vehicles that team had ordered. The main objective of this game mod will be for teams to control the whole map or most of it for a specific amount of time. So, let me get to the point of why I posted this thread-- I need link or someone to explain to me in detail how: ArmA2 handles it's Client/Server environment, how I can add a variable related to objects, functions/methods I'd need to create GUI/Derma panels for the client, how I can safely receive messages from the client(I.E. client orders a vehicle through a GUI/Derma panel.), unit/vehicle creation, how can I add/remove items from a player/NPCs/supply boxes inventory and lastly how I can read a players/npc/supply boxes inventory. Lastly, I have a question about some code: SOLDIER = "Drake" createUnit [position player, GRP]; hint "Successfully created unit."; sleep 5; (SOLDIER)commandMove(position Trigger_MoveHere); hint "Successfully sent move order to unit."; Soldier spawns but doesn't move to Trigger_MoveHere(yes, Trigger_MoveHere exists I can only get this to work with units created through the mission editor atm.). Thank you for reading this thread and I'd appreciate your responses if you try your best to make sure your response has constructive criticism, good or bad. I'd also take suggestions if anyone has any regarding game mod mechanics that I plan to implement. -
sqf programming beginner
liebstpanzer replied to liebstpanzer's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
I'd love to start making .pbo files... but almost half of what you linked to me are 404. Does this work?: HintingPartFive = { _Arg1 = _this select 0; --Our Table _Arg2 = _this select 1; --Our Specific choice of answer in this case. _Greetings = _Arg1 select 0; --select first what greeting depending on where _val is. --I created two vars on purpose _Answers = _Arg1 select 1; --select our list of answers. _i = 0; { _i = _i + 1; --Count our possible Greetings. } foreach _Greetings; _Greeting = _Greetings select random _i - 1; _Greetings = nil; _i = 0; { _NumOQ = _i + 1; } foreach _Answers; _Answer = _Answers select random _i - 1; _Answers = nil; _filter = []; _filter set [ 0, _Greeting ]; _filter set [ 1, _Answer ]; hint _filter select 0 + _filter select 1 sleep _Arg2; }; // _LocalArray = [ --0 --1 [ ["Sup",", Hey"] ], --0 Greeting [ [", whats going on?", ", not much dog, chillin'"] ]--1 Answer ]; // for {_val = 0}, {_val <=count _LocalArray select 1}, {_val = _val} + 1 do { [_LocalArray, _val] call HintingPartFive; --I'd like some coconut. }; // ---------- Post added at 04:06 ---------- Previous post was at 03:16 ---------- I also like these tutorials but I don't really want to wait for ArmA3 right now... -
sqf programming beginner
liebstpanzer posted a topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Hi guys, I'm new to the community but not necessarily to ArmA. I used to mod the source engine and really used Garrys mod to do so, so my experience is mainly lua or GLua and I can read C++. Now I've already visited the wiki and I'm on the introduction page for scripting. I'm really here to introduce myself because i'm sure I'll have a lot of questions. If you read this thread, thankyou and if you reply, please help me out. Are there any articles you would suggest? Do you have any tips and would you like to discuss with me the limitations(what I can and cannot do.), benefits of learning this language, what tools to use(I'll be studying at work since sometimes I have free time to do so.) and what I can expect while working with this engine? One last thing, I'm really interesting in modding ontop of DayZ(i'm positive we've all heard of this mod) so if you can please let me know if it'd be possible to make code that is stand-alone AND can work WITH DayZ and what ever variables or globals it might use. Thank you. -
sqf programming beginner
liebstpanzer replied to liebstpanzer's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
okay, thanks. I'll be sure to check that out later once I get home from work. I still haven't been able to get a quick answer on how files are saved and accessed so I've pretty much been reading and studying syntax blindly... Anyways I've been trying to understand the syntax so if you could guys, please, review this code: _LocalArray = [ ["Sup" = [", so"]], ["wats going on?" = ["Not much dog , chillin'"]] ]; HintingPartFour = { _Loc = _this select 0; _Num = _this select 1; { _SelectedWord set [count _SelectedWord + 1, _x select _Num]; hint _SelectedWord; -- this should hint " , so" && "Not much dog, chillin'" how can we print "Sup" && "wats going on?" } foreach _Loc; }; // for {_val = 1}, {_val <=2}, {_val = _val} + 1 do { [_LocalArray, _val] call HintingPartFour;-- am I doing it right, sir? I haven't tested any of this yet.... }; My question now is... Is my foreach correct. Am I still calling this function correctly... is _x being used correctly and will _SelectedWord hint as well? If that's all correct, cool. I also have another question, am I able to list or select my Array keys and not just the value? In Lua tables are the same thing as an array for the most part. They were setup quite similar: local table = {}; table = {1, 2, 3} table = nil; table = {1 = 1, 2 = {}}; we could access the specific table item like this: table[1] would return 1. table[2] would return {}; We would also be able to index tables with a string: table = { ["String"] = 1, ["string"] = 2 }; table["String"] returns 1 table["string"] returns 2 -- I just wanted to show Lua is also case sensative. Now what I would want to try to do above would be like this(I'm writing it in lua to try and clarify my point for lack of a better method in SQF): local tab = {} tab["Sup"] = ", so"; tab["wats going on?"] = " Not much dog, chillin'"; for key, value in pairs(tab) do print(key..value); -- key == Sup wats going on? value == , so && Not much dog, chillin' end (This ruins our ability to keep things listed in numerical order so what you could also do with lua is this below...): tab[1] = {THIS = "string", THAT = 123}; we would access THIS && THAT like so: tab[1].THIS returns "string" tab[1].THAT returns 123 -- How can I use SQF to do this?? another thing I'm confused about. When I try to use _Array select are the first indexed values 0 or is it 1? -
sqf programming beginner
liebstpanzer replied to liebstpanzer's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
publicvariable Array = [1, 2, 3]; --Is this correct use of publicvariable? I.E. func = { _loc = _this select 0 or 1 -- okay assuming the above is correct how can I turn _this into a string. hint _loc; -- then sleep _loc -- can we turn it back into a number?? } [Array] call func -- is Array able to be used this way? -
sqf programming beginner
liebstpanzer replied to liebstpanzer's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
publicvariable Array = [1, 2, 3]; --Is this correct use of publicvariable? I.E. func = { _loc = _this select 0 or 1 -- okay assuming the above is correct how can I turn _this into a string. hint _loc; -- then sleep _loc -- can we turn it back into a number?? } Array call func -- is Array able to be used this way? -
sqf programming beginner
liebstpanzer replied to liebstpanzer's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
I'm still not sure how to save scripts in SQF format or activate them in ArmA2. Am I doing this right?: _LocalArray = ["So", "this", "is", "S", "Q", "F", "programming", "huh?", "Not", "bad!"] -- is this setup correctly HintingPartTwo = { for[ {_val = 1}, {_val <= 10}, {_val = _val + 1}] do { _SelectedWord = _LocalArray select _val; -- does this work _num = random 5 + _val + _this select 0; --would _this select 0 be "argument" hint _SelectedWord + [" we add this num for fun! --"] + _num; -- would this be the right way to add a string to this correctly? sleep _val + 1; }; }; ["argument"] call HintingPartTwo;-- am I doing it right ---------- Post added at 13:51 ---------- Previous post was at 13:47 ---------- I left some notes in the code above so for who ever replies please respond to them as well. -
sqf programming beginner
liebstpanzer replied to liebstpanzer's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
no please dont, I appreciate your advice. I really do and your new post really explains why I should start with ArmA3. The thing is... is that I dont want to wait until I am in a financial position to purchase ArmA3(school and insurance is really killing me) but I respect your opinion killzone so I think I might wait until ArmA3 if thats what you really suggest. I'll wait until then before I bump this thread and repost my questions then I guess. -
sqf programming beginner
liebstpanzer replied to liebstpanzer's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
I agree and also I'm in a budget for the next few months so I cannot afford it. Another thing is, is that I hope that within the next few months, after I upgrade my PC and purchase ArmA3, that more documentation about scripting would have been written, bugs fixed and what ever. -
sqf programming beginner
liebstpanzer replied to liebstpanzer's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Hi guys, thank you for the replies. I've been trying to take the past week and a half to read up on the wiki and I am kind of disappointed with what I've found. I mean there are a lot of good articles and things to read and I'd love to jump into the scripting but I'm a little confused as to a few things: I bought ArmA2 and ArmA2:OA through steam so the file structure is just a little different but I'm confused with it. I don't really understand functions could someone give me an example of a function(just explain a little about the structure and calling it) Can you pass arguments through a function? <- to explain this.. in Lua the way we would setup and call a function would be like so: function _ExampleFunc(arg1, arg2) local Param = arg1 .. arg2; print(Param); end _ExampleFunc("Print", "this."); --returns 'Print this.' Lastly, after I figure out the file structure play with some variables and such I'd like to start my first project. I'd love to make a script which would speed up the time of day slightly but slow down or speed up depending on the time in-game. Now I don't want to steal anyones work so if you guys can point me in the right direction(show me some utility functions or commands which actually change the time of day, some dos and don'ts when it comes to what ever I might face and just really explain the syntax I should be using). Thank you for whom ever might read this, I'd really appreciate it. :404: -
sqf programming beginner
liebstpanzer replied to liebstpanzer's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Well my question do pertain to the engine itself and not really what version of the game it is.. Are there local and global variables. In lua there are we would define a global: Var = 1; Now that Var is defined(lua is also very case sensitive) I am able to access Var throughout my mod or from two separate script files. local Var = 1; local Var is only accessible through that one script file. Do we have this type of ability in sqf? Thankyou, I was going to ask for notepad ++ syntax but you took care of that just by posting. :239: