Jump to content
  • 0

Call script for mission spawned Trader


Sandbird

Question

I am trying to initialize a trader inside the dayz_server\missions\DayZ_Epoch_13.Tavi\mission.sqf to execute a script.

But no matter what i try in game i dont see the things that are executed.

 

For example:

	_unit_100000 = objNull;
	if (true) then
	{
		_this = createAgent ["Citizen1", [1009.66,18247.7,0.00211143], [], 0, "CAN_COLLIDE"];
		_unit_100000 = _this;
		_this setDir 270;
		_this setVehicleInit "this allowDammage false; this disableAI 'FSM'; this disableAI 'MOVE'; this disableAI 'AUTOTARGET'; this disableAI 'TARGET'; this setBehaviour 'CARELESS'; this forceSpeed 0; [this] spawn arrowAbove;";
        	_this setUnitAbility 0.60000002;
                [_this] spawn arrowAbove;
		_this allowDammage false; _this disableAI 'FSM'; _this disableAI 'MOVE'; _this disableAI 'AUTOTARGET'; _this disableAI 'TARGET'; _this setBehaviour 'CARELESS'; _this forceSpeed 0;_this enableSimulation false;
	};

Notice the [_this] spawn arrowAbove;  and [this] spawn arrowAbove;

 

Now i have a function which i shared for both client and server (cause i was frustrated since nothing worked) and inside the function arrowAbove i got:

arrowAbove = {
    private ["_player","_zOffset","_pos","_veh"];
    _player = _this select 0;
    _pos = getposATL _player;
    _zOffset = 3;
    _veh = createVehicle ["Sign_arrow_down_large_EP1", _pos, [], 0, "CAN_COLLIDE"];
    _veh setPos [(_veh select 0),(_veh select 1), (_veh select 2)+_zOffset];
};

But when i get ingame i dont see anything above the trader.

If i diag_log the values they are all correct though.

 

What is going on ?

I even tried to have the above code in a script (without the value and brackets ofc) and just do this instead:

[_this] execVM "\z\addons\dayz_server\custom\arrowAbove.sqf";

Nothing worked...I dont see anything :blink:

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
arrowAbove = {
    private ["_player","_zOffset","_pos","_veh"];
    _player = _this select 0;
    _pos = getposATL _player;
    _zOffset = 3;
    _veh = createVehicle ["Sign_arrow_down_large_EP1", _pos, [], 0, "CAN_COLLIDE"];
    _veh setPos [(_veh select 0),(_veh select 1), (_veh select 2)+_zOffset];
};

That last line, that's your issue. Your setting the vehicle's position to (_veh select n). But _veh is not an array and it only contains an object, not a position.

It should be

arrowAbove = {
    private ["_player","_zOffset","_pos","_veh"];
    _player = _this select 0;
    _pos = getposATL _player;
    _zOffset = 3;
    _veh = createVehicle ["Sign_arrow_down_large_EP1", _pos, [], 0, "CAN_COLLIDE"];
    _veh setPos [(_pos select 0),(_pos select 1), (_pos select 2)+_zOffset];
};
Link to comment
Share on other sites

  • 0

 

 

I am sorry,..i thought at 2 in the morning i could just write code without mistakes...my bad...so i doubled checked....actually this is what i have in my code....i made a mistake typing it...i should have copy/pasted it.

private ["_player","_zOffset","_pos","_veh"];
_player = _this select 0;
_pos = getpos _player;
_zOffset = 3;

_veh = createVehicle ["Sign_arrow_down_large_EP1", _pos, [], 0, "CAN_COLLIDE"];
_veh setPos [(getPos _veh select 0), (getPos _veh select 1), (getPos _veh select 2) + _zOffset];

which is basically what you got there.

 

The funny thing is that the above works fine in the editor (in my 3d.live.mission) cause well....the dayz_server and dayz_client is the same machine.

But once i put this in the real server....it must be spawning....its just that I (as a client) dont see it....but it must be spawning for the server...its as if it spawned with createvehiclelocal or something.

 

ps: notice my first post? Do i have to do it in both setVehicleInit and under it as well? I was never sure about this....just ....like ever

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...