Jump to content

Recommended Posts

Hello guys :)

 

I'm trying to add a NPC with an action (scroll wheel), but it's not working.

The NPC spawns but the addAction is not working.

 

I've tried different addAction commands on different objects but it's always failed.

//Office Guard Hire NPC
_pos = [14602.1,16773.7,5.09502];
_guardboss = createVehicle ["Exile_Guard_02", _pos, [], 0, "CAN_COLLIDE"];
_guardboss setDir 90;
_guardboss setPosATL _pos;
_guardboss allowDamage false;
_guardboss addAction ["Hint Hello!", { hint format ["Hello %1!", _this select 3] }, name player];
_guardboss disableAI "ANIM";

_guardboss disableAI "MOVE";

_guardboss disableAI "FSM";

_guardboss disableAI "AUTOTARGET";

_guardboss disableAI "TARGET";

_guardboss disableAI "CHECKVISIBLE";

_guardboss allowDamage false;
_guardboss removeAllEventHandlers "HandleDamage";
//Action
Fock_addactionMP ={
private["_object","_screenMsg","_scriptToCall"];
_object = _this select 0;
_screenMsg = _this select 1;
_scriptToCall = _this select 2;
if(isNull _object) exitWith {};
_object addaction [_screenMsg,_scriptToCall];};
[[_guardboss,"Hire Guards",""],"Fock_addactionMP",nil,false] spawn BIS_fnc_MP;

I'd apperciate it if you guys may help me!

Thank you! :)

Share this post


Link to post
Share on other sites

What isn't working, I just copied and pasted the above, the only change was "Exile_Guard_02" I don't have that unit.

 

Other than that it worked.

 

Hello  and Hire Guards action shows.

Share this post


Link to post
Share on other sites

What isn't working, I just copied and pasted the above, the only change was "Exile_Guard_02" I don't have that unit.

 

Other than that it worked.

 

Hello  and Hire Guards action shows.

Thank you for you response.

 

I checked it too outside the Exile mod and it worked.

It's maybe the place I'm putting the addAction, it's in a PBO file outside the mission folder, nothing calls it. (maybe that reason?)

I did that because there's object working, including the NPC.

Share this post


Link to post
Share on other sites

I don't really understand the last part, as far as I know it will need including in the pbo although having never used them I could be wrong.

Share this post


Link to post
Share on other sites

I don't really understand the last part, as far as I know it will need including in the pbo although having never used them I could be wrong.

I see, thank you.

Including is the only way to execute scripts outside the mission folder?

Share this post


Link to post
Share on other sites

I haven't seen it done if it exists, having said that there is a data base type utility that may store data externally.

 

Either way it's beyond my knowledge, Hope someone else can help you on this one.

 

 

 

Oh I just had a thought, it may actually be possible if it's done as an addon but I've never made any myself.

Share this post


Link to post
Share on other sites

I haven't seen it done if it exists, having said that there is a data base type utility that may store data externally.

 

Either way it's beyond my knowledge, Hope someone else can help you on this one.

 

 

 

Oh I just had a thought, it may actually be possible if it's done as an addon but I've never made any myself.

I see, Thank you for your help :)

 

I'd apperciate it if you know and may to help me to excute the command inside the mission file.

Share this post


Link to post
Share on other sites

if you place the code or add it to an existing init.sqf file that may work.

Share this post


Link to post
Share on other sites

if you place the code or add it to an existing init.sqf file that may work.

Thank you, it worked :)

Share this post


Link to post
Share on other sites

PBOs must be in an addon. You cannot have it outside the mission file. Its a lot more effort that way if its mission specific scripts.

Share this post


Link to post
Share on other sites

I see, thank you.

Including is the only way to execute scripts outside the mission folder?

If you are using execVM you can run scripts that are in the Arma 3 steam folder by putting a \ in front

[] execVM "\myScript.sqf";

No idea if this still works

Share this post


Link to post
Share on other sites

If you are using execVM you can run scripts that are in the Arma 3 steam folder by putting a \ in front

[] execVM "\myScript.sqf";

No idea if this still works

Thanks :)

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

×