Jump to content
Sign in to follow this  
wyattwic

Bis_fnc_MP example needed

Recommended Posts

Hello everyone!

I have been having a hard time with this one, so if someone wouldn't mind helping!

_object = createVehicle ["Sign_Sphere25cm_F", _pos, [], 0, "CAN_COLLIDE"];
_object setvehicleinit "this setObjectTexture [0,"textures\NATO V2.PAA"];
_object attachTo [_target, [0,-2,1.329]]; 
_object setVectorDirAndUp [[0,0,-1],[0,1,0]];

_target is a vehicle, _pos is defined out of view

The goal is to spawn this sphere, texture it, then position it.

I have been told that Setvehicleinit no longer works and that BIS_fnc_MP is the new replacement. I cant seem to wrap my head around it. Would someone be willing to provide me a example?

Thanks in advance!

W

Share this post


Link to post
Share on other sites

This command is obsolete:

_object setvehicleinit "this setObjectTexture [0,"textures\NATO V2.PAA"];

Use:

_object setObjectTextureGlobal [0,"textures\NATO V2.PAA"];

Untested but should work.

Share this post


Link to post
Share on other sites

You shouldnt need fn_MP here but I will answer your question with a description and example.

BIS_fnc_MP is a function used to send other functions globally to all players. If you want to take a local command, sideChat for example, and send it to everyone (definable in parameters), fn_MP is a great option.

First, lets create a function with a local command.

tag_fnc_sideChat = {
// [unit] call tag_fnc_sideChat;
_unit = _this select 0;
_unit sideChat "Message";
true;
};

Normally, you would call that with "[unit] call tag_fnc_sideChat;" but it would only display for the person who called the function. Now, we take fn_MP and run our functions through that. But first, an explanation of its parameters.

[params, functionName, target, isPersistent] spawn BIS_fnc_MP;

-params: the parameter to send the to function, in our case [unit]

-functionName: this is the name of the function in string format, "tag_fnc_sideChat"

-target: who to send the function to. It can be an object, an array, boolean, side, or owner ID number, in our example we use TRUE to send it to everyone

-isPersistant: Do we send this function to JIP players after it is called

-isCall: (optional) true if function should be called on target machine, false to spawn it [default: false]

https://community.bistudio.com/wiki/BIS_fnc_MP

Now, to call my sideChat function for everyplayer, I would use

[[unit],"tag_fnc_sideChat",true,false,false] spawn BIS_fnc_MP;

fn_MP will take my function and run it for everyone in the game.

Share this post


Link to post
Share on other sites

According to Killzone_Kid in the wiki, setObjectTextureGlobal isn't synced with JIP players, so probably it's still smarter to use BIS_fnc_MP or some other setup? Edit: Oh, I should've checked the link to the feedback tracker. It seems to be fixed, so you don't need BIS_fnc_MP for this at all. Rest of this post isn't relevant.

In this situation it would probably be best to use a function called BIS_fnc_spawn. It will allow you to pass code directly with BIS_fnc_MP:

// all this should be executed only on one client, presumably the server
_object = createVehicle ["Sign_Sphere25cm_F", _pos, [], 0, "CAN_COLLIDE"];
_object attachTo [_target, [0,-2,1.329]]; 
_object setVectorDirAndUp [[0,0,-1],[0,1,0]];
[[_object], { (_this select 0) setObjectTexture [0, "textures\NATO V2.PAA"]; }], "BIS_fnc_spawn", TRUE, TRUE] spawn BIS_fnc_MP;

The last two parameters (target and isPersistent) are best read from in the wiki.

Edited by Magirot
Removed repetition of Fight9's post

Share this post


Link to post
Share on other sites

The last two parameters (target and isPersistent) are best read from in the wiki.

The target parameter specifies who shall receive the function. If the isPersistent parameter is true it will call the function now and for every JIP player.

Share this post


Link to post
Share on other sites
The target parameter specifies who shall receive the function.

With the target as true runs on local and every other machine, using false the function runs on the server only

the target can be either a single object or an array of object names.

Edited by KevsnoTrev

Share this post


Link to post
Share on other sites

Thank you everyone! This addressed the majority of my issue, even though I did not get my whole issue in that post. Was in a bit of a rush this morning.

Given the information given on the bis_fnc_mp and the information on setobjecttextureglobal I should be able to finish this damn thing!

Share this post


Link to post
Share on other sites

Post anymore questions you have. As you can see, people here are willing to help. It's good practice for us.

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  

×