Author Topic: Different Init Vecs?  (Read 1844 times)

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
Different Init Vecs?
« 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...



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?
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials

Offline spirit1flyer

  • Hero Member
  • *****
  • Posts: 621
Different Init Vecs?
« Reply #1 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?
"Until you stalk and overrun You can't devour anyone"


Loyal Xfir supporter

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Different Init Vecs?
« Reply #2 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.
 

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
Different Init Vecs?
« Reply #3 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);
}

}
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials

Offline BlackBox

  • Administrator
  • Hero Member
  • *****
  • Posts: 3093
Different Init Vecs?
« Reply #4 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 ...
}

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
Different Init Vecs?
« Reply #5 on: January 01, 2006, 08:46:44 PM »
Ohhh, I see. Thanks hacker, it's working fine now.
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials