Outpost Universe Forums

Projects & Development => Outpost 2 Programming & Development => Topic started by: Sirbomber on December 31, 2005, 08:59:48 AM

Title: Different Init Vecs?
Post by: Sirbomber on December 31, 2005, 08:59:48 AM
Did I ask this already? Well, if I did, sorry. Anyways...
How would I make OP2 give people different vecs/etc based on whether they're Eden/Plym? I've tried, but met with... non-exceptional results...

(http://i5.photobucket.com/albums/y197/Sirbomber/lynx1.png)(http://i5.photobucket.com/albums/y197/Sirbomber/lynx2.png)

As you can see, everyone gets Laser Lynx. Except for that one time that it was half Microwave half laser.

Any suggestions on how I could make this more functional?
Title: Different Init Vecs?
Post by: spirit1flyer on December 31, 2005, 09:57:36 AM
I have to work at this every time I try, but I do have some code with a correct setup you can look at if you want?
Title: Different Init Vecs?
Post by: Hooman on December 31, 2005, 03:55:33 PM
When creating the units, you have to select the weapon type based on their colony type. You need to check Player.IsEden(), then when units are being created make sure it can change the weapon type based on this.

How exactly are you creating the units? It might seem a little clunky to do this.
 
Title: Different Init Vecs?
Post by: Sirbomber on January 01, 2006, 08:47:27 AM
The units are in basedata and set to have microwaves. I tell it to create the units and change the mics to lasers if they're eden.

Code: [Select]
	for (i = 0; i < baseInfo.numVehicle; i++)
{
  VehicleInfoE &curItem = baseInfo.vehicleInfo[i];
  curX = x + curItem.x;
  curY = y + curItem.y;
  TethysGame::CreateUnit(unit, curItem.type, LOCATION(curX, curY),
      player, curItem.weaponCargo, curItem.dir);
  unit.DoSetLights(1);
  if (unit.GetType() == mapCargoTruck)
   unit.SetTruckCargo( curItem.ctcargo, curItem.cnum);

for (int i = 0; i < TethysGame::NoPlayers(); i++)
{
        if (Player[i].IsEden() && unit.GetType() == mapLynx)
        unit.SetWeapon( mapLaser);
}

}
Title: Different Init Vecs?
Post by: BlackBox on January 01, 2006, 01:23:19 PM
Hmm, well what would happen here is the unit would always be a laser (if ANY of the players were Eden), because it loops thru all players.

A better way of doing it might be like this:
Code: [Select]
for (i = 0; i < baseInfo.numVehicle; i++)
{
 VehicleInfoE &curItem = baseInfo.vehicleInfo[i];
 curX = x + curItem.x;
 curY = y + curItem.y;
 if (Player[player].IsEden() && curItem.type == mapLynx)
    curItem.weaponCargo = mapLaser;
 TethysGame::CreateUnit(unit, curItem.type, LOCATION(curX, curY),
     player, curItem.weaponCargo, curItem.dir);
// ... and so on ...
}
Title: Different Init Vecs?
Post by: Sirbomber on January 01, 2006, 08:46:44 PM
Ohhh, I see. Thanks hacker, it's working fine now.