Jump to content
uncookedzebra

Woah Woah Woah BI. Trying to sneak one in?

Recommended Posts

Thanks man worked perfectly  :)

Share this post


Link to post
Share on other sites

This is probably a dumb question, but does anyone know how (if it's possible) to restrict this function so that only a certain side can access the action, i.e. east or west? I know it can be done for addactions but am unsure of how to do it for holdactions. I'm working on a few TvT missions and would love to use holdactions, but I don't want defenders to be able to complete the attacking team's objectives.

 

I'd greatly appreciate any help.

Share this post


Link to post
Share on other sites
/* 4 condition to show */        "true",
This is what you are looking for. Replacing "true" with a "if the action user is side x" check and it should do the trick.
  • Like 1

Share this post


Link to post
Share on other sites

This is probably a dumb question, but does anyone know how (if it's possible) to restrict this function so that only a certain side can access the action, i.e. east or west? I know it can be done for addactions but am unsure of how to do it for holdactions. I'm working on a few TvT missions and would love to use holdactions, but I don't want defenders to be able to complete the attacking team's objectives.

 

I'd greatly appreciate any help.

/* 4 condition to show */ "west isEqualTo (side _this)"
  • Like 1

Share this post


Link to post
Share on other sites
/* 4 condition to show */ "west isEqualTo (side _this)"

 

 

This worked perfectly, thanks for the help guys!

Share this post


Link to post
Share on other sites

This worked perfectly, thanks for the help guys!

 

Better way would be to only add it to player from that side in the first place. (Given that sides don't change)

Share this post


Link to post
Share on other sites

Better way would be to only add it to player from that side in the first place. (Given that sides don't change)

 

It can be used with variable

"!(_target getVariable ['side', 'logic'] isEqualTo side _this)"

then on completion set variable "side" of caller of action

Share this post


Link to post
Share on other sites

Better way would be to only add it to player from that side in the first place. (Given that sides don't change)

 

Kill a friendly (or two), even accidentally, and your side will change to ENEMY.

Share this post


Link to post
Share on other sites

 

Demo mission

 

BIS_fnc_holdActionAdd and BIS_fnc_holdActionRemove

 

BIS_fnc_holdActionAdd:

/*
	Author: Jiri Wainar

	Description:
	Add a hold action. If the hold actions are not initialized yet, initialize the system first.

	Parameters:
	0: OBJECT - object action is attached to
	1: STRING - action title text shown in action menu
	2: STRING - idle icon shown on screen
	3: STRING - progress icon shown on screen
	4: STRING - condition for the action to be shown; special variables passed to the script code are _target (unit to which action is attached to) and _this (caller/executing unit)
	5: STRING - condition for action to progress; if false is returned action progress is halted; arguments passed into it are: _target, _caller, _id, _arguments
	6: CODE - code executed on start; arguments passed into it are [target, caller, ID, arguments]
		0: OBJECT - target (_this select 0) - the object which the action is assigned to
		1: OBJECT - caller (_this select 1) - the unit that activated the action
		3: NUMBER - ID (_this select 2) - ID of the activated action (same as ID returned by addAction)
		4: ARRAY - arguments (_this select 3) - arguments given to the script if you are using the extended syntax
	7: CODE - code executed on every progress tick; arguments [target, caller, ID, arguments, currentProgress]; max progress is always 24
	8: CODE - code executed on completion; arguments [target, caller, ID, arguments]
	9: CODE - code executed on interrupted; arguments [target, caller, ID, arguments]
	10: ARRAY - arguments passed to the scripts
	11: NUMBER - action duration; how much time it takes to complete the action
	12: NUMBER - priority; actions are arranged in descending order according to this value
	13: BOOL - remove on completion (default: true)
	14: BOOL - show in unconscious state (default: false)

	Example:
	[_target,_title,_condShow,_condProgress,_codeStart,_codeProgress,_codeCompleted,_codeInterrupted,_arguments,_duration,_priority,_removeCompleted] call bis_fnc_holdActionAdd;

	Returns:
	Action ID, can be used for removal or referencing from other functions.
*/


BIS_fnc_holdActionRemove:

/*
	Author: Jiri Wainar

	Description:
	Removes a hold action. If the removed hold actions was the last one, disable the scripted  framework.

	Parameters:
	X: OBJECT - object action is attached to
	X: NUMBER - action ID

	Example:
	[_target,_actionID] call bis_fnc_holdActionRemove;

	Returns:
	Nothing.
*/

Super thanks to zozo for pointing out where these were hiding, functions_f. :)

 

Here's a silly "practical" example, totally not using much of the features of this:

/*
init field of a phone:

null = this execVM "tickleMe.sqf";

*/
params ["_object"];

[
/* 0 object */				_object,
/* 1 action title */			"Tickle Satphone",
/* 2 idle icon */			"\a3\ui_f_exp_a\Data\RscTitles\RscEGProgress\downloadicon_ca.paa",
/* 3 progress icon */			"\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\upload_ca.paa",
/* 4 condition to show */		"true",
/* 5 condition for action */		"true",
/* 6 code executed on start */		{["Satphone", "That tickles!!"] call BIS_fnc_showSubtitle},
/* 7 code executed per tick */		{hint "Don't stop!"},
/* 8 code executed on completion */	{hint format["%1 tickled a phone!\n\n%3", name (_this select 1), _this select 3 select 0]; player setDamage 0.5;},
/* 9 code executed on interruption */	{["Satphone", "You lazy bum!"] call BIS_fnc_showSubtitle},
/* 10 arguments */			["Winnar is you!"],
/* 11 action duration */		3,
/* 12 priority */			0,
/* 13 remove on completion */		true,
/* 14 show unconscious */		false
] call bis_fnc_holdActionAdd;

I'm new to making scripts and all that, just wondering if you could perhaps explain this better for someone who is relatively new?

Share this post


Link to post
Share on other sites

This is an array that is calling a function at the end(created by bohemia). The /*comments*/ throughout it explain which each string in the array does. This particular function is a holdaction function and does the same thing as an addAction command but with holding involved. The best way to mess with it would be replacing lines in the script with something you want to do. This version of it will make you sprint.

[
/* 0 object */				player,
/* 1 action title */			"Sprint 1",
/* 2 idle icon */				"images\sprinticonA.paa",
/* 3 progress icon */			"images\sprinticonA.paa",
/* 4 condition to show */		"player getvariable [ 'Sprint', true ]",
/* 5 condition for action */		"true",
/* 6 code executed on start */		{player setAnimSpeedCoef 1},
/* 7 code executed per tick */		{
	 _progress = param[ 4 ]; //max progress is always 24
	player setAnimSpeedCoef ( linearConversion[ 0, 24, _progress, 1.5, 2 ] );
},
/* 8 code executed on completion */	{player setAnimSpeedCoef 1},
/* 9 code executed on interruption */	{player setAnimSpeedCoef 1},
/* 10 arguments */			["Sprint"],
/* 11 action duration */		6,
/* 12 priority */			0,
/* 13 remove on completion */		false,
/* 14 show unconscious */		false
] call bis_fnc_holdActionAdd;

Share this post


Link to post
Share on other sites

How do I set what object is it attached to ? 

Share this post


Link to post
Share on other sites

How do I set what object is it attached to ? 

/* 0 object */                player,

Share this post


Link to post
Share on other sites

where can i find a list of hold function icons with the correct names ? like a dial icon instead of the download icon.

 

FIXED:

 

/* 2 idle icon */ "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
/* 3 progress icon */ "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",

Share this post


Link to post
Share on other sites
/* 4 condition to show */ "west isEqualTo (side _this)"

Do I paste this to overwrite "true"',  or after it ?like "true", "west isEqualTo (side _this)", ? either way its not working for me. Iv tried it in both condition to show and condition for action, with no luck.

 

Now worries i got it working.

I did find a problem though... When I add this null = this execVM "tickleMe.sqf"; to an inventory item, the hold function is usable before you pick it up, but when you put it on the floor after storing it in your inventory, the hold function is no longer available. Any idea why this is ? 

also, would it be possible to implement altitude in to the condition ? so, you could only dial above 200m or something like that.

Share this post


Link to post
Share on other sites

Do I paste this to overwrite "true"',  or after it ?like "true", "west isEqualTo (side _this)", ? either way its not working for me. Iv tried it in both condition to show and condition for action, with no luck.

 

Replace "true" with "west isEqualTo (side _this)"

  • Like 1

Share this post


Link to post
Share on other sites

Dose any one know why my sounds wont play ?
 

params ["_object"];
publicVariable "Trigger_Con";
 
 
[
/* 0 object */ _object,
/* 1 action title */ "Call HQ Supports",
/* 2 idle icon */ "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
/* 3 progress icon */ "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
/* 4 condition to show */ "west isEqualTo (side _this)",
/* 5 condition for action */ "true",
/* 6 code executed on start */ {["Satphone", "Dialing!"] call BIS_fnc_showSubtitle, playSound3D ["\music\sound1.ogg", player], playMusic "RadioAmbient1"},
/* 7 code executed per tick */ {hint "Connecting!"},
/* 8 code executed on completion */ {hint format["%1 made contact with supports!\n\n%3", name (_this select 1), _this select 3 select 0],Trigger_Con = true;},
/* 9 code executed on interruption */ {["Satphone", "Re-Dial!"] call BIS_fnc_showSubtitle},
/* 10 arguments */ ["Connected!"],
/* 11 action duration */ 7,
/* 12 priority */ 0,
/* 13 remove on completion */ false,
/* 14 show unconscious */ false
] call bis_fnc_holdActionAdd;

Share this post


Link to post
Share on other sites

You need the absolute path to the sound file for playSound3D. Try:

format ["%1%2", [(str missionConfigFile), 0, -15] call BIS_fnc_trimString, "music\sound1.ogg"];

Instead of:

"\music\sound1.ogg"

See the notes here.

 

// Edit
Also, you're separating lines with commas instead of using semi-colons.

Share this post


Link to post
Share on other sites

 

Dose any one know why my sounds wont play ?

 

/* 6 code executed on start */ {["Satphone", "Dialing!"] call BIS_fnc_showSubtitle, playSound3D ["\music\sound1.ogg", player], playMusic "RadioAmbient1"},

 

Just catched my eye. There should be " ; ", not " , " after piece of code.

 

Fixed:

/* 6 code executed on start */ {["Satphone", "Dialing!"] call BIS_fnc_showSubtitle; playSound3D ["\music\sound1.ogg", player]; playMusic "RadioAmbient1"; },
  • Like 1

Share this post


Link to post
Share on other sites

 

Just catched my eye. There should be " ; ", not " , " after piece of code.

 

Fixed:

/* 6 code executed on start */ {["Satphone", "Dialing!"] call BIS_fnc_showSubtitle; playSound3D ["\music\sound1.ogg", player]; playMusic "RadioAmbient1"; },

I just tested it, and im still not hearing the audio. The file is being found i just cant hear it. earlier i was using Cfg Music etc, playsound "sound1" and it was failing to find the sound. eventually i found out about playsound3d and playMusic. I tried those and it stopped the missing file error, but like i say the audio isnt hearable. 

Share this post


Link to post
Share on other sites

I just tested it, and im still not hearing the audio. The file is being found i just cant hear it. earlier i was using Cfg Music etc, playsound "sound1" and it was failing to find the sound. eventually i found out about playsound3d and playMusic. I tried those and it stopped the missing file error, but like i say the audio isnt hearable. 

Look at what I posted above, 2 hours ago. It won't show a file error. Use the absolute path instead of the relative path.

  • Like 1

Share this post


Link to post
Share on other sites

Error, no sound
error.jpg
 

/* 6 code executed on start */          {["Satphone", "Dialing!"] call BIS_fnc_showSubtitle; playSound3D format ["%1%2", [(str missionConfigFile), 0, -15] call BIS_fnc_trimString, "music\sound1.ogg"]; playMusic "RadioAmbient1"; },
 

No Error, no sound.

/* 6 code executed on start */          {["Satphone", "Dialing!"] call BIS_fnc_showSubtitle; format ["%1%2", [(str missionConfigFile), 0, -15] call BIS_fnc_trimString, "music\sound1.ogg"]; playMusic "RadioAmbient1"; },

I separated my lines with semi-colons and got this error so iv switched back.
comma_error.jpg

Share this post


Link to post
Share on other sites


playSound3D [

    format ["%1%2", [(str missionConfigFile), 0, -15] call BIS_fnc_trimString, "music\sound1.ogg"],

    player

];

  • Like 1

Share this post


Link to post
Share on other sites

Thanks Hallyg
I pasted what the code you sent last night , but it still didnt work. so, I removed the semicolon and replaced it with a comma. I also had to replace the semicolon at the end of call BIS_fnc_showSubtitle. Im not sure why, but its working now.

WORKING:

/* 6 code executed on start */          {["Satphone", "Dialing!"] call BIS_fnc_showSubtitle, playSound3D [format ["%1%2", [(str missionConfigFile), 0, -15] call BIS_fnc_trimString, "music\sound1.ogg"],player]}, 

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

×