Forum Jump :

Author Message

anzu  



Posts: 8
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2011-06-08 00:37        
     
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.

In the mission editor, there are 20 or so game logics named StartingLocation#, starting at StartingLocation0. In the parameters for the warfare mission, theres also a setting that lets me specify West North | East South for starting locations, which, from what I can tell, just causes StartingLocation0 to be used for West, and StartingLocation1 to be used for East. 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:
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 (selecting the West North | East South option in parameters), it gets stuck at the black screen with "Loading..." and doesn't let me play (although I can hear game sounds in the background). When I chose blufor, after a few seconds at the Loading screen I see "HQ Destroyed" in the corner of the screen. I don't see "HQ Destroyed' when I try it as opfor, so I'm assuming the blufor HQ is getting destroyed due to being placed in the water. However, i can't seem to figure out why its hanging at the Loading screen like this.

I also tried putting the following code in the Init box of each MHQ and player:
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?

I've tried a few other things, such as messing with the script files Init_Server.sqf and Init_Client.sqf. I tried manually specifying the starting locations in those files (although I'm not entirely sure I did it correctly) but had no luck, same issue: it would hang at the black "Loading..." screen when I tested it in MP. To be honest, I feel like I'm in way over my head here with editing the Warfare BE mission script like this, cuz I really don't understand half of the scripts here. But they say the best way to learn to swim is to dive right in, right?

So if anyone can lend me any assistance here I would appreciate it. I'm not looking for someone to do the work for me, just point me in the right direction. 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...). My guess is that it's hanging because it's trying to find a safe start location and can't find one.

So in a sentence, I'm asking: How do I set starting locations so the players and MHQ will start on top of the carrier, and not so far apart that they fall into the water?

Thanks in advance for any advice!


Update:
--------
I tried a few things and still have the same issues :-( Here's what I did...
Moved StartingLocation0 and 1 to the carriers and put this line in their init boxes:
this setPosition [locationPosition this select 0, locationPosition this select 1, 18];
Then I modified a section in Client\Init\Init_Client.sqf from
/* Positionate the client at the previously defined location */
player setPos ([getPos _base,20,30] Call GetRandomPosition);
to this:
/* Positionate the client at the previously defined location */
player setPosASL ([[getPosASL _base select 0, getPosASL _base select 1, 18],10,10] Call GetRandomPosition);
I figured this would work because it seemed llike the numbers 20 and 30 there were being passed to GetRandomPosition as some kind of area limit, so I thought I'd reduce it to 10.

Then I also changed a section in Server\Init\Init_Server.sqf from
//--- Moving each non-owner objects to the location.
EastMHQ setPos getPos _eastLocation;
WestMHQ setPos getPos _westLocation;
to this:
//--- Moving each non-owner objects to the location.
EastMHQ setPosASL [getPosASL _eastLocation select 0, getPosASL _eastLocation select 1, 18];
WestMHQ setPosASL [getPosASL _westLocation select 0, getPosASL _westLocation select 1, 18];
I did this in an attempt to set the MHQs at the right height on the starting locations. Now, I figured that all this combined would HAVE to work....but alas, I still get the same issue when starting the game: it gets stuck at the black "Loading..." screen. Although, when I was blufor and started the mission, I no longer see the "HQ Destroyed" message after a few seconds at the loading screen. So maybe there is some progress being made? I can't tell...

Any body know what I'm doing wrong here?

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

This post was edited by anzu (2011-06-11 08:32, ago)

Check out our ArmA 2 & DayZ Community at http://AnzusWarGames.info :)

Author Message

anzu  



Posts: 8
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#2 Posted at 2011-06-10 02:49        
     
Argh, Okay I've tried a bunch more things and none of them have worked :-( I won't cover everything here, but basically I tried creating a script that would move the player to the carrier position after a sleep of 10 seconds. I ran the script from the init line of the WestSlot1 player... But unfortunately the script didn't seem to move me anywhere.

I also tried simply changing one line in the Init_Client.sqf that is setting the player position. This is what I had:
/* 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 like this:
/* Positionate the client at the previously defined location */
player setPos [getPos carrier_north select 0, getPos carrier_north select 1, 18];
...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 :-(((

Check out our ArmA 2 & DayZ Community at http://AnzusWarGames.info :)

Advertisement


Author Message

palyarmerc  

I live inside the editor


Posts: 753
Rank:


Level: Member

Country: uk
Location:
Occupation: *Retired from ArmA*
Age:
In-game name: Paly

 
#3 Posted at 2011-06-10 06:43        
     
Does it work if you setpos to some other location on the map? Could be a problem with spawning stuff on the ship.
Have you looked at missions that have player start positions on ships?
Do you need that particular startup initialization? Might be worth stripping it out completely...maybe?
Are you certain that changing the 20-30 to 10 did not break some other variable that was required?
Sounds complicated, I'd start with getting a testmap to have player start on the deck of the ship.

....that's all folks....!

Author Message

anzu  



Posts: 8
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#4 Posted at 2011-06-10 09:10        
     
Hey, thanks for the response. To answer your questions:
palyarmerc:
Does it work if you setpos to some other location on the map?
If I move the start location to a place on land and use that, the mission starts fine at that location. However, if I try to setpos of player to a certain position on land via editing the Init_Client.sqf line like so:
/* Positionate the client at the previously defined location */
player setPos ([locationPosition startingLocation1,20,30] Call GetRandomPosition);
The mission hangs at the black "Loading..." screen. So maybe my syntax is wrong?

palyarmerc:
Have you looked at missions that have player start positions on ships?
I've searched online for other MP missions that start out on ships, but I can't find any. I will search some more...

palyarmerc:
Do you need that particular startup initialization?
Well, starting out on the carriers is kind of one of the main features i wanted to include. So I wanna figure out a way to do it. TBH, I didn't think it would be this difficult or complicated.

palyarmerc:
Are you certain that changing the 20-30 to 10 did not break some other variable that was required?
I've also tried the previous method without changing the 20 and 30, but I still got the same problem.

palyarmerc:
Sounds complicated, I'd start with getting a testmap to have player start on the deck of the ship.
I did this actually. To start out, I created a blank map with just the carriers, some empty vehicles that I have placed on the carriers, and a test player. I was able to place everything on the carrier exactly where I wanted, including the test player, and it worked fine. Then, I just copied the carriers and the things on them (except for the test player) into the Warfare BE mission. I then tested the mission (with the starting locations set on land) online and was able to go to the carrier and see everything still on it.

Check out our ArmA 2 & DayZ Community at http://AnzusWarGames.info :)

Author Message

palyarmerc  

I live inside the editor


Posts: 753
Rank:


Level: Member

Country: uk
Location:
Occupation: *Retired from ArmA*
Age:
In-game name: Paly

 
#5 Posted at 2011-06-10 16:04        
     
if I try to setpos of player to a certain position on land via editing the Init_Client.sqf line ~
..The mission hangs at the black "Loading..." screen. So maybe my syntax is wrong?
Well that's the thing to get working first. The evidence is right there, that there is a problem, and rules out the ships size,height,location etc.
Work on getting the spawn sequence to work on an airfield for instance, in a set area
(create a visible marker which defines the carrrier deck for spawn, for example)

....that's all folks....!

Author Message

anzu  



Posts: 8
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#6 Posted at 2011-06-11 06:13        
     
Progress!!! 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
//--- 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:
_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:
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:
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.

This post was edited by anzu (2011-06-11 07:56, ago)

Check out our ArmA 2 & DayZ Community at http://AnzusWarGames.info :)