aliens

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - FudgeDragon

Pages: 1 2 3 [4]
46
Released Mods / Re: [STAT TRACKING] Soldier Diaries
« on: May 15, 2014, 03:59:41 pm »
I running your most recent code, although I may have started the game on the previous version.

Ok, I think I've worked out what causes it. Klaus was my longest serving soldier (the last of my starting 8 to die.) As a result one of only three soldiers,  dead or alive with a scrollbar on his missions screen. These are the only soldiers that crash, and only when selecting a mission that was below the starting 15. I hadn't noticed with the live ones because, well they seem less interesting. If any of them die I'm sure I'd head straight to the memorial to pay my respects.

Attempting to select one of those three missions throws a invalid vector<T> subscript which is a std::out_of_range

As I am running my own build of your code, I changed by build profile to debug and had a dig for you.
The error is thrown on the execution of this line:
Code: [Select]
SoldierDiaryMissionState.cpp Line 100: int missionId = _soldier->getDiary()->getMissionIdList().at(_rowEntry);
Experementing a little it seems _rowEntry gets more and more inaccurate the further you scroll down.
Looking at
Code: [Select]
SoldierDiaryOverviewState.cpp Line 312: int absoluteRowEntry = _lstDiary->getSelectedRow() + _lstDiary->getScroll();I find that
Code: [Select]
_lstDiary->getSelectedRow() already seems to be respecting scrollbar position. So every time we moved the scrollbar down all our missions would become offset by 1, eventually you moved off the bottom of the array :)

Change that row to
Code: [Select]
int absoluteRowEntry = _lstDiary->getSelectedRow() and everything seems to clear up the problem.

I've included a patch file of the fix in case it makes it easier for you. Scratch the patch file, it wouldn't apply, I was working on a branch with some of my own changes too.

One thing to note, debugging this has drawn attention to the fact that the textList returns to the top after viewing each mission. Any chance of getting it to remember where it was so I don't have to scroll back down to view the next mission?




47
Released Mods / Re: [STAT TRACKING] Soldier Diaries
« on: May 15, 2014, 09:04:18 am »
Hi Shoes,

I've been having a crash attempting to look at a particular dead soldiers mission details. The message I get is invalid vector<T> subscript.

I can't post the save as one its ironman and therefore difficult to test, and running a couple of personal ruleset tweaks (although nothing that would affect missions in any way, it adds extra tanks.

However if it helps, I've attatched the relevent sections of my savegame.

The trouble soldier:
Code: [Select]
  - id: 7
    name: Klaus Mueller
    initialStats:
      tu: 54
      stamina: 50
      health: 37
      bravery: 50
      reactions: 54
      firing: 53
      throwing: 68
      strength: 32
      psiStrength: 56
      psiSkill: 0
      melee: 36
    currentStats:
      tu: 64
      stamina: 59
      health: 47
      bravery: 50
      reactions: 56
      firing: 57
      throwing: 70
      strength: 49
      psiStrength: 56
      psiSkill: 0
      melee: 36
    rank: 4
    gender: 0
    look: 1
    missions: 18
    kills: 5
    armor: STR_PERSONAL_ARMOR_UC
    improvement: 0
    death:
      time:
        second: 25
        minute: 15
        hour: 14
        weekday: 5
        day: 6
        month: 5
        year: 1999
    diary:
      commendations:
        - commendationName: STR_MEDAL_MILITARY_CROSS_NAME
          decorationLevel: 3
        - commendationName: STR_MEDAL_ORDER_OF_EARTH_NAME
          decorationLevel: 3
        - commendationName: STR_MEDAL_HONOR_CROSS_NAME
          decorationLevel: 0
        - commendationName: STR_MEDAL_SERVICE_MEDAL_NAME
          decorationLevel: 0
        - commendationName: STR_MEDAL_MERIT_STAR_NAME
          decorationLevel: 0
        - commendationName: STR_MEDAL_CAMPAIGN_RIBBON_NAME
          noun: STR_SIBERIA
          decorationLevel: 0
      killList:
        - rank: STR_LIVE_SOLDIER
          race: STR_SECTOID
          weapon: STR_RIFLE
          weaponAmmo: STR_RIFLE_CLIP
          status: 6
          faction: 1
          mission: 0
          turn: 12
        - rank: STR_LIVE_SOLDIER
          race: STR_FLOATER
          weapon: STR_LASER_PISTOL
          weaponAmmo: STR_LASER_PISTOL
          status: 6
          faction: 1
          mission: 1
          turn: 315
        - rank: STR_LIVE_ENGINEER
          race: STR_SECTOID
          weapon: STR_GRENADE
          weaponAmmo: STR_GRENADE
          status: 6
          faction: 1
          mission: 2
          turn: 621
        - rank: STR_LIVE_ENGINEER
          race: STR_FLOATER
          weapon: STR_HEAVY_LASER
          weaponAmmo: STR_HEAVY_LASER
          status: 6
          faction: 1
          mission: 6
          turn: 1839
        - rank: STR_LIVE_SOLDIER
          race: STR_FLOATER
          weapon: STR_HEAVY_LASER
          weaponAmmo: STR_HEAVY_LASER
          status: 6
          faction: 1
          mission: 10
          turn: 3018
      missionIdList:
        - 0
        - 1
        - 2
        - 3
        - 4
        - 5
        - 6
        - 7
        - 8
        - 9
        - 10
        - 12
        - 13
        - 14
        - 15
        - 16
        - 18
        - 19
      alienRankTotal:
        STR_LIVE_ENGINEER: 2
        STR_LIVE_SOLDIER: 3
      alienRaceTotal:
        STR_FLOATER: 3
        STR_SECTOID: 2
      weaponTotal:
        STR_GRENADE: 1
        STR_HEAVY_LASER: 2
        STR_LASER_PISTOL: 1
        STR_RIFLE: 1
      weaponAmmoTotal:
        STR_GRENADE: 1
        STR_HEAVY_LASER: 2
        STR_LASER_PISTOL: 1
        STR_RIFLE_CLIP: 1
      regionTotal:
        STR_AUSTRALASIA: 1
        STR_CENTRAL_ASIA: 1
        STR_EUROPE: 4
        STR_NORTH_AMERICA: 3
        STR_SIBERIA: 5
        STR_SOUTH_AMERICA: 3
        STR_SOUTH_EAST_ASIA: 1
      countryTotal:
        STR_AUSTRALIA: 1
        STR_BRAZIL: 1
        STR_CANADA: 1
        STR_FRANCE: 1
        STR_RUSSIA: 5
        STR_UK: 1
        STR_UNKNOWN: 6
        STR_USA: 2
      typeTotal:
        STR_ALIEN_BASE_ASSAULT_LC: 2
        STR_TERROR_MISSION_LC: 3
        STR_UFO_CRASH_RECOVERY_LC: 13
      UFOTotal:
        NO_UFO: 5
        STR_LARGE_SCOUT: 6
        STR_MEDIUM_SCOUT: 7
      scoreTotal: 4514
      killTotal: 5
      missionTotal: 18
      winTotal: 17
      totalShotFriendlyCounter: 1
      terrorMissionTotal: 3
      nightMissionTotal: 5
      monthsService: 4
      importantMissionTotal: 17
      longDistanceHitCounterTotal: 1
and the missions:
Code: [Select]
missionStatistics:
  - id: 0
    country: STR_UK
    time:
      weekday: 4
      second: 45
      minute: 35
      hour: 14
      day: 13
      month: 1
      year: 1999
    region: STR_EUROPE
    type: STR_UFO_CRASH_RECOVERY
    ufo: STR_MEDIUM_SCOUT
    success: true
    score: 105
    rating: STR_RATING_OK
    alienRace: STR_SECTOID
    daylight: 0
    injuryList:
      6: 0
      1: 0
      2: 0
      3: 0
      4: 0
      5: 0
      7: 0
      8: 0
  - id: 1
    region: STR_SOUTH_EAST_ASIA
    country: STR_UNKNOWN
    type: STR_TERROR_MISSION
    ufo: NO_UFO
    time:
      minute: 52
      second: 5
      hour: 22
      weekday: 1
      day: 17
      month: 1
      year: 1999
    success: true
    score: 369
    rating: STR_RATING_GOOD
    alienRace: STR_FLOATER
    daylight: 0
    injuryList:
      2: 0
      3: 0
      4: 0
      5: 0
      7: 0
      8: 0
      9: 0
      10: 0
  - id: 2
    region: STR_EUROPE
    country: STR_FRANCE
    type: STR_UFO_CRASH_RECOVERY
    ufo: STR_LARGE_SCOUT
    time:
      minute: 34
      second: 5
      hour: 7
      weekday: 7
      day: 30
      month: 1
      year: 1999
    success: true
    score: 226
    rating: STR_RATING_GOOD
    alienRace: STR_SECTOID
    daylight: 1
    injuryList:
      2: 0
      3: 0
      4: 0
      7: 0
      8: 19
      9: 0
      10: 0
      11: 0
      12: 0
      13: 0
  - id: 3
    region: STR_SOUTH_AMERICA
    country: STR_UNKNOWN
    type: STR_UFO_CRASH_RECOVERY
    ufo: STR_LARGE_SCOUT
    time:
      minute: 43
      second: 15
      hour: 19
      weekday: 1
      day: 7
      month: 2
      year: 1999
    success: true
    score: 196
    rating: STR_RATING_OK
    alienRace: STR_SECTOID
    daylight: 0
    injuryList:
      2: 0
      3: 0
      4: 0
      7: 0
      9: 0
      10: 0
      11: 0
      12: 0
      13: 0
      14: 0
  - id: 4
    region: STR_EUROPE
    country: STR_UNKNOWN
    type: STR_UFO_CRASH_RECOVERY
    ufo: STR_LARGE_SCOUT
    time:
      minute: 47
      second: 25
      hour: 6
      weekday: 7
      day: 13
      month: 2
      year: 1999
    success: true
    score: 160
    rating: STR_RATING_OK
    alienRace: STR_SECTOID
    daylight: 0
    injuryList:
      4: 0
      7: 0
      9: 0
      10: 0
      11: 0
      13: 0
      14: 0
      15: 0
      16: 0
      17: 0
  - ufo: NO_UFO
    time:
      minute: 53
      second: 20
      hour: 14
      weekday: 3
      day: 2
      month: 3
      year: 1999
    injuryList:
      13: 0
      4: 0
      7: 0
      9: 0
      10: 0
      11: 0
      14: 0
      15: 0
      16: 0
      17: 0
    success: true
    score: 265
    rating: STR_RATING_GOOD
    alienRace: STR_SECTOID
    daylight: 0
    id: 5
    region: STR_SOUTH_AMERICA
    country: STR_BRAZIL
    type: STR_TERROR_MISSION
  - country: STR_USA
    type: STR_UFO_CRASH_RECOVERY
    ufo: STR_LARGE_SCOUT
    success: true
    score: 178
    rating: STR_RATING_OK
    alienRace: STR_FLOATER
    daylight: 0
    injuryList:
      2: 40
      3: 0
      4: 0
      7: 0
      8: 0
      9: 0
      11: 18
      12: 0
      15: 0
    region: STR_NORTH_AMERICA
    id: 6
    time:
      minute: 44
      hour: 16
      weekday: 4
      day: 3
      second: 35
      year: 1999
      month: 3
  - id: 7
    region: STR_AUSTRALASIA
    country: STR_AUSTRALIA
    type: STR_TERROR_MISSION
    ufo: NO_UFO
    time:
      second: 40
      minute: 25
      hour: 1
      weekday: 3
      day: 23
      month: 3
      year: 1999
    success: true
    score: 140
    rating: STR_RATING_OK
    alienRace: STR_FLOATER
    daylight: 0
    injuryList:
      3: 20
      4: 0
      7: 0
      8: 0
      11: 0
      12: 0
      15: 0
      18: 0
      19: 0
      20: 0
      21: 0
      22: 0
      23: 0
  - id: 8
    region: STR_SOUTH_AMERICA
    country: STR_UNKNOWN
    type: STR_UFO_CRASH_RECOVERY
    ufo: STR_LARGE_SCOUT
    time:
      second: 5
      minute: 10
      hour: 15
      weekday: 6
      day: 26
      month: 3
      year: 1999
    success: true
    score: 265
    rating: STR_RATING_GOOD
    alienRace: STR_FLOATER
    daylight: 0
    injuryList:
      4: 0
      7: 0
      8: 0
      12: 0
      15: 16
      19: 0
      20: 0
      21: 0
      22: 0
      23: 0
  - id: 9
    region: STR_SIBERIA
    country: STR_RUSSIA
    type: STR_UFO_CRASH_RECOVERY
    ufo: STR_MEDIUM_SCOUT
    time:
      minute: 2
      second: 35
      hour: 13
      weekday: 5
      day: 1
      month: 4
      year: 1999
    success: true
    score: 152
    rating: STR_RATING_OK
    alienRace: STR_SNAKEMAN
    daylight: 14
    injuryList:
      4: 0
      7: 0
      8: 0
      12: 12
      19: 0
      20: 0
      21: 0
      22: 0
      23: 0
  - id: 10
    region: STR_NORTH_AMERICA
    country: STR_CANADA
    type: STR_ALIEN_BASE_ASSAULT
    ufo: NO_UFO
    time:
      minute: 25
      second: 30
      hour: 9
      weekday: 2
      day: 5
      month: 4
      year: 1999
    success: true
    score: 1629
    rating: STR_RATING_EXCELLENT
    alienRace: STR_FLOATER
    daylight: 15
    injuryList:
      4: 0
      7: 0
      8: 0
      19: 0
      21: 0
      22: 0
      23: 0
      24: 0
      25: 0
      26: 0
      27: 0
      28: 0
      29: 0
      30: 0
  - id: 11
    region: STR_SIBERIA
    country: STR_RUSSIA
    type: STR_UFO_CRASH_RECOVERY
    ufo: STR_LARGE_SCOUT
    time:
      minute: 32
      second: 35
      hour: 4
      weekday: 2
      day: 19
      month: 4
      year: 1999
    success: true
    score: 206
    rating: STR_RATING_GOOD
    alienRace: STR_SNAKEMAN
    daylight: 0
    injuryList:
      19: 0
      22: 0
      23: 0
      24: 0
      25: 18
      26: 0
      27: 0
      30: 0
      31: 0
      32: 0
  - id: 12
    region: STR_NORTH_AMERICA
    country: STR_USA
    type: STR_UFO_CRASH_RECOVERY
    ufo: STR_MEDIUM_SCOUT
    time:
      minute: 51
      second: 45
      hour: 17
      weekday: 4
      day: 21
      month: 4
      year: 1999
    success: true
    score: 159
    rating: STR_RATING_OK
    alienRace: STR_FLOATER
    daylight: 0
    injuryList:
      7: 0
      19: 0
      21: 0
      22: 0
      23: 0
      24: 0
      26: 0
      30: 0
      31: 0
      32: 0
  - id: 13
    region: STR_CENTRAL_ASIA
    country: STR_UNKNOWN
    type: STR_UFO_CRASH_RECOVERY
    ufo: STR_MEDIUM_SCOUT
    time:
      minute: 59
      second: 55
      hour: 6
      weekday: 7
      day: 1
      month: 5
      year: 1999
    success: true
    score: 186
    rating: STR_RATING_OK
    alienRace: STR_SNAKEMAN
    daylight: 0
    injuryList:
      7: 0
      19: 0
      21: 0
      22: 0
      23: 0
      24: 0
      26: 0
      30: 0
      31: 1
      32: 0
  - id: 14
    region: STR_SIBERIA
    country: STR_RUSSIA
    type: STR_UFO_CRASH_RECOVERY
    ufo: STR_MEDIUM_SCOUT
    time:
      minute: 14
      second: 50
      hour: 0
      weekday: 1
      day: 2
      month: 5
      year: 1999
    success: true
    score: 157
    rating: STR_RATING_OK
    alienRace: STR_SNAKEMAN
    daylight: 0
    injuryList:
      7: 0
      15: 0
      19: 0
      21: 0
      22: 0
      23: 0
      24: 0
      26: 0
      30: 0
      32: 0
  - id: 15
    country: STR_RUSSIA
    region: STR_SIBERIA
    type: STR_UFO_CRASH_RECOVERY
    ufo: STR_MEDIUM_SCOUT
    time:
      second: 5
      minute: 14
      hour: 10
      weekday: 1
      day: 2
      month: 5
      year: 1999
    success: true
    score: 125
    rating: STR_RATING_OK
    alienRace: STR_SNAKEMAN
    daylight: 0
    injuryList:
      7: 0
      15: 0
      19: 0
      21: 0
      22: 0
      23: 0
      24: 0
      26: 0
      30: 0
      32: 0
  - id: 16
    region: STR_SIBERIA
    country: STR_RUSSIA
    type: STR_UFO_CRASH_RECOVERY
    ufo: STR_LARGE_SCOUT
    time:
      minute: 53
      second: 35
      hour: 22
      weekday: 1
      day: 2
      month: 5
      year: 1999
    success: true
    score: 322
    rating: STR_RATING_GOOD
    alienRace: STR_SNAKEMAN
    daylight: 0
    injuryList:
      7: 0
      15: 0
      19: 0
      21: 0
      23: 0
      24: 0
      26: 0
      30: 0
      32: 0
      33: 36
  - id: 17
    region: STR_NORTH_AMERICA
    country: STR_USA
    type: STR_UFO_CRASH_RECOVERY
    ufo: STR_MEDIUM_SCOUT
    time:
      minute: 47
      second: 40
      hour: 18
      weekday: 4
      day: 5
      month: 5
      year: 1999
    success: true
    score: 127
    rating: STR_RATING_OK
    alienRace: STR_FLOATER
    daylight: 0
    injuryList:
      3: 0
      4: 0
      8: 0
      12: 0
      34: 0
      35: 0
      36: 0
      37: 0
      38: 0
      39: 0
  - id: 18
    region: STR_EUROPE
    country: STR_UNKNOWN
    type: STR_UFO_CRASH_RECOVERY
    ufo: STR_MEDIUM_SCOUT
    time:
      minute: 53
      second: 0
      hour: 4
      weekday: 5
      day: 6
      month: 5
      year: 1999
    success: true
    score: 9
    rating: STR_RATING_OK
    alienRace: STR_SNAKEMAN
    daylight: 2
    injuryList:
      7: 0
      15: 0
      19: 0
      21: 0
      22: 0
      23: 0
      26: 0
      30: 0
      31: 0
      32: 0
  - id: 19
    region: STR_SIBERIA
    country: STR_RUSSIA
    type: STR_ALIEN_BASE_ASSAULT
    ufo: NO_UFO
    time:
      minute: 15
      second: 25
      hour: 14
      weekday: 5
      day: 6
      month: 5
      year: 1999
    success: false
    score: -129
    rating: STR_RATING_POOR
    alienRace: STR_SNAKEMAN
    daylight: 15
    injuryList:
      7: 0
      15: 0
      19: 0
      21: 0
      22: 0
      23: 0
      26: 0
      30: 0
      31: 0
      32: 0
  - id: 20
    region: STR_SIBERIA
    country: STR_RUSSIA
    type: STR_UFO_CRASH_RECOVERY
    ufo: STR_MEDIUM_SCOUT
    time:
      minute: 55
      second: 40
      hour: 5
      weekday: 4
      day: 12
      month: 5
      year: 1999
    success: true
    score: 177
    rating: STR_RATING_OK
    alienRace: STR_SNAKEMAN
    daylight: 0
    injuryList:
      2: 0
      19: 0
      22: 0
      26: 0
      30: 0
      44: 0
      45: 0
      46: 0
      47: 0
      48: 0
  - id: 21
    region: STR_CENTRAL_ASIA
    country: STR_UNKNOWN
    type: STR_UFO_CRASH_RECOVERY
    ufo: STR_LARGE_SCOUT
    time:
      minute: 45
      second: 25
      hour: 12
      weekday: 6
      day: 14
      month: 5
      year: 1999
    success: true
    score: 249
    rating: STR_RATING_GOOD
    alienRace: STR_SNAKEMAN
    daylight: 0
    injuryList:
      2: 0
      19: 0
      22: 0
      26: 0
      30: 0
      44: 0
      45: 0
      46: 0
      47: 0
      48: 0
  - id: 22
    region: STR_EUROPE
    country: STR_UNKNOWN
    type: STR_UFO_CRASH_RECOVERY
    ufo: STR_LARGE_SCOUT
    time:
      minute: 0
      second: 55
      hour: 10
      weekday: 3
      day: 18
      month: 5
      year: 1999
    success: true
    score: 276
    rating: STR_RATING_GOOD
    alienRace: STR_SNAKEMAN
    daylight: 0
    injuryList:
      2: 0
      19: 0
      22: 0
      26: 0
      30: 0
      44: 0
      45: 0
      46: 0
      47: 0
      48: 0
  - alienRace: STR_FLOATER
    daylight: 0
    injuryList:
      3: 0
      4: 0
      8: 0
      12: 0
      35: 0
      36: 0
      37: 0
      38: 0
      39: 0
      34: 0
    id: 23
    region: STR_NORTH_AMERICA
    country: STR_USA
    type: STR_UFO_CRASH_RECOVERY
    ufo: STR_LARGE_SCOUT
    time:
      minute: 23
      second: 10
      hour: 14
      weekday: 3
      day: 18
      month: 5
      year: 1999
    success: true
    score: 306
    rating: STR_RATING_GOOD
  - id: 24
    region: STR_SOUTH_AMERICA
    country: STR_UNKNOWN
    type: STR_UFO_GROUND_ASSAULT
    ufo: STR_SUPPLY_SHIP
    time:
      second: 10
      minute: 17
      hour: 7
      weekday: 5
      day: 20
      month: 5
      year: 1999
    success: true
    score: 658
    rating: STR_RATING_EXCELLENT
    alienRace: STR_FLOATER
    daylight: 15
    injuryList:
      3: 26
      4: 0
      8: 22
      12: 6
      34: 0
      35: 0
      36: 0
      37: 0
      38: 0
      39: 0

If this helps, great. If not I'll try to reproduce it in a more isolated environment (and not ironman).

48
Released Mods / Re: [STAT TRACKING] Soldier Diaries
« on: May 12, 2014, 08:13:21 pm »
Hey Shoes,

Built your mod from your GitHub source today but at first it refused to compile. It seems you were calling textList->setScroll(0) (which doesn't exist) once in SoldierDiaryOverviewState and nine times in SoldierDiaryPerformanceState. I think the method you wanted was scrollTo(0). Other than that, love the mod.

49
Work In Progress / Re: [WIP][Source Mod]Fair Psionics
« on: May 10, 2014, 06:18:06 pm »
With using an option I ended up with this
Code: [Select]
https://Create a list of valid targets for psionics
std::map<int, BattleUnit*> PsiTargets;
https://Check if line of sight required first, if true the other two become irrelevent, as only units visible to this one matter, and we have a list for that.
if (LOSRequired)
{
for (std::vector<BattleUnit*>::const_iterator i = _unit->getVisibleUnits()->begin(); i != _unit->getVisibleUnits()->end(); ++i)
{
https://If we check these conditions now we potentialy reduce the number of things we iterate later
if (validTarget(*i, true, false) && (*i)->getOriginalFaction() == FACTION_PLAYER && (*i)->getArmor()->getSize() == 1)
{
PsiTargets[(*i)->getId()] = *i;
}
}
}
https://Otherwise start iterating over the entire units collection.
else
{
for (std::vector<BattleUnit*>::const_iterator i = _save->getUnits()->begin(); i != _save->getUnits()->end(); ++i)
{
https://If fair psionics is switched on
if (Options::fairPsionics)
{
https://we care about FACTION_HOSTILE units only
if ((*i)->getFaction() == FACTION_HOSTILE)
{
https://iterate through each units list of units spotted during its turn
for (std::vector<BattleUnit*>::const_iterator j = (*i)->getUnitsSpottedThisTurn().begin(); j != (*i)->getUnitsSpottedThisTurn().end(); ++j)
{
https://checking these now so we dont have to later
if (validTarget(*j, true, false) && (*j)->getOriginalFaction() == FACTION_PLAYER && (*j)->getArmor()->getSize() == 1)
{
PsiTargets[(*j)->getId()] = *j;
}
}
}
}
else
{
https://Otherwise just check our standard conditions
if (validTarget(*i, true, false) && (*i)->getOriginalFaction() == FACTION_PLAYER && (*i)->getArmor()->getSize() == 1)
{
PsiTargets[(*i)->getId()] = *i;
}
}
}
}
https://Then we iterate through everything we selected in the last stage and evalutate psi odds
for (std::map<int, BattleUnit*>::const_iterator i = PsiTargets.begin(); i != PsiTargets.end(); ++i)
{
int chanceToAttackMe = psiAttackStrength
+ (((*i).second->getStats()->psiSkill > 0) ? (*i).second->getStats()->psiSkill * -0.4 : 0)
- _save->getTileEngine()->distance((*i).second->getPosition(), _unit->getPosition())
- ((*i).second->getStats()->psiStrength)
+ RNG::generate(55, 105);

if (chanceToAttackMe > chanceToAttack)
{
chanceToAttack = chanceToAttackMe;
_aggroTarget = (*i).second;
}
}
Which compared to existing code feels like a horrible monstrocity, but I've minimised reuse of iterators where I can.  I tried compacting the Ifs a bit but doing so changed the meanings and produced more futher down. Thoughts?

EDIT: Added some comments to explain what the hell I was thinking.

50
Work In Progress / Re: [WIP][Source Mod]Fair Psionics
« on: May 10, 2014, 05:11:46 pm »
Well. This is certainly making me reconsider what I knew about psionics. It always used to seem like the aliens just mind controlled whoever they wanted. But ValidTarget should prevent that (prior to turn 20). Must be a consequence of the lack of doors on the skyranger and avenger. Still I would think adjusting intel down would make targeting for blasterbombs and ambushes harder for the aliens.

Your suggested solution seems good, although I'm having trouble leaving it as optional. I can build the PsiTargets map using code similar to what you suggested (and I gather we are using map instead of vector so that we can specify the ID of the inserted item, to avoid inserting more than once), and I'm even thinking it might be worth doing the same for VisibleUnits for the LOSRequired section as I would imagine std::find is iterating through each item as well.

The problem I am having is using the new map when Option::fairPsionics is true but using the original getUnits vector when false. Short of rebuilding the original vector as a map (which is going to involve iterating through it again) I'm not sure of the best way to do it.

51
Work In Progress / Re: [WIP][Source Mod]Fair Psionics
« on: May 10, 2014, 11:51:02 am »
Ah OK, in that case wouldn't my iterator already be checking units killed by reaction fire. My understanding reading the code, is until the next turn, dead units should still be carrying their unitsSpottedThisTurn information.

I also thought taht setting alien's intelligence to 0 would affect them adversely in other ways as well. Is this not the case?

52
Work In Progress / Re: [WIP][Source Mod]Fair Psionics
« on: May 10, 2014, 10:47:50 am »
Hmm, looks like getTurnsSinceSpotted doesn't work quite the same way. getTurnsSinceSpotted is only iterated at the start of each player turn. So If I let them see a unit during my movement, they can take control of it during theirs without scouting for it. Not quite what I was going for, but It works soo much better than iterating. Decisions Decisions.

53
Work In Progress / Re: [WIP][Source Mod]Fair Psionics
« on: May 10, 2014, 10:01:21 am »
Another thing I would like to see in the future is a more dynamic psi attack system.
Currently the two attacks have a hard coded success rate, I'd like that to be moddable. And the TU cost is the same regardless of your choice to panic or control a unit, I think it should be brought more in line with shooting, cost depending on the attack, just like the difference for snap/auto/aimed.
Perhaps even a small chance to miss, resulting in affecting the wrong target? (nearest unit to target)

I definitely think this is a better solution for alien units, though I think LoS rules should apply to xcom units.
anyway, just my thoughts.

Hmm, A little outside of what I'm trying to do here, but maybe I can look into it later.
We'd have to introduce some new ruleset values for psi weapons, splitting tu use into panic and mind control, and adding some sort of multiplier for cost?

On a sidenote making only XCOM use LOS can be done with rulesets. I think there might be one floating about the forums somewhere (or did I see it in suggestions on github, I dont recall.)

there's an easier way than iterating unitsSpottedThisTurn, check if the target's turnsSinceSpotted is 0. that amounts to the same thing, but accounts for aliens that spotted a unit and then died from reaction fire.

and no, it's not restricted to one psi attack per turn, it's restricted to one psi attack in a row. it must make a regular move or attack before it is allowed to psi attack again this turn, which counts as a "free" action, meaning the alien can make a psi attack and move up to 6 times per turn.

it IS iterating through an array, ordered by deployment data (terror units move first in alien bases, for example). it performs 3 actions per unit, and when it reaches the end of the array, it starts again from the beginning for the second phase. (hence 6 actions per turn)

it DOES check current faction before making a mind control attempt, that's what validTarget() is for, and it does factor morale in to the decision to make a panic or mind control attempt, the lower the morale, the greater the odds of mind control instead of panic

OOOH, yes turnsSinceSpotted() would do the job. I take it dead units can't be found in the GetUnits() vector, which makes sense, otherwise we'd have to keep checking if the target was alive. Thanks for the information Warboy!

Also thanks for clarifying the movement order stuff, So if he doesn't have any psi targets in the first part of his turn, he gets to go up to three more times after everyone else has moved.

My confusion on the _didPsi varable was I dimly remembered commit 60f570c - fix multiple MC scenario (from 6 months ago), I assumed when I saw it that this was the fix. I see now that it was unrelated.

In fact this addresses all my concerns for improvement.

I'll update the first post (and the git) when I've changed over to turnsSinceSpotted() (and confirmed it still works nicely)

EDIT: Just invalidated all my testing. Forgot to turn my own advanced option on. Etherials were working as Gollop intended.

54
Work In Progress / [WIP][Source Mod]Fair Psionics
« on: May 10, 2014, 01:01:17 am »
Hey everyone. First potential mod out of five ideas I have written down on a piece of paper.
What this mod does: Forces aliens of follow the same Psionics rules as XCOM. Aliens can only target soldiers one of their units has already seen this turn.
What Inspired this mod: The new LOS option is nice, but really plays out as a heavy nerf to the aliens. It does somewhat limit XCOM Mind Control Cheese in the lategame, but makes it significantly easier to get there. When given the choice between mind controling a unit that it can see and just shooting it, the aliens seem to prefer to shoot. My mod seeks to even the playing field instead.

How it works(Warning:Gets Technical): When an alien decides to attack something (which it can do at any time the aliens know about any xcom units), if I can do Psi it tries that first. The AI then looks at each unit and picks the one it has the greatest chance go attack (it may at this stage just decide to shoot something if it figures its the better option). What my mod does is build a list of valid units first, from the units that each enemy unit has seen on its current turn. It then selects the best option from this new smaller list.

What this means in practice: Alien Psi plays out exactly like XCOM's. During the opening sweep of the map psionics will be largely unchanged, the only difference being that only units the aliens have seen in a particular turn are valid targets, so as you press the aliens back only your forward scout units can be paniced and controlled. Of course if the aliens get control of one of your scouts, it can then be used to find more targets. Once alien numbers begin to thin, the Psi troops lose their intel, until your troops burst through the last door for one final confrontation.

How can this be improved: The player typically uses his Psi troops as a reserve, waiting until he discovers enemy units to control. However if the Psi troop moves first and uses all its TUs because it has no valid targets it might miss out on an oppertunity later in the turn. This could be solved by making the Psi troop wait until after other units have moved, although that might introduce a problem with etherials constantly out waiting each other. Using rank as a rough guide in which order to move might solve the problem, although I have no idea how the aliens decide in which order to move. Considerning units can move multiple times a turn (with other units moving in between), it clearly isn't just iterating through an array.

Another possible improvement would be a better fix to the multiple psi attacks on a single unit problem. Currently if I am reading the code correctly, each Psi capable unit is restricted to a single Psi action each turn. While clearly a good fix for the aforementioned problem it somewhat limits their current potential. Possibly check current morale when deciding when to panic, or if a unit already is in FACTION_HOSTILE before attempting the mind control.

I'm interested in getting other peoples thoughts on the idea, and/or if you are a programmer, the implemetation.
if people want to try out my current code I've got a Github fork branch at github.com/fudgedragon/OpenXcom/tree/fairPsionics
or alternatively, I have a build attatched to this post. It only includes the changed exe (not to mention all the visual studio DLLs) and language files to keep the size down, so install over the current nightly.

EDIT: It occured to me after posting this last night that I didn't mention that it is a toggleable advanced option.

Pages: 1 2 3 [4]