ARZUMATA

Spawning Bike/QuadBike etc.

63 posts in this topic

So,

Users in the forum down below asked for help, so I decided to show it. Maybe you will need it too.

This is what you need if you want a player to spawn... eerr...request a bike/quad bike or any other vehicle on spawn.

mpmissions/your.pbo/init.sqf

//TO BE USED ONLY ON SERVER
if (isDedicated || isServer) then {
	"do_MakeBike" addPublicVariableEventHandler {
		_parameters = (_this select 1);
		_parameters2  =(_parameters select 1);
		diag_log format ["createVehicleRequested %1 ", _parameters]; // YOU NEED THIS FOR LOGS TO SEE WHO DID IT
		veh = createVehicle["Exile_Bike_MountainBike", _parameters2 , [] ,0 , "NONE"];
	};
};

mpmissions/your.pbo/spawn_bike.sqf (you can put it anywhere you want, just alter the path)

if !((vehicle player) isEqualTo player) exitWith {}; //MAKE SURE WE ARE ON FEET

//We check if we have money for that
if (ExileClientPlayerMoney > 500) then {
    titleText ["", "PLAIN DOWN"];
    player playActionNow "Medic"; //ANIMATED DELAY
    player removeAction DeployBikeAction; //REMOVE TO LET PLAYER SPAWN BIKES DURING THE PLAY
    _spawnPos = player modelToWorld [0,2,0];
    _spawnDir = (getDir player) -90;
    do_MakeBike = [player, _spawnPos, _spawnDir];
    ExileClientPlayerMoney = ExileClientPlayerMoney - 500; //REMOVE THE MONEY
    uiSleep 3;
    publicVariableServer "do_MakeBike"; //HEY SERVER GIVE ME A BIKE
    uiSleep 1;
    ['BIKE DEPLOYED',0,0.6,2,0] spawn bis_fnc_dynamictext;
};

 

edit config.cpp to include, you need to override default client function to add your new menu entry

class CfgExileCustomCode 
{
    	ExileClient_object_player_bambiStateBegin = "ExileClient_object_player_bambiStateBegin.sqf";
};

 

put ExileClient_object_player_bambiStateBegin.sqf from exile client to your mpmission folder and edit it

/**
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_duration"];
disableSerialization;
_duration = _this;
ExileClientPlayerIsBambi = true;
ExileClientPlayerBambiStateExpiresAt = time + _duration; 
true call ExileClient_gui_hud_toggleBambiIcon;
DeployBikeAction = player addaction [("<t color=""#00CF11"">" + ("Spawn Bike") +"</t>"),"ULTIMATUM\spawn_bike.sqf","",-97,false,false,"",""]; //THIS IS WHAT HAS BEEN ADDED
ExileClientEndBambiStateThread = [_duration, ExileClient_object_player_bambiStateEnd, [], true] call ExileClient_system_thread_addTask;
true

 

I don't take credit for this, edit as you wish.

Something like this script is used widely.

Have fun.

 

Edited by ARZUMATA
1 person likes this

Share this post


Link to post
Share on other sites

Any screenshots? BE exceptions? AH exceptions?

Edited by BIAGAMING

Share this post


Link to post
Share on other sites
Advertisement

well I have add it to my server nothing is happening... and there is no ExileClient_object_bambiStateBegin.sqf  only bambicreate.sqf

Share this post


Link to post
Share on other sites

well I have add it to my server nothing is happening... and there is no ExileClient_object_bambiStateBegin.sqf  only bambicreate.sqf

notice the ExileClient, it is part of the exile_client.pbo, so client side files not server side ones. Just copy it over to the server in the folder that you need.

Shane

Share this post


Link to post
Share on other sites

its not working. if I go dead in game  and respawn  when I landed there is nothing no scrollweelh. I have pressed every key there is on the keyboard.. so

 

Share this post


Link to post
Share on other sites

same here. Changed all the paths etc and nothing on scroll wheel.

Are we missing something?

Apologies, my mistake missing a ";" in the ExileClient_object_player_bambiStateBegin.sqf file

Edited by BaroN

Share this post


Link to post
Share on other sites

Tjappy, did you remember to change the path below where the original says "ULTIMATUM" to wherever you put you spawn_bike.sqf?

DeployBikeAction = player addaction [("<t color=""#00CF11"">" + ("Spawn Bike") +"</t>"),"ULTIMATUM\spawn_bike.sqf","",-97,false,false,"",""]; //THIS IS WHAT HAS BEEN ADDED

Hope this helps? 

Edited by BaroN

Share this post


Link to post
Share on other sites

Hi, Although the script is working, I'm finding that actual bike doesn't appear. I get the scroll wheel action, the medic action and the message that the bike has been deployed on screen but, there's no bike.

Has anyone else experienced the same?

The only thing I've changed from the original is the type of bike from "Exile_Bike_MountainBike" to "Exile_Bike_OldBike"

Incidentally you need to add this exception to your BE publicvariable.txt:

!="do_MakeBike"

 

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.