Jump to content
Sign in to follow this  
fer

F2 Mission Development Framework (BAS f for ArmA 2)

Recommended Posts

Off the top of my (sleepy) head, this thought:

You know the name of the COIN instance because you had to pass that to the F2 COIN script. The fund amount is controlled by a built-in variable called BIS_COIN_funds. It may be possible for you to write a new script which gets (and then changes) the variable BIS_COIN_funds for the COIN you named.

Share this post


Link to post
Share on other sites

Well I tried something like this

_current_money = MyCOIN getVariable "BIS_COIN_funds"

with some hint format to see what is going on and I got

["BIS_coin_0Var"] for _current_money :confused:

My plan was simply to have _current_money = _current_money + _add_money;

But I managed to "make" recalculation of funds with little "dissection" of your script:

private ["_coin","_coinOp","_coinType","_coinFunds","_str_coin","_str_coinOp"];

// ====================================================================================

// SET KEY VARIABLES
// The Construct Module Name, Construct Operator, Type of Funds and Funds amount are passed from the script call

_coin = _this select 0;
_coinOp = _this select 1;
_coinType = _this select 2;
_coinFunds = _this select 3;
_str_coin = str _coin;
_str_coinOp = str _coinOp;

if (isNull (call compile format ["%1", _coinOP]))exitWith{}; 
_coinOP = call compile format ["%1",  _coinOP]; 
if (player != _coinOp) exitWith {};

call compile format ["_coin setvariable [""BIS_COIN_funds"",[""%1Var""]];",_str_coin];
call compile format ["%1Var = _coinFunds",_str_coin];
_coin setvariable ["BIS_COIN_fundsDescription",[""]];
_coin setvariable ["BIS_COIN_areasize",[30,30]];

hint "Funds recalculated.";

which runs ok.

Thanx for help. If you could solve my problem with adding funds that would be great. Since then this works ok. At least I can force players to spend they funds before getting new one because now there is no accumulation :bounce3:

I am using your framework with my module WICT and it is working like a charm. You made my day brighter when it comes to MP and I wrote exactly that in acknowledgements.

If you have some logo besides F2 please send me, so I can put it in manual.

Now it says: powered by F2 :D

--SOLUTION FOR ADDING FUNDS--

I just reversed the process. I first took the value, then increased it and returned it to funds, here is the code for COIN_add.sqf:

private ["_coin","_coinOp","_coinType","_coinFunds","_str_coin","_str_coinOp","[color="Blue"][b]_oldFunds[/b][/color]"];

// ====================================================================================

// SET KEY VARIABLES
// The Construct Module Name, Construct Operator, Type of Funds and Funds amount are passed from the script call

_coin = _this select 0;
_coinOp = _this select 1;
_coinType = _this select 2;
_coinFunds = _this select 3;
_str_coin = str _coin;
_str_coinOp = str _coinOp;

if (isNull (call compile format ["%1", _coinOP]))exitWith{}; 
_coinOP = call compile format ["%1",  _coinOP]; 
if (player != _coinOp) exitWith {};

call compile format ["_coin setvariable [""BIS_COIN_funds"",[""%1Var""]];",_str_coin];

[color="blue"][b]_oldFunds = 0;[/b][/color]

call compile format ["[color="blue"][b]_oldFunds = 0 +[/b][/color] [color="Red"][b]%1Var",_str_coin[/b][/color]];

[color="SeaGreen"][b]_coinFunds = _coinFunds + _oldFunds;[/b][/color]

call compile format ["[color="Red"][b]%1Var[/b][/color] = [color="SeaGreen"][b]_coinFunds[/b][/color]",[color="red"][b]_str_coin[/b][/color]];
_coin setvariable ["BIS_COIN_fundsDescription",[""]];
_coin setvariable ["BIS_COIN_areasize",[30,30]];

_null = [nil,nil,rHINT,"Reward : funds added."] call RE;

I used adding to zero since it gave me scalar instead of number. This way it works without any doubt.

It uses the same call:

null = [MyCOIN,"MyEngineer",2,5000] execVM "some_mission_path\COIN_add.sqf";

This will add 5000 to funds. I suppose it should be broadcasted to all clients if it is working on dedi (so it is broadcasted to server too, for example if it is run by a trigger >>> (vehicle player) in thislist, or something else that is connected with locality in MP).

Fer you can freely put it in the in the F2 or just put a small tutorial for other people. I personally think it is important feature, e.g. for High Value Targets (HVT) etc.

--PROBLEM WITH KEYS AND RESTART---

I think I have another, little more serious problem -- when I start the game with F2 COIN and then restart it -- after that I cannot press Esc, I cannot actually press any key on keyboard, not move, not number etc. ... Only mouse is working and I have to Alt+F4 the game....

---------- Post added at 04:49 PM ---------- Previous post was at 03:39 PM ----------

I've just completely disabled these lines:

// NIGHT VISION GOGGLE TOGGLE

//player setVariable ["F_COINname", _coin];
//F_keyPressed = compile preprocessfile "f\common\F_keyPressed.sqf";
//(findDisplay 46) displaySetEventHandler ["KeyDown", "_this call F_keyPressed"];

so it is working just fine again.

Running vanilla A2 1.07.

Edited by ArmAIIholic

Share this post


Link to post
Share on other sites

One more thing I think I just found -- after respawn player is no longer sync with COIN... I am trying on LAN as host, maybe it is different on Dedi.

P.S. I even tried combination with two triggers and waiting for player after he is alive again to synchronizeObjectsAdd but I hadn't any success.

Edited by ArmAIIholic

Share this post


Link to post
Share on other sites

F2_logo_135x135.gif

New Release: F2 v2-4-2 (for OA)

Highlights

1. The F2 OA Folk build has been expanded to provide US Army and Takistani Army platoons, which means all 3 major sides are represented out of the box (with full support for loadouts, group markers etc.). Full details on the OA Folk Platoons page, and for more background you can read About the Folk Platoon concept.

2. All builds for ArmA2 have been frozen at v2-4-1.

From the ReadMe.txt file:

2-4-2 | 01 SEP 2010

Updated Kegetys Spectator Script component.

Updated Folk Platoons component (added US Army faction).

Updated Folk Platoons component (added TK Army faction).

Froze ArmA2 builds at v2-4-1.

Updated manual: Various changes (EN and RU versions).

++

@ArmAIIholic

Very glad to know you have found F2 useful for builiding WICT, as soon as I crawl out from under the work landslide I will try to have a play with it! Thank you also for your excellent work with the COIN component. Again, as soon as I have time, let's chat about updating the F2 component to take advantage of your work. Will send you a PM shortly.

Share this post


Link to post
Share on other sites

Excellent work on the new platoons in this release Fer, with all the accompanying support, etc. Much appreciated.

Share this post


Link to post
Share on other sites

-- RE-SYNC COIN SOLUTION FOR F2 --

Hey Fer and F2 users,

here is some temporary solution for re-sync COIN after the player is revived / respawned, I found it here thanx to McArcher, but I modified it a little bit, the way I felt it would work better.

I've created GameLogic object and in init line I've put this:

group_MyCOIN = createGroup west;  
"ConstructionManager" createUnit [getPos p1, group_MyCOIN, "MyCOIN = this;"]; 
MyCOIN synchronizeObjectsAdd [p1];

By the way this reference is wrong.

The code above creates a group and places Construction Manager as a unit. Be sure that you have center already created, if you don't have use this:

Side_MyCOIN = createCenter west;

Now, I've made a trigger that is called by radio and player can call it to re-sync with COIN module like this:

null = [] spawn 
{
deleteVehicle MyCOIN; 
sleep 5; 
deleteGroup group_MyCOIN; 
sleep 5; 
group_MyCOIN = createGroup west;  
"ConstructionManager" createUnit [getPos p1, group_MyCOIN, "MyCOIN = this;"]; 
MyCOIN synchronizeObjectsAdd [p1];
null = [MyCOIN,"p1",1,500] execVM "f\common\f_COINpresets.sqf";
};

This code will delete old unit "MyCOIN", then it will delete old group. And the process repeats -- creating new group and creating new unit and sync with player p1.

By empirical testings I've found that you cannot call only MyCOIN synchronizeObjectsAdd [p1]; , but it has to be connected i.e. in the same script with commands for creating group and creating unit (it is a block of commands).

Moreover, I've found that for some reason this script needs time to delete the unit and to delete the group, so 10 sec seamed reasonable and showed to be good during multiple testings.

After re-sync player will have 0 funds, therefore the last command will add some small amount.

This is not the perfect solution, but it has advantage --- it forces players to stay alive and to protect the leader, so that they don't loose funds.

I hope it will help F2 designers to come up with better solution that will be coupled with killed EH and automatic re-sync after revive / respawn. For me this script is doing a job very well.

Cheers

Edited by ArmAIIholic

Share this post


Link to post
Share on other sites

Great work, ArmAIIholic. I'm going to have to sit down and see how we can use this information in a future release of F2. Have dropped you a PM with my contact details.

Share this post


Link to post
Share on other sites

F2_logo_135x135.gif

New Release: F2 v2-4-3 (for OA)

Highlights

1. The F2 OA Folk build has been expanded to provide British Armed Forces, UN and Takistani Militia platoons (with full support for loadouts, group markers etc.). Full details on the OA Folk Platoons page, and for more background you can read About the Folk Platoon concept.

From the ReadMe.txt file:

2-4-3 | 11 SEP 2010

Updated Folk Platoons component (added UN faction).

Updated Folk Platoons component (added British Armed Forces faction).

Updated Folk Platoons component (added TK Militia faction).

Updated OA Folk Assign Gear component.

Updated OA Folk Group IDs component.

Updated OA Folk Group Markers component.

Updated manual: Various changes (EN and RU versions).

About F2

The F2 Mission Development Framework (F2) is the successor to the popular BAS f mission development framework for ArmA (discussed in this thread). The new framework contains many of the features you know from BAS f, updated to work with ArmA2 and ArmA2:OA, plus some new components which take advantage of the new game's special features.

For downloads and to find out more please see our online manual:

Huge thanks to all team members and contributors to F2 (and BAS f), as well as the testers from Shack Tactical and Folk.

Share this post


Link to post
Share on other sites

F2_logo_135x135.gif

New Release: F2 v2-4-5 (for OA)

Highlights:

1. The F2 Common Local Variables component has been fixed to pick up all vehicles in OA.

2. The Dynamic View Distance component has been fixed to work with the updated F2 Common Local Variables component.

Thank you to Megagoth1702 for reporting the bug, and to messiah for his elegant v2-4-5 fix. Thanks also to zx64 for his assistance.

From the ReadMe.txt file:

2-4-5 | 16 SEP 2010

Fixed F2 Common Local Variables component.

Fixed Dynamic View Distance component.

Updated manual: Various changes (EN and RU versions).

2-4-4 | 16 SEP 2010

Fixed F2 Common Local Variables component.

Fixed Dynamic View Distance component.

Updated manual: Various changes (EN and RU versions).

About F2

The F2 Mission Development Framework (F2) is the successor to the popular BAS f mission development framework for ArmA (discussed in this thread). The new framework contains many of the features you know from BAS f, updated to work with ArmA2 and ArmA2:OA, plus some new components which take advantage of the new game's special features.

For downloads and to find out more please see our online manual:

Huge thanks to all team members and contributors to F2 (and BAS f), as well as the testers from Shack Tactical and Folk.

Share this post


Link to post
Share on other sites

This is great, only problem is -- I don't understand anything.

I got the feeling in order to make something of this, you'd need to (in theory) be able to make something like this yourself :p

Even with the manual I got stuck on step 1½ :butbut:

Why would body removal be disabled to begin with?

And then there's the game logics. Which ones should I use?

I'm not gonna bother, I'll save myself from embarrassment and don't try giving me any answers, I won't understand anyway..

I'll just ask some clan mates who understands scripting to check this out, as I'm obviously worthless :yay:

Share this post


Link to post
Share on other sites

Body removal is probably disabled by default because it's not exactly realistic to delete bodies, but if you really want to delete bodies anyway because your mission would perform like !@#$ without deleting bodies then you have an easy option to do it.

Share this post


Link to post
Share on other sites
I got the feeling in order to make something of this, you'd need to (in theory) be able to make something like this yourself

Not quite, but to be fair F2 is not designed for absolute beginners. From the F2 wiki itself:

F2 is aimed at the new ArmA2 mission designer, although it is not intended for complete beginners. To use F2 the mission designer should have a basic understanding of:

  • How to open the MP mission editor
  • How to place and edit units, triggers, waypoints and markers in the editor
  • The ArmA2 scripting syntax (for .sqf files)
  • The roles of key files: description.ext and init.sqf
  • The role of script files (.sqf files)

If a mission designer has already created his/her first few missions, everything in F2 should be relatively straightforward. In addition, mission designers with intermediate experience may also find F2 useful as a time-saver, or as the basis for their own personal base framework(s).

Also, as galzohar correctly points out, some features are disabled by default because their use is very much a matter of taste / mission design. I hope your mission-making clan-mates find F2 useful, and sorry that it wasn't what you were looking for at this time.

Share this post


Link to post
Share on other sites

These are small snippets and modifications, and since F2 is fabulous framework, as before, I share them here.

-- Activating teleport during gameplay --

I modified f_missionMakerTeleport.sqf

// ====================================================================================

// CHECK IF COMPONENT SHOULD BE ENABLED
// We end the script if it is not running on a player's machine, or if debug mode is
// not enabled, or if the global variable f_missionMakerTeleport has not been set to 
// the value 1 in init.sqf.

if (!isDedicated) then
{
[color="blue"]if (f_missionMakerTeleport == 0) then
{
	_currentState = f_missionMakerTeleport;
	waitUntil {not(f_missionMakerTeleport == _currentState)};
	// ====================================================================================

	// SET KEY VARIABLES

	_textAction = localize "STR_f_mapClickTeleportAction";

	// ====================================================================================

	// ADD TELEPORT ACTION TO PLAYER ACTION MENU
	// Whilst the player is alive we add the teleport action to the player's action menu.
	// If the player dies we wait until he is alive again and re-add the action.

	while {true} do
	{
		F2_mapClickTeleportAction = player addaction [_textAction,"f\common\f_mapClickTeleport.sqf","", 0, false, true];
		waitUntil {!alive player};
		waitUntil {alive player};
		sleep 0.01;
	};
}[/color]
else
{

	// ====================================================================================

	// SET KEY VARIABLES

	_textAction = localize "STR_f_mapClickTeleportAction";

	// ====================================================================================

	// ADD TELEPORT ACTION TO PLAYER ACTION MENU
	// Whilst the player is alive we add the teleport action to the player's action menu.
	// If the player dies we wait until he is alive again and re-add the action.

	while {true} do
	{
		F2_mapClickTeleportAction = player addaction [_textAction,"f\common\f_mapClickTeleport.sqf","", 0, false, true];
		waitUntil {!alive player};
		waitUntil {alive player};
		sleep 0.01;
	};
};
};

if teleport is not active it waits for it to be active, then starts adding teleport actions.

-- Making HALO instead Teleport --

I used HALO snippet http://www.kylania.com/ex/

to make a HALO in f_mapClickTeleport.sqf and I changed associated text in stringtable.xml.

Here is the change in f_mapClickTeleport.sqf

titletext [_textSelect,"plain", 0.4];
[color="Blue"]onMapSingleClick "player setPos _pos; [player, 800] exec 'ca\air2\halo\data\Scripts\HALO_init.sqs';[/color] f_telePositionSelected = true";
waitUntil {f_telePositionSelected};
titletext [_textDone,"plain", 0.3];

Edited by ArmAIIholic

Share this post


Link to post
Share on other sites

Did a quick Thread Search but no joy. Was wondering if you could please advise, Fer, whether F2 OA Folk is compatible with ACE or if there are any plans to do so? Thank you for your time.

Share this post


Link to post
Share on other sites

@ ArmAIIholic - Thanks for sharing those files, as soon as I get some time to investigate them I'll look at what might be worked into a future build.

@ Swedge - F2 OA Folk is not incompatible with ACE2; however, to make use of ACE2 weapons and equipment you'd need to edit the OA Folk Assign Gear Script and replace the vanilla classes with your desired items. Similarly, if you wanted to use ACE2-specific soldier models you would need to run a search-and-replace on the mission.sqm file. I'm afraid I don't have the bandwidth to create and maintain an ACE2-optimised build of F2, but I'm always looking for volunteers ...

Share this post


Link to post
Share on other sites

been getting this error when using

myEnd = [n] execVM "f\server\f_mpEndBroadcast.sqf";

enderror.jpg

There is 4 end triggers though this one is the only one that creates this error.

the trigger is made up of

activation: none

type: end4

condition:

civs_killed_by_west > 3

on act:

myEnd = [n] execVM "f\server\f_mpEndBroadcast.sqf"; publicVariable "civs_killed_by_west";

Link to the mission in question http://forums.bistudio.com/showthread.php?t=108659

Other than this little problem, really like the F2 stuff you have done :)

Share this post


Link to post
Share on other sites

Hi anarcho, in your code you need to replace the n with a number, so the line reads something like:

myEnd = [3] execVM "f\server\f_mpEndBroadcast.sqf";

In this example, the 3 corresponds to the ending that you want to trigger (in other words: which ending text you need to display from the file briefing.html). Does that make sense?

Share this post


Link to post
Share on other sites
Hi anarcho, in your code you need to replace the n with a number, so the line reads something like:

myEnd = [3] execVM "f\server\f_mpEndBroadcast.sqf";

In this example, the 3 corresponds to the ending that you want to trigger (in other words: which ending text you need to display from the file briefing.html). Does that make sense?

lol, thx for that Fer

Share this post


Link to post
Share on other sites

Looked back at this after a long time and noticed the ShackTactical Fireteam Member Markers feature and having played with this I want to use it on some of my missions.

However, it only works if the squad leader does not die, is there a way to get this to work after respawn?

Share this post


Link to post
Share on other sites
Looked back at this after a long time and noticed the ShackTactical Fireteam Member Markers feature and having played with this I want to use it on some of my missions.

However, it only works if the squad leader does not die, is there a way to get this to work after respawn?

BearBison, assuming you're talking about this feature ...

http://www.ferstaberinde.com/f2/en/index.php?title=ShackTactical_Fireteam_Member_Markers

... you might well have a found a bug with the comments, not a shortcoming of the feature (apologies). The yellow triangles will not disappear on the death of a unit leader, as suggested by the comments in the code. Those comments are a hangover from the ShackTactical Group Markers feature, from which this is derived. So this should work with respawn missions.

Share this post


Link to post
Share on other sites

Hi Fer, yep thats the one although whilst testing on local MP (with AI squad members) it did stop working. Should get a chance to test it on my dedi later this week to see if it is different, strange either way as couldn't see anything in the code that would stop it working.

Share this post


Link to post
Share on other sites

Hmmm. I'm afraid that I'm not a player of respawn missions, so F2 is weighted towards non-respawn. However, I'm also surprised to learn that the markers stop working. Perhaps you can share your test missions with me via PM? I'd be interested to see this at first hand. Thanks!

Share this post


Link to post
Share on other sites

After a lot of playing around with this it looks like when the unit dies it's group changes to grpNull so the markers no longer work. Looks like some way of preserving the group name/id is required to keep this working but not found a way to get that working yet.

The test mission was nothing more than a simple group setup with the addditon of the latest version of Norrin's revive scripts.

Share this post


Link to post
Share on other sites

Off the top of my head (and typing on an iPhone), here's a potential hack:

Open the script which creates the markers. At the end of the code, place a sleep of about 1-3 minutes. Next, place some code which destroys the markers. Last, enclose pretty much everything in a loop of some sort.

The intent here is to reinitialise the whole feature every 1-3 minutes, which should help it cope with group members coming and going. However, you'll still need to work out how to make respawned players rejoin their original groups.

BTW, you might want to look at JIP feature in F2, which can be repurposed to let respawned players choose which group to join (and what loadout to have). Hope this helps.

Share this post


Link to post
Share on other sites

Cheers Fer, I will have a look at those and see if I can come up with a solution to the problem and post here if I manage to get it working.

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  

×