Jump to content
Sign in to follow this  
A-SUICIDAL

Teleport to Blackhawk script - fails on dedicated server

Recommended Posts

I wrote a script a long time ago and it works fine when I host from my computer, but earlier today I played my mission on somebody's dedicated server and noticed a few of my scripts in my mission were not working. There were no script errors either. This is one of the scripts...

Base flagpole:

this addaction ["Teleport to Blackhawk", "teleport_blackhawk.sqf"];

_unit = _this select 1;
if ( !alive blackhawk ) then {
   hint "The Blackhawk is currently destroyed.";
} else {
_freePosGunner = (vehicle blackhawk) emptyPositions "gunner";
_freePosCargo = (vehicle blackhawk) emptyPositions "cargo";
if (_freePosGunner > 0 and _freePosGunner < 2) then {
	_unit moveInGunner (vehicle blackhawk);
} else {
	if (_freePosCargo > 0) then {
		_unit moveInCargo (vehicle blackhawk);
	};
};
};

So my question is... what do I need to change in this script so it will work on a dedicated server? I do not have my own dedicated server to test new script changes, so I was really hoping that somebody could help me with this. Thanks.

Share this post


Link to post
Share on other sites

addaction is local command so should work as is.

Are you sure the blackhawk is named?

you could try this

if (count _this != 1) exitWith {
_caller = _this select 1;
[nil,_caller,"loc",rEXECVM,"teleport_blackhawk.sqf",_caller] call RE;
};

_unit = _this select 0;
if ( !alive blackhawk ) then {
hint "The Blackhawk is currently destroyed.";
} else {
_freePosGunner = (vehicle blackhawk) emptyPositions "gunner";
_freePosCargo = (vehicle blackhawk) emptyPositions "cargo";
if (_freePosGunner > 0 and _freePosGunner < 2) then {
	_unit moveInGunner (vehicle blackhawk);
} else {
	if (_freePosCargo > 0) then {
		_unit moveInCargo (vehicle blackhawk);
	};
};
};

need functions module on map.

also if its not working, replace call re line with this:

[nil,blackhawk,"loc",rEXECVM,"teleport_blackhawk.sqf",_caller] call RE;

Share this post


Link to post
Share on other sites

Like I said, it always worked fine when I hosted a game from my computer, and the chopper is definitely named "blackhawk". When I saw a dedicated server playing my mission and I joined - one of the first things I heard a player complain about was that he could not teleport to the Blackhawk, so I then tried to do the same and I couldn't either. Later I was able to teleport to the Blackhawk and it put me into the gunners seat, but I was not able to get out or move the gun at all. Then the pilot landed and got out of the Blackhawk and I was then stuck in his view as if I was spectating him. I couldn't understand why it was happening. I then reconnected because I didn't know what else to do. The admin restarted the server minutes later and we played the same mission again and the first thing I did was try to teleport to the Blackhawk and it wouldn't do anything at all and it didn't give me any errors either.

I used to use a script that just moved the player into cargo and it didn't check for any free positions at all, but the whole purpose of this newer script is to try to teleport a player into the gunner seat if it is available, because there is no way to move from a cargo seat - into the gunners seat while the chopper is in the air and it just helps to have somebody in the gunner seat if the chopper starts to take enemy fire. The crew chief seat (2nd gunner position) won't work with the script because there is no way to check for a free position for the crewchief seat at all. I've tried to teleport a player into the crewchief seat a bunch of different ways but all failed.

I will try your script and see how it works out. I wish I was able to test it on a dedicated server with a friend. Thanks for the help. I'll let you know how it works out.

Share this post


Link to post
Share on other sites
The crew chief seat (2nd gunner position) won't work with the script because there is no way to check for a free position for the crewchief seat at all. I've tried to teleport a player into the crewchief seat a bunch of different ways but all failed.

never say no way :D

/*
   GetinTurrets v.1.2 modified for A-SUICIDAL teleport
   by Demonized

   this addAction ["Teleport to Blackhawk", "teleport_blackhawk.sqf", [blackhawk], 1, false, true, "", ""];
*/

_unit = _this select 1;
_params = _this select 3;
_veh = _params select 0;

_turretArray = [ [0],[1],[2],[3],[4],[5],[0,1],[0,2],[0,3],[0,4],[0,5],[1,1],[1,2],[1,3],[1,4],[1,5],[2,1],[2,2],[2,3],[2,4],[2,5] ];

_freeDriver = _veh emptyPositions "Driver";
_freeCargo = _veh emptyPositions "Cargo";

{
if (vehicle _unit == _unit) then {
	_unit moveInTurret [_veh, _x];
};
} foreach _turretArray;
if (_freeCargo != 0 AND (vehicle _unit) == _unit) then {
_unit moveInCargo _veh;
};
if (_freeDriver != 0 AND (vehicle _unit) == _unit) then {
_unit moveInDriver _veh;
};

Edit3: Was sleeping or something, totally wrong addaction, i just quick converted it from a old script.

Edit2: removed some ballast code, no changes in functionality.

Edit1: this ofc doesnt mean it will work fine on dedi as your issue seems to be a locality thing, but it sounded like you took over non local AIs in your description, though i know you didnt mean that, look at selectPlayer command in wiki about locality and errors in the comments below, very similar to you, can see but no control.

Edited by Demonized
editedit: was sleeping, code corrected.

Share this post


Link to post
Share on other sites

I'm trying your script and nothing happens when I try to teleport. I'm doing something wrong. Honestly I'm having problems understanding how the script works exactly, so I'm not sure what I need to do to get it working.

To test it I created a new mission with 1 player, 1 flagpole and 1 chopper.

UH-60M named "blackhawk".

flagpole action:

this addAction ["Teleport to Blackhawk", "teleport_blackhawk.sqf"];

teleport_blackhawk.sqf:

/*
   GetinTurrets v.1.2 modified for A-SUICIDAL teleport
   by Demonized

   this addAction ["Teleport to blackhawk", "scriptname.sqf"];
*/

_params = _this select 3;
_veh = _params select 0;
_unit = _params select 1;

_turretArray = [ [0],[1],[2],[3],[4],[5],[0,1],[0,2],[0,3],[0,4],[0,5],[1,1],[1,2],[1,3],[1,4],[1,5],[2,1],[2,2],[2,3],[2,4],[2,5] ];

_freeDriver = _veh emptyPositions "Driver";
_freeCargo = _veh emptyPositions "Cargo";

{
if (vehicle _unit == _unit) then {
	_unit moveInTurret [_veh, _x];
};
} foreach _turretArray;
if (_freeCargo != 0 AND (vehicle _unit) == _unit) then {
_unit moveInCargo _veh;
};
if (_freeDriver != 0 AND (vehicle _unit) == _unit) then {
_unit moveInDriver _veh;
};

Share this post


Link to post
Share on other sites

Must have been sleeping, wrong addaction, was done in a hurry, previous post updated with correct addaction code, and correct _unit selecton.

What it does:

first tries to move player into all turrets, these are commander and gunner slots aswell, then if still not inside, moves into cargo, the driver part can really be removed or moved to before the cargo, but dont think you need a driver anyway..

Share this post


Link to post
Share on other sites

I never got your script to work. I think something is failing with the _turretArray and _x.

I temporarily remedied my old script by simplifying the script and just moving the player into cargo. Also, In the mission that had the problem, the AI are always disabled, so I don't know how I would have entered the game late and taken the place of an AI. I even have repeating triggers for each player that check if the player is not a real player and will instantly delete the unit if it's an AI. I guess I'll never understand why the script was having problems on dedicated servers. It seemed like a very simple script.

In any case, I'm back trying to get this script working again in a new mission that I am currently working on and I'd really like to get your script working if possible.

I just tried it again and created a new mission, added a UH-60M and named it "blackhawk", then added a flagpole and put your addAction in the init of the flagpole. Then I copied your script and pasted it into a new "teleport_blackhawk.sqf". I then tested the mission and the action appears, but nothing happens when I perform the action and no errors appear either. I tried a few different things to see if I could fix it, but I still can't get it to work ar all and no errors appear ever - and I always have "show script errors" turned on. Nothing shows up in my RPT file either. I added a hint message to your script and it does appear, so I know the script is executing, it just doesn't seem to want to work correctly.

Edited by A-SUICIDAL

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  

×