Home   Help Search Login Register  

Author Topic: Set Start Location on Carrier in Warfare [SOLVED]  (Read 1691 times)

0 Members and 1 Guest are viewing this topic.

Offline anzu

  • Members
  • *
Set Start Location on Carrier in Warfare [SOLVED]
« on: 10 Jun 2011, 07:13:00 »
Hey guys, I've been having some trouble trying to make my own version of Warfare. Here's what my idea is: Warfare BE type game, except have each side start on their own aircraft carrier at opposite ends of the map. I want to have each MHQ along with all player slots start out on their respective aircraft carrier. So the the teams will have to lift their MHQs to land, then start capturing towns like normal Warfare. I don't know a whole lot of scripting, although I've been learning and can do basic things. So I figured I would just use one of the WarfareBE missions as a template and just edit that. Well I've been successful in getting most things the way I want them with the exception of the starting locations.

Now, I tried just moving StartingLocation0 to one carrier, and StartingLocation1 to the other carrier, and put the following in the Init box of the game logic starting locations:
Code: [Select]
this setPosition [locationPosition this select 0, locationPosition this select 1, 18];However, when I save the mission, export to MP as PBO, and host local game to test the mission, it gets stuck at the black screen with "Loading..." and doesn't let me play (although I can hear game sounds in the background).

I also tried putting the following code in the Init box of each MHQ and player:
Code: [Select]
this setPosASL [getPosASL this select 0, getPosASL this select 1, 18]But this doesn't seem to do the trick either.

When I move the StartingLocations 0 and 1 to somewhere on land, then start the game, it loads fine and it starts me at the place where I put the StartingLocation. So I'm guessing there is some problem with putting the starting locations over water?

So if anyone can lend me any assistance here I would appreciate it.  I'd be perfectly happy if I could just remove all StartingLocations and just have the players and MHQs always start where I place them on the map in the editor, that way I could definitely place them on the carrier. But alas, I tried removing all the game logic starting locations and placing the units where I wanted them, but it didn't seem to work (same problem as before, hangs at Loading...).

I also tried simply changing one line in the Init_Client.sqf that is setting the player position.  This is what I had:
Code: [Select]
/* Positionate the client at the previously defined location */
player setPosASL [getPos carrier_north select 0, getPos carrier_north select 1, 18];
Since carrier_north is what I named the carrier, and I know the deck height is 18, I thought this would HAVE to work.  But no, I still get stuck at the black "Loading..." screen forever once I start the game.  The commander vote box doesn't even pop up.  I also tried this same line of code except with setPos instead of setPosASL, but...same problem.  If i change this line back to normal, the game starts fine but it's not the starting location that I wanted.

Can someone please explain to me why changing this one, simple line of script in Client\Init\Init_Client.sqf causes the game to get stuck at the "Loading..." screen when I start the game?  I am really pulling my hair out over this guys, everything I'm trying is giving me the same problem :-(

(incase anyone wants to know, I'm using the USS Nimitz addon for my carriers, and i used WarfareV2_068LiteCO.isladuala as my template for this mission)
I've also posted at http://forums.bistudio.com/showthread.php?t=120362 this same question.  To see everything I've tried, check out that thread.
« Last Edit: 11 Jun 2011, 09:00:25 by anzu »

Offline B2KDragon

  • Members
  • *
    • Dogs of War
Re: Set Start Location on Carrier in Warfare
« Reply #1 on: 10 Jun 2011, 17:26:01 »
I know this may not be the most helpful thing you were hoping to hear.

However, http://www.armaholic.com/page.php?id=9368. This is a Carrier warfare based on BE allready. If you really want you own, my adivce is to download that, open it up, and take a look at what he has done to make it work.

It is of cource on Isla Duala, and requires some other mods. So maybe the guys here maybe able to help you more then that.

-Dragon,

Offline anzu

  • Members
  • *
Re: Set Start Location on Carrier in Warfare
« Reply #2 on: 10 Jun 2011, 20:24:42 »
Hey, thanks for the reply B2KDragon.  That Warfare BE Carrier mission you mentioned is actually what inspired me to try to create my own version.  I really like that mission, however there are some things I wanted to do differently.  For example, you don't start out on the carrier in that mission, which is one of the main things I wanted to achieve in my mission.  Also, I could not get the Kuznetsov CV addon to work when I tested it online with other players (I think maybe because there is no server key?).  I initially wanted to use that carrier but had too many problems with it, so I switched to the USS Nimitz addon.  I will take a further look at some of the scripts from that mission though, perhaps I can find some help in there.

Offline B2KDragon

  • Members
  • *
    • Dogs of War
Re: Set Start Location on Carrier in Warfare
« Reply #3 on: 11 Jun 2011, 00:44:58 »
Ahhh, I do see.

Right o chap, letme know how you get on and in what direction you are going. May be able to help somewhat.

Offline anzu

  • Members
  • *
Re: Set Start Location on Carrier in Warfare
« Reply #4 on: 11 Jun 2011, 08:59:55 »
Progress!!!  :yes: I was actually able to get the MHQ to spawn at a predefined marker by using this code in the Server\Init\Init_Server.sqf
Code: [Select]
//--- Moving each non-owner objects to the location.
EastMHQ setPos getMarkerPos "southMark";
WestMHQ setPos getMarkerPos "northMark";
then I have two markers on map with names southMark and northMark, set to positions on LAND.

And finally, this is what I did to get the player start location working correctly for MP play.  Maybe there's an easier way, but I'm just going with what works for now :-)

In my Client\Init\Init_Client.sqf I have these changes:
Code: [Select]
_northPos = [getMarkerPos "northCarrier" select 0, getMarkerPos "northCarrier" select 1, 18];
_southPos = [getMarkerPos "southCarrier" select 0, getMarkerPos "southCarrier" select 1, 18];

if (side player == west) then {
player setPosASL ([_northPos,10,10] Call GetRandomPosWater);
} else {
player setPosASL ([_southPos,10,10] Call GetRandomPosWater);
};

/* Positionate the client at the previously defined location */
/* player setPos ([getPos _base,20,30] Call GetRandomPosition); */
I also have _southPos and _northPos declared as Private in an array at the beginning of the file.  There are also two markers on the map, one at each carrier location, called northCarrier and southCarrier.  Notice I'm calling GetRandomPosWater instead of GetRandomPosition.  This is because I noticed in the original function Common\Functions\Common_GetRandomPosition.sqf there was a while loop that was making sure I did NOT spawn on the water.  So I created a new function file called Common\Functions\Common_GetRandomPosWater.sqf and put this code in it:
Code: [Select]
Private["_position","_radius","_direction","_maxRadius","_minRadius"];

_position = _this select 0;
_minRadius = _this select 1;
_maxRadius = _this select 2;
_direction = random 360;

_radius = (random (_maxRadius - _minRadius)) + _minRadius;
_position = [(_position select 0)+((sin _direction)*_radius),(_position select 1)+((cos _direction)*_radius),(_position select 2)];

_position
basically the same as the other function but with the while loop cut out.  I also had to declare this function in the file Common\Init\Init_Common.sqf with the following line:
Code: [Select]
GetRandomPosWater = Compile preprocessFile "Common\Functions\Common_GetRandomPosWater.sqf";
And it works!  =D I'm leaving the MHQs to spawn on land for now.  Although I'm thinking of doing a script to teleport the MHQ from the carrier to a nearby shore.  Anyways, I hope this helps somebody with a similar problem.