Jump to content
Sign in to follow this  
Tomater

Scriting help

Recommended Posts

Hello!

I need help with two scripts, one for making an hint visible for all blufor units and one for making one unit invisible and not able to get damaged by enemies.

I dont really know how to write anything of both of those scripts tough i do know how to unallow damage and getting the addaction for the hint on an object, the rest i need help with.

Thank you!

Share this post


Link to post
Share on other sites

The hint i dont know, i can check it later when im home.

But to make a unit invisible you can just do

unit1 setCaptive true;

unit1 is the name of your unit that you want to make invisible

And SetCaptive is making you friendly to all sides. No one will fire upon you.

If you set it false

unit1 setCaptive false;

This unit will be as normal again. That will say the enemy will shoot on you.

Share this post


Link to post
Share on other sites

setCaptive don't make you Friendly with other factions.

When you are setCaptive true you are like not being on the map. For example a trigger that reacts on bluefor will not fire while you are a setCaptive ! But you can take damage when you get hit by a bullet or explosion.

To enter good mode ;)

unit1 allowDamage true;

is the command you need.

For the hint thing I can't help in not so far with the scripting knowledge ;)

Share this post


Link to post
Share on other sites

Thank you so much! Tough ROT with the captive thing ill actually need it as i dont even want enemy ai to react to that unit.

Share this post


Link to post
Share on other sites

For the unit that will be invisible/etc:

_unit setCaptive true; // Set unit to captive side (friendly with everyone)
_unit allowDamage false; // Disallow damage
hideObjectGlobal _unit; // Make unit invisible on all machines

For the hint:

["hint.sqf","BIS_fnc_execVM", west, false] call BIS_fnc_MP; // Call this where ever you want the hint to be triggered

hint.sqf

hint "Here's the hint message";

Hope that helps!

---------- Post added at 19:42 ---------- Previous post was at 19:39 ----------

Also note that while a unit is a captive it belongs to the civilian side, so the hint won't show up for that player.

Share this post


Link to post
Share on other sites

Thank you spike i think all answers here will be enough if not ill just come back to this thread later on today!

---------- Post added at 19:57 ---------- Previous post was at 19:21 ----------

Im sorry i dont really understand so, im trying to have an flagpole with an addaction for a checkin giving all other blufor (and civies as i also want the invisible guys to get it to) a hint on the server how would i do this?

Share this post


Link to post
Share on other sites

In your addAction you put this:

["hint.sqf","BIS_fnc_execVM", west, false] call BIS_fnc_MP; ["hint.sqf","BIS_fnc_execVM", civilian, false] call BIS_fnc_MP;

Replace hint.sqf with whatever file name you want. Then you make a file called hint.sqf in your mission folder (or whatever file name you chose) and put this inside it:

hint "Here's the hint message"; 

Replace the string with whatever message you want to be displayed.

Share this post


Link to post
Share on other sites

Will try it now thank you!

---------- Post added at 23:45 ---------- Previous post was at 23:22 ----------

this addAction ["Checkin"]; ["hint.sqf","BIS_fnc_execVM", west, false] call BIS_fnc_MP; ["hint.sqf","BIS_fnc_execVM", civilian, false] call BIS_fnc_MP;

Like that? For me im not getting any error tough im not getting the addaction up on the flagpole, oh and also what would i do if i wanted mulitple flagpoles with different hints? Im very sorry i just dont really fully get scripting yet.

Share this post


Link to post
Share on other sites

It's okay, everyone starts somewhere. Reference this page a lot. If you look at the addAction command syntax we can see that it is as follows:

unit addAction [title, script, arguments, priority, showWindow, hideOnUse, shortcut, condition, positionInModel, radius, radiusView, showIn3D, available, textDefault, textToolTip]

Now, every parameter after "script" is optional so we don't need to include those unless we need to use them. Some of the later ones aren't even applicable for ARMA. So in your case you'd put this into the flagpoles init box:

this addAction ["Check-in",{["hint.sqf","BIS_fnc_execVM", west, false] call BIS_fnc_MP; ["hint.sqf","BIS_fnc_execVM", civilian, false] call BIS_fnc_MP}];

So I'll talk through what exactly happens here to hopefully broaden your knowledge. :)

The addAction command requires input parameters (as do the majority of commands). The ones we're inputting are "unit", "title" and "script".

So for the first parameter (unit) we used this. this actually refers to the argument of the init event handler. The init box is actually an event handler which runs the code within it when the object it is assigned to is initially created. So this refers to the only argument of that event handler, which just so happens to be the object which it is assigned to. You don't need to know what an event handler is or to fully understand that right now, so long as you understand that this refers to the object the code is essentially attached to (in our case the flagpole).

The second two parameters are within an array. An array is basically just a list of data. It can contain multiple data types. In our case it includes a string and code.

The first element in the array is our string - which is the title of the action. Here the title is "Check-in". Strings are denoted using quotation marks.

The second element is our code. We can see that code is denoted using {} parentheses and that the code we want to run upon activation of the action is placed here.

I wrote this up pretty quickly so if you'd like any elaboration don't hesitate to ask.

Edited by SilentSpike

Share this post


Link to post
Share on other sites

Thank you so much for the help, and how would i do it if i wanted multiple flagpoles as an example with different hints should i make more sqf files or could i use the this select 0; this select 1; etc?

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  

×