Jump to content
  • 0

How to pass params from mission.sqm to script?


Sundowner

Question

I am trying to call a generic base protection script from a sensor in mission.sqm but cannot get the params working.

 

Exerpt from mission.sqm:

// Sun base


class Item10
{
position[]={10625,30,9182};
a=50;
b=50;
activationBy="WEST";
repeating=1;
interruptable=1;
age="UNKNOWN";
name="base_generic";
expCond="(vehicle player) in thislist;";
expActiv="base_generic = ['Sun',['123456789']] execVM ""markers\base_generic.sqf"";";
expDesactiv="terminate base_generic; titleText [""You left the base."", ""PLAIN DOWN"", 5];";
class Effects{};
};

It seems expActive is not calling base_generic.sqf

 

Target sqf:

//Base Protection by Sun (based on code by ZSquad)
//private["_c","_ownerName","_owners","_owner","_visitorUID"]; //is this required?

_c = count _this;
if(_c < 1) exitWith { cutText[format["Base_Generic Error: _this params count = %1,_c],5]; };

_ownerName = _this select 0;
_owners = _this select 1;
_owner = _owners select 0;

_visitorUID = getPlayerUID player;

//Default
_canEnter = false;

titleText [format["SCANNING RETINA: %1", _ownerName], "PLAIN", 5];
sleep 5;

if (_visitorUID in _owners) then { _canEnter = true; };

// friendly to owner?
if(_visitorUID != _owner) then
{
_friendlies = _visitorUID getVariable ["friendlyTo",[]];
if(_owner in _friendlies) then {
_canEnter = true;
};
};

//Is Admin?
if (_visitorUID in FastBuilding) then { _canEnter = true; };
sleep 5;

if (_canEnter) exitWith {
titleText [format ["Access Granted: %1", name player], "PLAIN", 10];
};

// Access denied to all others
titleText ["RESTRICTED AREA - NO ACCESS!", "PLAIN", 5];
sleep 5;
titleText ["YOU HAVE 15 SECONDS TO LEAVE!", "PLAIN", 5];
sleep 5;
titleText ["YOU HAVE 10 SECONDS TO LEAVE!", "PLAIN", 5];
sleep 5;
titleText ["YOU HAVE 5 SECONDS TO LEAVE!", "PLAIN", 5];
sleep 5;
titleText ["REST IN PEACE...", "PLAIN", 5];
sleep 2;

player setPos[16492,18312,0]; // PVP Island 1

 

Thx in advance for looking at this!

Any thoughts?

 

@nedfox: folders should be correct, it's all client-side relative to root (vilayercustomcode folder). I already have working player-specific files in there.

 

The point of my efforts here is to get a generic routine working so I don't have to make a specific .sqf for every new player base with UID's etc.

 

@KiloSwiss: I have looked at triggers for other purposes but I'm not that advanced.

 

I suspect -

1/ the params need to be double or triple quoted? or

2/ the mission.sqf was never intended to pass params in this way.

 

UPDATE: At last I found the error - double quotes in the right places did it. Thx for input guys.

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Make an example mission with a trigger, using the same conditions and onAct/onDeact code (don't forget to put the script into the right folder) and try to get this running first.

Then You can implement it into Your actual epoch.<island>.pbo (and ofc also into the mission.sqm).

protip:

Use -showscripterrors and check the client RPT logfile if You experience any errors.

Greez KiloSwiss

Link to comment
Share on other sites

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
  • Advertisement
  • Discord

×
×
  • Create New...