Home   Help Search Login Register  

Author Topic: Custom scoresystem bugged  (Read 506 times)

0 Members and 1 Guest are viewing this topic.

Offline Trapper

  • Honoured Contributor
  • ***
  • I'm a llama!
Custom scoresystem bugged
« on: 20 Aug 2005, 14:11:18 »
Someone else has a look at this please, I can't find the error... :)

What I want to do, is to add a fully customized scoring to my sp mission:
1. Flashpoints automatic score is reset to 0
2. My custom score is calculated
3. Custom score is added to playerscore
4. Mission ends

Scoring is calculated of:
- a counter variable (rescuedciv) : score +100 per count
- alive count of 10 soldiers (s1-s10)  : score -20 per dead soldier
- alive count of 2 vehicles (recon1, recon2) : score -700 per destroyed vehicle

Code: [Select]
hint format ["%1 (debug endmission.sqs)", rescuedciv]
~((random 5) + 5)
player addrating -(rating player)
_score = (rescuedciv * 100) + ((2 - ("alive _x" count [recon1,recon2])) * -700) + ((10 - ("alive _x" count [s1,s2,s3,s4,s5,s6,s7,s8,s9,s10])) * -20)
player addrating _score
~1
if (rescuedciv == 0) then {"1" objstatus "FAILED"; endmissionlose = true; forceend; exit}
if (rescuedciv <= 30) then {"1" objstatus "DONE"; endmission1 = true; forceend; exit}
if (rescuedciv <= 60) then {"1" objstatus "DONE"; endmission2 = true; forceend; exit}
if (rescuedciv <= 90) then {"1" objstatus "DONE"; endmission3 = true; forceend; exit}
if (rescuedciv <= 120) then {"1" objstatus "DONE"; endmission4 = true; forceend; exit}
if (rescuedciv <= 150) then {"1" objstatus "DONE"; endmission5 = true; forceend; exit}
if (rescuedciv <= 180) then {"1" objstatus "DONE"; endmission6 = true; forceend; exit}

Reseting one score and calculating the other works perfect if I try the lines in triggers, but after my long and big mission this ending script doesn't return the right score.


Situation 1:
- hint returned 32 and endmission2 was true
- 3 soldiers had died, vehicles ok
score = 640
(correct would have been 3140)

After that I added ~1, in case the mission ended to soon.

Situation 2:
- hint returned 61 and endmission3 was true
- 9 soldiers had died, vehicles ok
score = 3420
(correct would have been 5920)


Conspicuously is:
3140 - 640 = 2500
5920 - 3420 = 2500

Offline Trapper

  • Honoured Contributor
  • ***
  • I'm a llama!
Re:Custom scoresystem bugged
« Reply #1 on: 31 Aug 2005, 00:57:22 »
The -2500 seems to be harcoded and always appears when I use my custom scoring, so I've just added:

_score = (rescuedciv * 100) + ((2 - ("alive _x" count [recon1,recon2])) * -700) + ((10 - ("alive _x" count [s1,s2,s3,s4,s5,s6,s7,s8,s9,s10])) * -20) + 2500