Hi!
So I've been playing Arma for awhile and got used to doing stuff involving triggers and modules etc. I've only recently got into using scripts, so I'm still relatively new at this. So I started out by using the "Tent, Campfire and Sleep Script" from Rawner135. I opened it up and started messing around to see codes did what etc. To activate the action to setup the camp, he has me add the following into the unit init or the init.sqf.
player addAction ["<t color=""#F8FF24"">" +format["Set Up Camp"],"Camp_Script\spawn.sqf"];
The problem I'm facing is that I'm able to place the camp, even when I'm in a vehicle. I've tried setting up triggers, using vehicle player != player, that would remove the action while the player was in a vehicle but only resulted in the action being permanently removed or added a duplicate action. My goal is to have the action removed when a player is any vehicle and the action reinstated when the player is on foot. My mission is Co-op based (2 players only), so I understand if I would need to name each unit individually, i.e - unit1, unit2. Rawner135's script states that it is MP compatible. I just need the action removed only when in any vehicle.
I don' know if this helps but Rawner135's script consist of 2 scripts
spawn.sqf
/*
Tent and Campfire Spawn Script by Rawner135.
- spawn.sqf - (DO NOT CHANGE NAME!)
Compatible with MP and SP, but remove the addAction for "sleep.sqf", below if you want it to be MP compatible!
USAGE:
Place this into your unit's init within the editor, or into the init.sqf:
player addAction ["<t color=""#F8FF24"">" +format["Set Up Camp"],"Camp_Script\spawn.sqf"];
TERMS AND CONDITIONS:
Any changes, modifications and publications of this script by other people MUST give the author (me) credit or recognition.
If used for games, programs, etc (such as GTA), that are not made by Bohemia Interactive, is strictly Forbidden!
- CopyRight(C) Protected under the BI Community -
*/
private["_objType","_objName","_unit","_unitName","_unitDir","_unitPos","_spawnTime","_spawnDistance","_action"];
_unit = _this select 0;
_action = _this select 2;
_unit removeAction _action;
//YOU MAY CHANGE THE CLASSNAME BELOW TO SOMETHING ELSE
_objType = "Land_TentA_F";
//DO NOT CHANGE!
_unitName = name _unit;
_unitDir = direction _unit;
_unitPos = position _unit;
//YOU MAY CHANGE the 9.3 below
//Wait time till object is spawned, set 0 for instant
_spawnTime = 9.3;
//YOU MAY CHANGE THE 6 TO A DIFFERENT NUMBER (In meters)
_spawnDist = 4;
//DO NOT CHANGE
obj1 = _objType createVehicle [0,0,0];
//YOU MAY CHANGE THE ANIMATION CLASSNAME
_unit playMove "AinvPknlMstpSnonWnonDnon_medicUp3";
//DO NOT CHANGE
sleep _spawnTime;
obj1 setpos (_unit modelToWorld [0,_SpawnDist,0]);
camp1 = obj1 addAction ["<t color=""#F8FF24"">" +format["Pack Up Camp"],"Camp_Script\pack.sqf"];
//To make MP compatible, Remove the the script below!
//DO NOT CHANGE
private["_objType2","_objName2","_unit2","_unitName2","_unitDir2","_unitPos2","_spawnTime2","_spawnDistance2","_obj2"];
//YOU MAY CHANGE THE CLASSNAME
_objType2 = "Land_FirePlace_F";
//DO NOT CHANGE
_unitName2 = name _unit;
_unitDir2 = direction _unit;
_unitPos2 = position _unit;
//YOU MAY CHANGE THE 8.4 ONLY FOR THE WAIT TIME
_spawnTime2 = 8.4;
//YOU MAY CHANGE THE 2 TO YOUR DISTANCE (IN METERS)
_spawnDist2 = 2;
//DO NOT CHANGE
obj2 = _objType2 createVehicle [0,0,0];
//YOU MAY CHANGE THE ANIMATION CLASSNAME
_unit playMove "AinvPknlMstpSlayWnonDnon_medic";
//DO NOT CHANGE
sleep _spawnTime2;
obj2 setpos (_unit modelToWorld [0,_SpawnDist2,0]);
and pack.sqf
/*
Tent and Campfire Pack Script by Rawner135.
- pack.sqf - (DO NOT CHANGE NAME!)
USAGE:
Place this into your unit's init within the editor, or into the init.sqf:
player addAction ["<t color=""#F8FF24"">" +format["Set Up Camp"],"Camp_Script\spawn.sqf"];
TERMS AND CONDITIONS:
Any changes, modifications and publications of this script by other people MUST give the author (me) credit or recognition.
If used for games, programs, etc (such as GTA), that are not made by Bohemia Interactive, is strictly Forbidden!
- CopyRight(C) Protected under the BI Community -
*/
//DO NOT CHANGE
obj1 = _this select 0;
_unit = _this select 1;
_action = _this select 2;
_unit removeAction _action;
//YOU MAY CHANGE THE 8 TO YOUR LENGTH TIME OF DELETING OBJECT
_deletetime = 8;
//YOU MAY CHANGE THE ANIMATION CLASSNAME
_unit playMove "AinvPknlMstpSlayWnonDnon_medic";
//DO NOT CHANGE
sleep _deleteTime;
deleteVehicle obj1;
_unit addAction ["<t color=""#F8FF24"">" +format["Set Up Camp"],"Camp_Script\spawn.sqf"];
//DO NOT CHANGE
_obj2 = _this select 0;
_unit = _this select 1;
//YOU MAY CHANGE THE 8 TO LENGTH TIME OF OBJECT DELETION
_deletetime2 = 8;
//YOU MAY CHANGE THE ANIMATION CLASSNAME
_unit playMove "AinvPknlMstpSnonWnonDnon_medicUp3";
//DO NOT CHANGE
sleep _deleteTime2;
deleteVehicle obj2;
deleteVehicle obj3;
I did search google and forums for about 2 days and wasn't able to find anything helpful. If anyone can point me in the right direction, it would be much appreciated.
Thanks!