Jump to content
Sign in to follow this  
liebstpanzer

My first mission script pre-creation questions.

Recommended Posts

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.

Share this post


Link to post
Share on other sites

I'd recommend you to read Mr Murrays Editing Guide instead of any ArmA3 related guide. A3 related guides have more often than not syntax that you cannot use in ArmA2, as it's the latest iteration of the series. If you still decide to use the ArmA3 guide you mentioned, double check with this index. If a command mentioned in the guide is in there, you won't be able to use it in ArmA2.

The BIKI can answer most of your locality questions. If you have a command, for instance join, you'll see "A-G" and "E-G" at the top, aswell as a picture referencing to when this command was added. Basically, A stands for Arguments, and it can either be A-G (Global) or A-L (local). If it is A-G, you can use arguments that are not local to the machine where said command is executed. So if I'd have the soldier created on machine1, but machine2 (for whatever reasons) executes the join command, you'd be able to pull the variable of the soldier off machine1 and execute the command on machine2. A-L is the opposite, arguments have to be local to the machine executing the command.

E-G and E-L are effects. This describes if others see effects of said command. Going back to the join command, if you execute join on the server, every client will see the results, as it is global. In general, it is recommended to execute commands that have global effects on the server, and if they're local execute them on each client. (foreach playableUnits).

TL;DR - https://community.bistudio.com/wiki/Locality_in_Multiplayer

For functions check the Functions Library.

removeWeapon, removeMagazines etc are all commands you should look for on the BIKI. In general, assume that commands are written in a logical way. For example doStop tells a unit to stop, etc.

That's all I have for now, I don't really work with GUIs etc in ArmA2 as they're a bit tricky. To get you started though, look through this tutorial.

Share this post


Link to post
Share on other sites

(SOLDIER)commandMove(position Trigger_MoveHere);
hint "Successfully sent move order to unit.";

My uneducated guess is that you can't get a position from a trigger like that? Try using a gamelogic with

getPos logic_Name

or a marker with

getMarkerPos "marker_Name"

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×