************************************************************

* Merged GameDir from Development Trunk: Revision 4063 *
************************************************************
- Merged from SVN: https://81.169.133.124/source/ja2/branches/Wanne/JA2%201.13%20MP

git-svn-id: https://ja2svn.mooo.com/source/ja2_v1.13_data@1257 4f8fa57e-7814-0410-bad4-adc449f26b7c
This commit is contained in:
Wanne
2011-01-18 10:24:49 +00:00
parent 826c4a2590
commit 0a62ebd22b
3975 changed files with 201787 additions and 67273 deletions
+522
View File
@@ -0,0 +1,522 @@
--[[
http://www.legion.zone.zg.pl/doku.php/modowanie/ja/art_ja_m_22_lua
**********************
** Global variables **
**********************
- newDIFFICULTY_LEVEL (Start new game setting)
1 = easy
2 = experienced
3 = expert
4 = insane
- newGAME_STYLE (Start new game setting)
0 = realistic
1 = sci fi
- is_networked (Multiplayer)
0 = no
1 = yes
- iniENABLE_CREPITUS (ja2_options.ini setting)
0 = no
1 = yes
- iniSTARTING_CASH_NOVICE, iniSTARTING_CASH_EXPERIENCED, iniSTARTING_CASH_EXPERT, iniSTARTING_CASH_INSANE (ja2_options.ini setting)
Starting cash
- iniMERC_WEBSITE_IMMEDIATELY_AVAILABLE (ja2_options.ini setting)
true = yes
false = no
- giHospitalTempBalance
set hospital balance
- gbHospitalPriceModifier
set hospital modifier
- giHospitalRefund
***************
** Functions **
***************
- AddAlternateSector, AddAltSector, AddAltSectorNew
add alternative sector
- AddNPC or AddNPCtoSector
add NPC\EPC\RPC to sector
- AddAltUnderGroundSector, AddAltUGSector or AddAltUGSectorNew
add alternative underground sector
- SetNPCData1 ( ProfilID, value )
set NPCData1
- GetStartingCashNovice()
get starting cash novice level
- GetStartingCashExperienced()
get starting cash experienced level
- GetStartingCashExpert()
get starting cash expert level
- GetStartingCashInsane()
get starting cash insane level
- GetWorldTotalMin()
get world time
- AddTransactionToPlayersBook(ubCode, ubSecondCode, uiDate, iAmount)
add transaction to player
- AddPreReadEmail (iMessageOffset, iMessageLength, ubSender)
iMessageOffset - record from email.edt
iMessageLength - record from email.edt
ubSender - uiIndex from SenderNameList.xml
- AddEmail (iMessageOffset, iMessageLength, ubSender, iCurrentIMPPosition)
iMessageOffset - record from email.edt
iMessageLength - record from email.edt
ubSender - uiIndex from SenderNameList.xml
iCurrentIMPPosition - -1
**************
** Examples **
**************
-- Add Fatima to sector
Fatima = { }
Fatima.MercProfiles = 101
Fatima.sector = "A10-0"
AddNPC(Fatima)
-- Add Fatima to sector
AddNPC( { MercProfiles = 101 , sector = "A10-0" } )
-- Add Fatima to sector, only in a realistic game
if newGAME_STYLE == 0 then
Fatima = { }
Fatima.MercProfiles = 101
Fatima.sector = "A10-0"
AddNPC(Fatima)
end
-- Add alternative sector, only when starting cash = 4000 and game style SciFi
if (iniSTARTING_CASH_NOVICE == 4000 and newGAME_STYLE == 1) then
Fatima = { }
Fatima.MercProfiles = 101
Fatima.sector = "A10-0"
AddNPC(Fatima)
end
-- Add alternative sector, only realistic game
if newGAME_STYLE == 0 then
SectorA9 = { }
SectorA9.altSector = "A9"
AddAlternateSector(SectorA9)
end
-- Add alternative sector
SectorA9 = { }
SectorA9.altSector = "A9"
AddAlternateSector(SectorA9)
-- Add alternative underground sector
A10_b1 = { }
A10_b1.altSector = "A10-1"
AddAltUGSector(A10_b1)
-- Add alternative underground sector
AddAltUGSector( { altSector = "A10-1" } )
-- Add Skyrider to sector
AddNPCtoSector(97,9,1,0)
-- Add alternative sector C1
AddAltSectorNew (3,1)
-- Add alternative sector C1-3
AddAltUGSectorNew(3,1,3)
]]
-- max number of lines can be shown in a message
local MAX_EMAIL_LINES = 10
-- max number of messages per page
local MAX_MESSAGES_PAGE = 18
local IMP_EMAIL_INTRO = 0
local IMP_EMAIL_INTRO_LENGTH = 10
local ENRICO_CONGRATS = (IMP_EMAIL_INTRO + IMP_EMAIL_INTRO_LENGTH)
local ENRICO_CONGRATS_LENGTH = 3
local IMP_EMAIL_AGAIN = (ENRICO_CONGRATS + ENRICO_CONGRATS_LENGTH)
local IMP_EMAIL_AGAIN_LENGTH = 6
local MERC_INTRO = (IMP_EMAIL_AGAIN + IMP_EMAIL_AGAIN_LENGTH)
local MERC_INTRO_LENGTH = 5
local MERC_NEW_SITE_ADDRESS = ( MERC_INTRO + MERC_INTRO_LENGTH )
local MERC_NEW_SITE_ADDRESS_LENGTH = 2
local AIM_MEDICAL_DEPOSIT_REFUND = ( MERC_NEW_SITE_ADDRESS + MERC_NEW_SITE_ADDRESS_LENGTH )
local AIM_MEDICAL_DEPOSIT_REFUND_LENGTH = 3
local IMP_EMAIL_PROFILE_RESULTS = ( AIM_MEDICAL_DEPOSIT_REFUND + AIM_MEDICAL_DEPOSIT_REFUND_LENGTH )
local IMP_EMAIL_PROFILE_RESULTS_LENGTH = 1
local MERC_WARNING = ( IMP_EMAIL_PROFILE_RESULTS_LENGTH + IMP_EMAIL_PROFILE_RESULTS )
local MERC_WARNING_LENGTH = 2
local MERC_INVALID = ( MERC_WARNING + MERC_WARNING_LENGTH )
local MERC_INVALID_LENGTH = 2
local NEW_MERCS_AT_MERC = ( MERC_INVALID + MERC_INVALID_LENGTH )
local NEW_MERCS_AT_MERC_LENGTH = 2
local MERC_FIRST_WARNING = ( NEW_MERCS_AT_MERC + NEW_MERCS_AT_MERC_LENGTH )
local MERC_FIRST_WARNING_LENGTH = 2
-- merc up a level emails
local MERC_UP_LEVEL_BIFF = ( MERC_FIRST_WARNING + MERC_FIRST_WARNING_LENGTH )
local MERC_UP_LEVEL_LENGTH_BIFF = 2
local MERC_UP_LEVEL_HAYWIRE = ( MERC_UP_LEVEL_LENGTH_BIFF + MERC_UP_LEVEL_BIFF )
local MERC_UP_LEVEL_LENGTH_HAYWIRE = 2
local MERC_UP_LEVEL_GASKET = ( MERC_UP_LEVEL_LENGTH_HAYWIRE + MERC_UP_LEVEL_HAYWIRE )
local MERC_UP_LEVEL_LENGTH_GASKET = 2
local MERC_UP_LEVEL_RAZOR = ( MERC_UP_LEVEL_LENGTH_GASKET + MERC_UP_LEVEL_GASKET )
local MERC_UP_LEVEL_LENGTH_RAZOR = 2
local MERC_UP_LEVEL_FLO = ( MERC_UP_LEVEL_LENGTH_RAZOR + MERC_UP_LEVEL_RAZOR )
local MERC_UP_LEVEL_LENGTH_FLO = 2
local MERC_UP_LEVEL_GUMPY = ( MERC_UP_LEVEL_LENGTH_FLO + MERC_UP_LEVEL_FLO )
local MERC_UP_LEVEL_LENGTH_GUMPY = 2
local MERC_UP_LEVEL_LARRY = ( MERC_UP_LEVEL_LENGTH_GUMPY + MERC_UP_LEVEL_GUMPY )
local MERC_UP_LEVEL_LENGTH_LARRY = 2
local MERC_UP_LEVEL_COUGAR = ( MERC_UP_LEVEL_LENGTH_LARRY + MERC_UP_LEVEL_LARRY )
local MERC_UP_LEVEL_LENGTH_COUGAR = 2
local MERC_UP_LEVEL_NUMB = ( MERC_UP_LEVEL_LENGTH_COUGAR + MERC_UP_LEVEL_COUGAR )
local MERC_UP_LEVEL_LENGTH_NUMB = 2
local MERC_UP_LEVEL_BUBBA = ( MERC_UP_LEVEL_LENGTH_NUMB + MERC_UP_LEVEL_NUMB )
local MERC_UP_LEVEL_LENGTH_BUBBA = 2
-- merc left-me-a-message-and-now-I'm-back emails
local AIM_REPLY_BARRY = ( MERC_UP_LEVEL_LENGTH_BUBBA + MERC_UP_LEVEL_BUBBA )
local AIM_REPLY_LENGTH_BARRY = 2
local AIM_REPLY_MELTDOWN = (AIM_REPLY_BARRY + ( 39 * AIM_REPLY_LENGTH_BARRY ))
local AIM_REPLY_LENGTH_MELTDOWN = AIM_REPLY_LENGTH_BARRY
-- old EXISTING emails when player starts game. They must look "read"
local OLD_ENRICO_1 = ( AIM_REPLY_LENGTH_MELTDOWN + AIM_REPLY_MELTDOWN )
local OLD_ENRICO_1_LENGTH = 3
local OLD_ENRICO_2 = ( OLD_ENRICO_1 + OLD_ENRICO_1_LENGTH )
local OLD_ENRICO_2_LENGTH = 3
local RIS_REPORT = ( OLD_ENRICO_2 + OLD_ENRICO_2_LENGTH )
local RIS_REPORT_LENGTH = 2
local OLD_ENRICO_3 = ( RIS_REPORT + RIS_REPORT_LENGTH )
local OLD_ENRICO_3_LENGTH = 3
-- emails that occur from Enrico once player accomplishes things
local ENRICO_MIGUEL = ( OLD_ENRICO_3 + OLD_ENRICO_3_LENGTH )
local ENRICO_MIGUEL_LENGTH = 3
local ENRICO_PROG_20 = ( ENRICO_MIGUEL + ENRICO_MIGUEL_LENGTH )
local ENRICO_PROG_20_LENGTH = 3
local ENRICO_PROG_55 = ( ENRICO_PROG_20 + ENRICO_PROG_20_LENGTH )
local ENRICO_PROG_55_LENGTH = 3
local ENRICO_PROG_80 = ( ENRICO_PROG_55 + ENRICO_PROG_55_LENGTH )
local ENRICO_PROG_80_LENGTH = 3
local ENRICO_SETBACK = ( ENRICO_PROG_80 + ENRICO_PROG_80_LENGTH )
local ENRICO_SETBACK_LENGTH = 3
local ENRICO_SETBACK_2 = ( ENRICO_SETBACK + ENRICO_SETBACK_LENGTH )
local ENRICO_SETBACK_2_LENGTH = 3
local ENRICO_CREATURES = ( ENRICO_SETBACK_2 + ENRICO_SETBACK_2_LENGTH )
local ENRICO_CREATURES_LENGTH = 3
-- insurance company emails
local INSUR_PAYMENT = ( ENRICO_CREATURES + ENRICO_CREATURES_LENGTH )
local INSUR_PAYMENT_LENGTH = 3
local INSUR_SUSPIC = ( INSUR_PAYMENT + INSUR_PAYMENT_LENGTH )
local INSUR_SUSPIC_LENGTH = 3
local INSUR_INVEST_OVER = ( INSUR_SUSPIC + INSUR_SUSPIC_LENGTH )
local INSUR_INVEST_OVER_LENGTH = 3
local INSUR_SUSPIC_2 = ( INSUR_INVEST_OVER + INSUR_INVEST_OVER_LENGTH )
local INSUR_SUSPIC_2_LENGTH = 3
local BOBBYR_NOW_OPEN = ( INSUR_SUSPIC_2 + INSUR_SUSPIC_2_LENGTH )
local BOBBYR_NOW_OPEN_LENGTH = 3
local KING_PIN_LETTER = ( BOBBYR_NOW_OPEN + BOBBYR_NOW_OPEN_LENGTH )
local KING_PIN_LETTER_LENGTH = 4
local LACK_PLAYER_PROGRESS_1 = ( KING_PIN_LETTER + KING_PIN_LETTER_LENGTH )
local LACK_PLAYER_PROGRESS_1_LENGTH = 3
local LACK_PLAYER_PROGRESS_2 = ( LACK_PLAYER_PROGRESS_1 + LACK_PLAYER_PROGRESS_1_LENGTH )
local LACK_PLAYER_PROGRESS_2_LENGTH = 3
local LACK_PLAYER_PROGRESS_3 = ( LACK_PLAYER_PROGRESS_2 + LACK_PLAYER_PROGRESS_2_LENGTH )
local LACK_PLAYER_PROGRESS_3_LENGTH = 3
-- A package from Bobby Ray has arrived in Drassen
local BOBBYR_SHIPMENT_ARRIVED = ( LACK_PLAYER_PROGRESS_3 + LACK_PLAYER_PROGRESS_3_LENGTH )
local BOBBYR_SHIPMENT_ARRIVED_LENGTH = 4
-- John Kulba has left the gifts for the players in Drassen
local JOHN_KULBA_GIFT_IN_DRASSEN = ( BOBBYR_SHIPMENT_ARRIVED + BOBBYR_SHIPMENT_ARRIVED_LENGTH )
local JOHN_KULBA_GIFT_IN_DRASSEN_LENGTH = 4
-- When a merc dies on ANOTHER assignment ( ie not with the player )
local MERC_DIED_ON_OTHER_ASSIGNMENT = ( JOHN_KULBA_GIFT_IN_DRASSEN + JOHN_KULBA_GIFT_IN_DRASSEN_LENGTH )
local MERC_DIED_ON_OTHER_ASSIGNMENT_LENGTH = 5
local INSUR_1HOUR_FRAUD = ( MERC_DIED_ON_OTHER_ASSIGNMENT + MERC_DIED_ON_OTHER_ASSIGNMENT_LENGTH )
local INSUR_1HOUR_FRAUD_LENGTH = 3
-- When a merc is fired, and is injured
local AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND = ( INSUR_1HOUR_FRAUD + INSUR_1HOUR_FRAUD_LENGTH )
local AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND_LENGTH = 3
-- When a merc is fired, and is dead
local AIM_MEDICAL_DEPOSIT_NO_REFUND = ( AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND + AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND_LENGTH )
local AIM_MEDICAL_DEPOSIT_NO_REFUND_LENGTH = 3
local BOBBY_R_MEDUNA_SHIPMENT = ( AIM_MEDICAL_DEPOSIT_NO_REFUND + AIM_MEDICAL_DEPOSIT_NO_REFUND_LENGTH )
local BOBBY_R_MEDUNA_SHIPMENT_LENGTH = 4
local iStartingCash = 0
Fincances =
{
ACCRUED_INTEREST = 0,
ANONYMOUS_DEPOSIT = 1,
TRANSACTION_FEE = 2,
HIRED_MERC = 3,
BOBBYR_PURCHASE,
PAY_SPECK_FOR_MERC = 4,
MEDICAL_DEPOSIT = 5,
IMP_PROFILE = 6,
PURCHASED_INSURANCE = 7,
REDUCED_INSURANCE = 8,
EXTENDED_INSURANCE = 9,
CANCELLED_INSURANCE = 10,
INSURANCE_PAYOUT = 11,
EXTENDED_CONTRACT_BY_1_DAY = 12,
EXTENDED_CONTRACT_BY_1_WEEK = 13,
EXTENDED_CONTRACT_BY_2_WEEKS = 14,
DEPOSIT_FROM_GOLD_MINE = 15,
DEPOSIT_FROM_SILVER_MINE = 16,
PURCHASED_FLOWERS = 17,
FULL_MEDICAL_REFUND = 18,
PARTIAL_MEDICAL_REFUND = 19,
NO_MEDICAL_REFUND = 20,
PAYMENT_TO_NPC = 21,
TRANSFER_FUNDS_TO_MERC = 22,
TRANSFER_FUNDS_FROM_MERC = 23,
TRAIN_TOWN_MILITIA = 24,
PURCHASED_ITEM_FROM_DEALER = 25,
MERC_DEPOSITED_MONEY_TO_PLAYER_ACCOUNT = 26,
SOLD_ITEMS = 27,
FACILITY_OPERATIONS = 28,
MILITIA_UPKEEP = 29,
}
Sender =
{
MAIL_ENRICO = 0,
CHAR_PROFILE_SITE = 1,
GAME_HELP = 2,
IMP_PROFILE_RESULTS = 3,
SPECK_FROM_MERC = 4,
RIS_EMAIL = 5,
BARRY_MAIL = 6,
INSURANCE_COMPANY = 46,
BOBBY_R = 47,
KING_PIN = 48,
JOHN_KULBA = 49,
AIM_SITE = 50,
}
Modifier =
{
HOSPITAL_UNSET = 0,
HOSPITAL_NORMAL = 1,
HOSPITAL_BREAK = 2,
HOSPITAL_COST = 3,
HOSPITAL_FREEBIE = 4,
HOSPITAL_RANDOM_FREEBIE = 5,
}
SectorY =
{
MAP_ROW_A = 1,
MAP_ROW_B = 2,
MAP_ROW_C = 3,
MAP_ROW_D = 4,
MAP_ROW_E = 5,
MAP_ROW_F = 6,
MAP_ROW_G = 7,
MAP_ROW_H = 8,
MAP_ROW_I = 9,
MAP_ROW_J = 10,
MAP_ROW_K = 11,
MAP_ROW_L = 12,
MAP_ROW_M = 13,
MAP_ROW_N = 14,
MAP_ROW_O = 15,
MAP_ROW_P = 16,
}
Profil =
{
Skyrider = 97,
Micky = 96,
Gabby = 104,
Bob = 84,
Devin = 61,
}
local DIF_LEVEL_EASY = 1
local DIF_LEVEL_MEDIUM = 2
local DIF_LEVEL_HARD = 3
local DIF_LEVEL_INSANE = 4
function InitNPCs()
-- Add the pilot at a random location!
if is_networked == 0 then
o = math.random(1, 4)
if o == 1 then
-- B15 - Skyrider
AddNPCtoSector( Profil.Skyrider, 15, SectorY.MAP_ROW_B, 0 )
AddAltSectorNew( 15, SectorY.MAP_ROW_B )
elseif o == 2 then
-- E14 - Skyrider
AddNPCtoSector( Profil.Skyrider, 14, SectorY.MAP_ROW_E, 0 )
AddAltSectorNew( 14, SectorY.MAP_ROW_E )
elseif o == 3 then
-- D12 - Skyrider
AddNPCtoSector( Profil.Skyrider, 12, SectorY.MAP_ROW_D, 0 )
AddAltSectorNew( 12,SectorY.MAP_ROW_D )
elseif o == 4 then
-- C16 - Skyrider
AddNPCtoSector( Profil.Skyrider, 16, SectorY.MAP_ROW_C, 0 )
AddAltSectorNew( 16, SectorY.MAP_ROW_C )
end
end
if is_networked == 1 then
-- B15 - Skyrider
AddNPCtoSector( Profil.Skyrider, 15, SectorY.MAP_ROW_B, 0 )
AddAltSectorNew( 15, SectorY.MAP_ROW_B )
end
-- Set up Madlab's secret lab (he'll be added when the meanwhile scene occurs)
-- Use alternate map in this sector
if is_networked == 0 then
i = math.random(1, 4)
if i == 1 then
--H7
AddAltSectorNew( 7, SectorY.MAP_ROW_H )
elseif i == 2 then
--H16
AddAltSectorNew( 16, SectorY.MAP_ROW_H )
elseif i == 3 then
--I11
AddAltSectorNew( 11, SectorY.MAP_ROW_I )
elseif i == 4 then
--E4
AddAltSectorNew( 4, SectorY.MAP_ROW_E )
end
end
if is_networked == 1 then
--H7
AddAltSectorNew( 7, SectorY.MAP_ROW_H )
end
-- Add Micky in random location
if is_networked == 0 then
i = math.random(1, 5)
if i == 1 then
-- G9
AddNPCtoSector( Profil.Micky, 9, SectorY.MAP_ROW_G, 0 )
elseif i == 2 then
-- D14
AddNPCtoSector( Profil.Micky, 14, SectorY.MAP_ROW_D, 0 )
elseif i == 3 then
-- C5
AddNPCtoSector( Profil.Micky, 5, SectorY.MAP_ROW_C, 0 )
elseif i == 4 then
-- H2
AddNPCtoSector( Profil.Micky, 2, SectorY.MAP_ROW_H, 0 )
elseif i == 5 then
-- C6
AddNPCtoSector( Profil.Micky, 6, SectorY.MAP_ROW_C, 0 )
end
end
if is_networked == 1 then
-- G9
AddNPCtoSector( Profil.Micky, 9, SectorY.MAP_ROW_G, 0 )
end
PlayerTeamSawJoey(false)
-- Add Bob
if (newGAME_STYLE == 1 and iniENABLE_CREPITUS == 1) then
-- F8
AddNPCtoSector( Profil.Bob, 8, SectorY.MAP_ROW_F, 0 )
end
-- Add Gabby in random location
if (newGAME_STYLE == 1 and iniENABLE_CREPITUS == 1) then
i = math.random(1, 2)
if i == 1 then
-- H11
AddNPCtoSector( Profil.Gabby, 11, SectorY.MAP_ROW_H, 0 )
AddAltSectorNew( 11, SectorY.MAP_ROW_H )
elseif i == 2 then
-- I4
AddNPCtoSector( Profil.Gabby, 4, SectorY.MAP_ROW_I, 0 )
AddAltSectorNew( 4, SectorY.MAP_ROW_I )
end
end
-- Not SciFi, so use alternate map in Tixa's B1 level that doesn't have the stairs going down to the caves.
if (newGAME_STYLE == 0 and iniENABLE_CREPITUS == 0) then
--J9-1
AddAltUGSectorNew( 9, SectorY.MAP_ROW_J, 1 )
end
-- Init hospital variables
HospitalTempBalance( 0 )
HospitalRefund( 0 )
HospitalPriceModifier( Modifier.HOSPITAL_UNSET )
-- Set up Devin so he will be placed
SetNPCData1 ( Profil.Devin, 3 )
end
function InitNewGame()
if ( is_networked == 0 ) then
-- Setup two new messages!
AddPreReadEmail(OLD_ENRICO_1,OLD_ENRICO_1_LENGTH,Sender.MAIL_ENRICO)
AddPreReadEmail(OLD_ENRICO_2,OLD_ENRICO_2_LENGTH,Sender.MAIL_ENRICO)
AddPreReadEmail(RIS_REPORT,RIS_REPORT_LENGTH,Sender.RIS_EMAIL)
AddPreReadEmail(OLD_ENRICO_3,OLD_ENRICO_3_LENGTH,Sender.MAIL_ENRICO )
AddEmail (IMP_EMAIL_INTRO, IMP_EMAIL_INTRO_LENGTH, Sender.CHAR_PROFILE_SITE, -1)
if( iniMERC_WEBSITE_IMMEDIATELY_AVAILABLE == true ) then
AddEmail (MERC_INTRO, MERC_INTRO_LENGTH, Sender.SPECK_FROM_MERC, -1)
end
end
if ( newDIFFICULTY_LEVEL == DIF_LEVEL_EASY ) then
iStartingCash = GetStartingCashNovice()
elseif ( newDIFFICULTY_LEVEL == DIF_LEVEL_MEDIUM ) then
iStartingCash = GetStartingCashExperienced()
elseif ( newDIFFICULTY_LEVEL == DIF_LEVEL_HARD ) then
iStartingCash = GetStartingCashExpert()
elseif ( newDIFFICULTY_LEVEL == DIF_LEVEL_INSANE ) then
iStartingCash = GetStartingCashInsane()
end
AddTransactionToPlayersBook( Fincances.ANONYMOUS_DEPOSIT, 0, GetWorldTotalMin(), iStartingCash )
end
+58
View File
@@ -0,0 +1,58 @@
Facts =
{
FACT_BROTHEL_OPEN = 251,
FACT_MUSEUM_OPEN = 250,
FACT_CLUB_OPEN = 252,
FACT_PAST_CLUB_CLOSING_AND_PLAYER_WARNED = 107,
}
local p = 0
function HourlyQuestUpdate()
if (cHour >= 4 or cHour < 20) then
SetFactFalse( Facts.FACT_BROTHEL_OPEN )
else
SetFactTrue( Facts.FACT_BROTHEL_OPEN )
end
-- Bar/night club
if ( cHour > 15 or cHour < 2) then
SetFactTrue( Facts.FACT_CLUB_OPEN )
SetFactFalse( Facts.FACT_PAST_CLUB_CLOSING_AND_PLAYER_WARNED )
-- Reset boxes fought
for i = 0,3 do
-- Set false
gfBoxerFought(i,false)
end
-- If # of boxing matches the player has won is a multiple of
-- 3, and the boxers haven't rested, then make them rest
if ( gfBoxersResting == true ) then
-- Done resting now!
gfBoxersResting = false
gubBoxersRests = gubBoxersRests + 1
p = gubBoxingMatchesWon / 3
elseif ( p > gubBoxersRests ) then
-- Time for the boxers to rest!
gfBoxersResting = true
end
else
SetFactFalse( Facts.FACT_CLUB_OPEN )
end
-- Museum
if ( cHour >= 9 or cHour < 18 ) then
SetFactTrue( Facts.FACT_MUSEUM_OPEN )
else
SetFactFalse( Facts.FACT_MUSEUM_OPEN )
end
end
+155
View File
@@ -0,0 +1,155 @@
Video =
{
INTRO_NO_VIDEO = -1,
INTRO_REBEL_CRDT = 0,
INTRO_OMERTA = 1,
INTRO_PRAGUE_CRDT = 2,
INTRO_PRAGUE = 3,
-- There are no more videos shown for the begining
INTRO_END_END_SPEECH_MIGUEL = 4,
INTRO_END_END_SPEECH_NO_MIGUEL = 5,
INTRO_END_HELI_FLYBY = 6,
INTRO_END_SKYRIDER_HELICOPTER = 7,
INTRO_END_NOSKYRIDER_HELICOPTER = 8,
INTRO_SPLASH_SCREEN = 9,
INTRO_SPLASH_TALONSOFT = 10,
-- There are no more videos shown for the endgame
INTRO_LAST_END_GAME = 11,
INTRO_FIRST_VIDEO = 255,
}
IntroType =
{
INTRO_BEGINNING = 0, -- Set when viewing the intro at the begining of the game
INTRO_ENDING = 1, -- Set when viewing the end game video.
INTRO_SPLASH = 2,
}
ScreenTypes =
{
EDIT_SCREEN = 0,
SAVING_SCREEN = 1,
LOADING_SCREEN = 2,
ERROR_SCREEN = 3,
INIT_SCREEN = 4,
GAME_SCREEN = 5,
ANIEDIT_SCREEN = 6,
PALEDIT_SCREEN = 7,
DEBUG_SCREEN = 8,
MAP_SCREEN = 9,
LAPTOP_SCREEN = 10,
LOADSAVE_SCREEN = 11,
MAPUTILITY_SCREEN = 12,
FADE_SCREEN = 13,
MSG_BOX_SCREEN = 14,
MAINMENU_SCREEN = 15,
AUTORESOLVE_SCREEN = 16,
SAVE_LOAD_SCREEN = 17,
OPTIONS_SCREEN = 18,
SHOPKEEPER_SCREEN = 19,
SEX_SCREEN = 20,
GAME_INIT_OPTIONS_SCREEN = 21,
DEMO_EXIT_SCREEN = 22,
INTRO_SCREEN = 23,
CREDIT_SCREEN = 24,
}
function PrepareToExitIntroScreen()
if ( gbIntroScreenMode == IntroType.INTRO_BEGINNING ) then
SetIntroExitScreen ( ScreenTypes.INIT_SCREEN )
-- if its the intro at the begining of the game
elseif ( gbIntroScreenMode == IntroType.INTRO_SPLASH ) then
-- display a logo when exiting
DisplaySirtechSplashScreen()
SetDoneWithSplashScreen ( true )
SetIntroExitScreen ( ScreenTypes.INIT_SCREEN )
else
-- We want to reinitialize the game
ReStartingGame()
SetIntroExitScreen ( ScreenTypes.CREDIT_SCREEN )
end
SetIntroScreenExit (true)
end
function GetNextIntroVideo( uiCurrentVideo )
-- switch on whether it is the beginging or the end game video
if ( gbIntroScreenMode == IntroType.INTRO_BEGINNING ) then
-- the video at the begining of the game
if ( uiCurrentVideo == Video.INTRO_FIRST_VIDEO ) then
StartVideo()
SetVideo ( Video.INTRO_REBEL_CRDT )
elseif ( uiCurrentVideo == Video.INTRO_REBEL_CRDT ) then
SetVideo ( Video.INTRO_OMERTA )
elseif ( uiCurrentVideo == Video.INTRO_OMERTA ) then
SetVideo ( Video.INTRO_PRAGUE_CRDT )
elseif ( uiCurrentVideo == Video.INTRO_PRAGUE_CRDT ) then
SetVideo ( Video.INTRO_PRAGUE )
elseif ( uiCurrentVideo == Video.INTRO_PRAGUE ) then
SetVideo ( Video.INTRO_NO_VIDEO )
StopVideo()
end
-- end game
elseif ( gbIntroScreenMode == IntroType.INTRO_ENDING ) then
if ( uiCurrentVideo == Video.INTRO_FIRST_VIDEO ) then
StartVideo()
-- if Miguel is dead, play the flic with out him in it
if ( CheckMercIsDead(57) == true ) then -- MIGUEL
SetVideo ( Video.INTRO_END_END_SPEECH_NO_MIGUEL )
else
SetVideo ( Video.INTRO_END_END_SPEECH_MIGUEL )
end
elseif ( uiCurrentVideo == Video.INTRO_END_END_SPEECH_MIGUEL or uiCurrentVideo == Video.INTRO_END_END_SPEECH_NO_MIGUEL ) then
SetVideo ( Video.INTRO_END_HELI_FLYBY )
elseif ( uiCurrentVideo == Video.INTRO_END_HELI_FLYBY ) then
-- if SkyRider is dead, play the flic without him
if ( CheckMercIsDead(97) == true ) then --SKYRIDER
SetVideo ( Video.INTRO_END_NOSKYRIDER_HELICOPTER )
else
SetVideo ( Video.INTRO_END_SKYRIDER_HELICOPTER )
end
StopVideo()
end
elseif( gbIntroScreenMode == IntroType.INTRO_SPLASH ) then
if ( uiCurrentVideo == Video.INTRO_FIRST_VIDEO ) then
StartVideo()
SetVideo ( Video.INTRO_SPLASH_SCREEN )
elseif ( uiCurrentVideo == Video.INTRO_SPLASH_SCREEN ) then
SetVideo ( Video.INTRO_SPLASH_TALONSOFT )
StopVideo()
end
end
end
function SetIntroType( bIntroType )
if( bIntroType == IntroType.INTRO_BEGINNING ) then
SetIntroScreenMode ( IntroType.INTRO_BEGINNING )
elseif( bIntroType == IntroType.INTRO_ENDING ) then
SetIntroScreenMode ( IntroType.INTRO_ENDING )
elseif( bIntroType == IntroType.INTRO_SPLASH ) then
SetIntroScreenMode ( IntroType.INTRO_SPLASH )
end
end
+289
View File
@@ -0,0 +1,289 @@
local NPC_TALK_RADIUS = 4
local sDesiredMercDist
local NO_PROFILE = 200
Facts =
{
FACT_SKYRIDER_CLOSE_TO_CHOPPER = 43,
FACT_MARIA_ESCORTED_AT_LEATHER_SHOP = 117,
FACT_JOEY_NEAR_MARTHA = 110,
FACT_JOHN_ALIVE = 190,
FACT_MARY_OR_JOHN_ARRIVED = 192,
FACT_MARY_ALIVE = 187,
FACT_FIRST_ROBOT_DESTROYED = 203,
FACT_ROBOT_READY_SECOND_TIME = 205,
FACT_SECOND_ROBOT_DESTROYED = 206,
}
Attitude =
{
DEFENSIVE = 0,
BRAVESOLO = 1,
BRAVEAID = 2,
CUNNINGSOLO = 3,
CUNNINGAID = 4,
AGGRESSIVE = 5,
MAXATTITUDES = 6,
ATTACKSLAYONLY = 7,
}
Quests =
{
QUEST_DELIVER_LETTER = 0,
QUEST_FOOD_ROUTE = 1,
QUEST_KILL_TERRORISTS = 2,
QUEST_KINGPIN_IDOL = 3,
QUEST_KINGPIN_MONEY = 4,
QUEST_RUNAWAY_JOEY = 5,
QUEST_RESCUE_MARIA = 6,
QUEST_CHITZENA_IDOL = 7,
QUEST_HELD_IN_ALMA = 8,
QUEST_INTERROGATION = 9,
QUEST_ARMY_FARM = 10,
QUEST_FIND_SCIENTIST = 11,
QUEST_DELIVER_VIDEO_CAMERA = 12,
QUEST_BLOODCATS = 13,
QUEST_FIND_HERMIT = 14,
QUEST_CREATURES = 15,
QUEST_CHOPPER_PILOT = 16,
QUEST_ESCORT_SKYRIDER = 17,
QUEST_FREE_DYNAMO = 18,
QUEST_ESCORT_TOURISTS = 19,
QUEST_FREE_CHILDREN = 20,
QUEST_LEATHER_SHOP_DREAM = 21,
QUEST_KILL_DEIDRANNA = 25,
}
Profil =
{
MIGUEL = 57,
CARLOS = 58,
IRA = 59,
DIMITRI = 60,
SLAY = 64,
DYNAMO = 66,
SHANK = 67,
CARMEN = 78,
MARIA = 88,
ANGEL = 89,
JOEY = 90,
SKYRIDER = 97,
JOHN = 118,
MARY = 119,
JIM = 140,
JACK = 141,
OLAF = 142,
RAY = 143,
OLGA = 144,
TYRONE = 145,
MADLAB = 146,
}
What =
{
MERC_TYPE__PLAYER_CHARACTER = 0,
MERC_TYPE__AIM_MERC = 1,
MERC_TYPE__MERC = 2,
MERC_TYPE__NPC = 3,
MERC_TYPE__EPC = 4,
MERC_TYPE__NPC_WITH_UNEXTENDABLE_CONTRACT = 5,
MERC_TYPE__VEHICLE = 6,
}
Team =
{
OUR_TEAM = 0,
ENEMY_TEAM = 1,
CREATURE_TEAM = 2,
MILITIA_TEAM = 3,
CIV_TEAM = 4,
}
pQuest =
{
QUESTNOTSTARTED = 0,
QUESTINPROGRESS = 1,
QUESTDONE = 2,
}
Group =
{
NON_CIV_GROUP = 0,
REBEL_CIV_GROUP = 1,
KINGPIN_CIV_GROUP = 2,
SANMONA_ARMS_GROUP = 3,
ANGELS_GROUP = 4,
BEGGARS_CIV_GROUP = 5,
TOURISTS_CIV_GROUP = 6,
ALMA_MILITARY_CIV_GROUP = 7,
DOCTORS_CIV_GROUP = 8,
COUPLE1_CIV_GROUP = 9,
HICKS_CIV_GROUP = 10,
WARDEN_CIV_GROUP = 11,
JUNKYARD_CIV_GROUP = 12,
FACTORY_KIDS_GROUP = 13,
QUEENS_CIV_GROUP = 14,
}
Status =
{
CIV_GROUP_NEUTRAL = 0,
CIV_GROUP_WILL_EVENTUALLY_BECOME_HOSTILE = 1,
CIV_GROUP_WILL_BECOME_HOSTILE = 2,
CIV_GROUP_HOSTILE = 3,
}
SectorY =
{
MAP_ROW_A = 1,
MAP_ROW_B = 2,
MAP_ROW_C = 3,
MAP_ROW_D = 4,
MAP_ROW_E = 5,
MAP_ROW_F = 6,
MAP_ROW_G = 7,
MAP_ROW_H = 8,
MAP_ROW_I = 9,
MAP_ROW_J = 10,
MAP_ROW_K = 11,
MAP_ROW_L = 12,
MAP_ROW_M = 13,
MAP_ROW_N = 14,
MAP_ROW_O = 15,
MAP_ROW_P = 16,
}
-- local function
local function HandleJohnArrival( ID )
local ID2 = nil
local sDist
if ( not ID ) then
ID = FindSoldierByProfileID (Profil.JOHN)
if ( not ID ) then
return
end
end
if ( PythSpacesAway( ID,8228) < 40 ) then
if ( CheckFact( Facts.FACT_MARY_ALIVE, 0 ) == true ) then
ID2 = FindSoldierByProfileID( Profil.MARY )
if ( ID2 ) then
if ( PythSpacesAway( ID, GetNPCGridNo(ID2) ) > 8 ) then
-- Too far away!
return
end
end
end
SetFactTrue( Facts.FACT_MARY_OR_JOHN_ARRIVED )
ActionStopMerc(ID)
-- If Mary is alive/dead
if ( ID2 ) then
ActionStopMerc(ID2)
TriggerNPCRecord( ID, 13 )
else
TriggerNPCRecord( ID, 12 )
end
end
end
-- end local function
-- local function
local function HandleMaryArrival( ID )
local sDist
if ( not ID ) then
ID = FindSoldierByProfileID (Profil.MARY)
if ( not ID ) then
return
end
end
if ( CheckFact( Facts.FACT_JOHN_ALIVE,0) == true ) then
return
--new requirements: player close by
elseif ( PythSpacesAway( ID,8228) < 40 ) then
if ( not TileIsOutOfBounds ( ClosestPC( ID, sDist )) and sDist > NPC_TALK_RADIUS * 2 ) then
--too far away
return
end
SetFactTrue( Facts.FACT_MARY_OR_JOHN_ARRIVED )
ActionStopMerc(ID)
TriggerNPCRecord( ID, 13 )
end
end
-- end local function
function HandleAtNewGridNo( ProfileId )
TeamSoldier = FindSoldierTeam (ProfileId)
if ( TeamSoldier == Team.OUR_TEAM ) then -- Team
if ( WhatKindOfMercAmI (ProfileId) == What.MERC_TYPE__EPC ) then -- what EPC
-- Skyrider
if ( ProfileId == Profil.SKYRIDER and CheckNPCSectorBool( Profil.SKYRIDER, 13, SectorY.MAP_ROW_B, 0 ) == true and PythSpacesAway( Profil.SKYRIDER,8842 ) < 11 ) then
ActionStopMerc(Profil.SKYRIDER)
SetFactTrue( Facts.FACT_SKYRIDER_CLOSE_TO_CHOPPER )
TriggerNPCRecord( Profil.SKYRIDER, 15 )
SetUpHelicopterForPlayer( 13, SectorY.MAP_ROW_B )
elseif ( ProfileIdsSectorX == 13 and ProfileIdsSectorY == SectorY.MAP_ROW_B and ProfileIdbSectorZ == 0 ) then
-- Mary
if ( ProfileId == Profil.MARY ) then
HandleMaryArrival( Profil.MARY )
-- John
elseif ( ProfileId == Profil.JOHN ) then
HandleJohnArrival( Profil.JOHN )
end
-- Maria
elseif ( ProfileId == Profil.MARIA and CheckNPCSectorBool( Profil.MARIA, 6, SectorY.MAP_ROW_C, 0) == true and CheckFact(Facts.FACT_MARIA_ESCORTED_AT_LEATHER_SHOP,Profil.MARIA) == true ) then
if ( NPCInRoom( Profil.ANGEL, 2 ) == true ) then
TriggerNPCRecord( Profil.ANGEL, 12 )
end
-- Joey
elseif ( ProfileId == Profil.JOEY and CheckNPCSectorBool( Profil.JOEY, 8, SectorY.MAP_ROW_G, 0) == true and CheckFact(Facts.FACT_JOEY_NEAR_MARTHA,0) == true ) then
ActionStopMerc(Profil.JOEY)
TriggerNPCRecord( Profil.JOEY, 9 )
end
-- Drassen stuff for John & Mary
elseif ( CheckQuest(Quests.QUEST_ESCORT_TOURISTS) == pQuest.QUESTINPROGRESS and ProfileIdsSectorX == 13 and ProfileIdsSectorY == SectorY.MAP_ROW_B and ProfileIdbSectorZ == 0 ) then
if ( CheckFact( FACT_JOHN_ALIVE) == true ) then
HandleJohnArrival( nil )
else
HandleMaryArrival( nil )
end
elseif ( TeamSoldier == Team.CIV_TEAM and ProfileId ~= NO_PROFILE and CheckSoldierNeutral( ProfileId ) == true ) then
if ( ProfileId == Profil.JIM or ProfileId == Profil.JACK or ProfileId == Profil.OLAF or ProfileId == Profil.RAY or ProfileId == Profil.OLGA or ProfileId == Profil.TYRONE ) then
if ( not TileIsOutOfBounds( ClosestPC( ProfileId, sDesiredMercDist )) ) then
if ( sDesiredMercDist <= NPC_TALK_RADIUS * 2 ) then
CancelAIAction ( ProfileId )
AddToShouldBecomeHostileOrSayQuoteList( GetPlayerMercID(ProfileId) )
end
end
end
end -- End what EPC
end -- End team
end
@@ -0,0 +1,631 @@
math.randomseed( os.time() ); math.random(); math.random(); math.random()
local MAX_EMAIL_LINES = 10 -- Max number of lines can be shown in a message
local MAX_MESSAGES_PAGE = 18 -- Max number of messages per page
local IMP_EMAIL_INTRO = 0
local IMP_EMAIL_INTRO_LENGTH = 10
local ENRICO_CONGRATS = (IMP_EMAIL_INTRO + IMP_EMAIL_INTRO_LENGTH)
local ENRICO_CONGRATS_LENGTH = 3
local IMP_EMAIL_AGAIN = (ENRICO_CONGRATS + ENRICO_CONGRATS_LENGTH)
local IMP_EMAIL_AGAIN_LENGTH = 6
local MERC_INTRO = (IMP_EMAIL_AGAIN + IMP_EMAIL_AGAIN_LENGTH)
local MERC_INTRO_LENGTH = 5
local MERC_NEW_SITE_ADDRESS = ( MERC_INTRO + MERC_INTRO_LENGTH )
local MERC_NEW_SITE_ADDRESS_LENGTH = 2
local AIM_MEDICAL_DEPOSIT_REFUND = ( MERC_NEW_SITE_ADDRESS + MERC_NEW_SITE_ADDRESS_LENGTH )
local AIM_MEDICAL_DEPOSIT_REFUND_LENGTH = 3
local IMP_EMAIL_PROFILE_RESULTS = ( AIM_MEDICAL_DEPOSIT_REFUND + AIM_MEDICAL_DEPOSIT_REFUND_LENGTH )
local IMP_EMAIL_PROFILE_RESULTS_LENGTH = 1
local MERC_WARNING = ( IMP_EMAIL_PROFILE_RESULTS_LENGTH + IMP_EMAIL_PROFILE_RESULTS )
local MERC_WARNING_LENGTH = 2
local MERC_INVALID = ( MERC_WARNING + MERC_WARNING_LENGTH )
local MERC_INVALID_LENGTH = 2
local NEW_MERCS_AT_MERC = ( MERC_INVALID + MERC_INVALID_LENGTH )
local NEW_MERCS_AT_MERC_LENGTH = 2
local MERC_FIRST_WARNING = ( NEW_MERCS_AT_MERC + NEW_MERCS_AT_MERC_LENGTH )
local MERC_FIRST_WARNING_LENGTH = 2
-- merc up a level emails
local MERC_UP_LEVEL_BIFF = ( MERC_FIRST_WARNING + MERC_FIRST_WARNING_LENGTH )
local MERC_UP_LEVEL_LENGTH_BIFF = 2
local MERC_UP_LEVEL_HAYWIRE = ( MERC_UP_LEVEL_LENGTH_BIFF + MERC_UP_LEVEL_BIFF )
local MERC_UP_LEVEL_LENGTH_HAYWIRE = 2
local MERC_UP_LEVEL_GASKET = ( MERC_UP_LEVEL_LENGTH_HAYWIRE + MERC_UP_LEVEL_HAYWIRE )
local MERC_UP_LEVEL_LENGTH_GASKET = 2
local MERC_UP_LEVEL_RAZOR = ( MERC_UP_LEVEL_LENGTH_GASKET + MERC_UP_LEVEL_GASKET )
local MERC_UP_LEVEL_LENGTH_RAZOR = 2
local MERC_UP_LEVEL_FLO = ( MERC_UP_LEVEL_LENGTH_RAZOR + MERC_UP_LEVEL_RAZOR )
local MERC_UP_LEVEL_LENGTH_FLO = 2
local MERC_UP_LEVEL_GUMPY = ( MERC_UP_LEVEL_LENGTH_FLO + MERC_UP_LEVEL_FLO )
local MERC_UP_LEVEL_LENGTH_GUMPY = 2
local MERC_UP_LEVEL_LARRY = ( MERC_UP_LEVEL_LENGTH_GUMPY + MERC_UP_LEVEL_GUMPY )
local MERC_UP_LEVEL_LENGTH_LARRY = 2
local MERC_UP_LEVEL_COUGAR = ( MERC_UP_LEVEL_LENGTH_LARRY + MERC_UP_LEVEL_LARRY )
local MERC_UP_LEVEL_LENGTH_COUGAR = 2
local MERC_UP_LEVEL_NUMB = ( MERC_UP_LEVEL_LENGTH_COUGAR + MERC_UP_LEVEL_COUGAR )
local MERC_UP_LEVEL_LENGTH_NUMB = 2
local MERC_UP_LEVEL_BUBBA = ( MERC_UP_LEVEL_LENGTH_NUMB + MERC_UP_LEVEL_NUMB )
local MERC_UP_LEVEL_LENGTH_BUBBA = 2
-- Merc left-me-a-message-and-now-I'm-back emails
local AIM_REPLY_BARRY = ( MERC_UP_LEVEL_LENGTH_BUBBA + MERC_UP_LEVEL_BUBBA )
local AIM_REPLY_LENGTH_BARRY = 2
local AIM_REPLY_MELTDOWN = (AIM_REPLY_BARRY + ( 39 * AIM_REPLY_LENGTH_BARRY ))
local AIM_REPLY_LENGTH_MELTDOWN = AIM_REPLY_LENGTH_BARRY
-- Old EXISTING emails when player starts game. They must look "read"
local OLD_ENRICO_1 = ( AIM_REPLY_LENGTH_MELTDOWN + AIM_REPLY_MELTDOWN )
local OLD_ENRICO_1_LENGTH = 3
local OLD_ENRICO_2 = ( OLD_ENRICO_1 + OLD_ENRICO_1_LENGTH )
local OLD_ENRICO_2_LENGTH = 3
local RIS_REPORT = ( OLD_ENRICO_2 + OLD_ENRICO_2_LENGTH )
local RIS_REPORT_LENGTH = 2
local OLD_ENRICO_3 = ( RIS_REPORT + RIS_REPORT_LENGTH )
local OLD_ENRICO_3_LENGTH = 3
-- Emails that occur from Enrico once player accomplishes things
local ENRICO_MIGUEL = ( OLD_ENRICO_3 + OLD_ENRICO_3_LENGTH )
local ENRICO_MIGUEL_LENGTH = 3
local ENRICO_PROG_20 = ( ENRICO_MIGUEL + ENRICO_MIGUEL_LENGTH )
local ENRICO_PROG_20_LENGTH = 3
local ENRICO_PROG_55 = ( ENRICO_PROG_20 + ENRICO_PROG_20_LENGTH )
local ENRICO_PROG_55_LENGTH = 3
local ENRICO_PROG_80 = ( ENRICO_PROG_55 + ENRICO_PROG_55_LENGTH )
local ENRICO_PROG_80_LENGTH = 3
local ENRICO_SETBACK = ( ENRICO_PROG_80 + ENRICO_PROG_80_LENGTH )
local ENRICO_SETBACK_LENGTH = 3
local ENRICO_SETBACK_2 = ( ENRICO_SETBACK + ENRICO_SETBACK_LENGTH )
local ENRICO_SETBACK_2_LENGTH = 3
local ENRICO_CREATURES = ( ENRICO_SETBACK_2 + ENRICO_SETBACK_2_LENGTH )
local ENRICO_CREATURES_LENGTH = 3
-- Insurance company emails
local INSUR_PAYMENT = ( ENRICO_CREATURES + ENRICO_CREATURES_LENGTH )
local INSUR_PAYMENT_LENGTH = 3
local INSUR_SUSPIC = ( INSUR_PAYMENT + INSUR_PAYMENT_LENGTH )
local INSUR_SUSPIC_LENGTH = 3
local INSUR_INVEST_OVER = ( INSUR_SUSPIC + INSUR_SUSPIC_LENGTH )
local INSUR_INVEST_OVER_LENGTH = 3
local INSUR_SUSPIC_2 = ( INSUR_INVEST_OVER + INSUR_INVEST_OVER_LENGTH )
local INSUR_SUSPIC_2_LENGTH = 3
local BOBBYR_NOW_OPEN = ( INSUR_SUSPIC_2 + INSUR_SUSPIC_2_LENGTH )
local BOBBYR_NOW_OPEN_LENGTH = 3
local KING_PIN_LETTER = ( BOBBYR_NOW_OPEN + BOBBYR_NOW_OPEN_LENGTH )
local KING_PIN_LETTER_LENGTH = 4
local LACK_PLAYER_PROGRESS_1 = ( KING_PIN_LETTER + KING_PIN_LETTER_LENGTH )
local LACK_PLAYER_PROGRESS_1_LENGTH = 3
local LACK_PLAYER_PROGRESS_2 = ( LACK_PLAYER_PROGRESS_1 + LACK_PLAYER_PROGRESS_1_LENGTH )
local LACK_PLAYER_PROGRESS_2_LENGTH = 3
local LACK_PLAYER_PROGRESS_3 = ( LACK_PLAYER_PROGRESS_2 + LACK_PLAYER_PROGRESS_2_LENGTH )
local LACK_PLAYER_PROGRESS_3_LENGTH = 3
-- A package from bobby r has arrived in Drassen
local BOBBYR_SHIPMENT_ARRIVED = ( LACK_PLAYER_PROGRESS_3 + LACK_PLAYER_PROGRESS_3_LENGTH )
local BOBBYR_SHIPMENT_ARRIVED_LENGTH = 4
-- John Kulba has left the gifts for theplayers in drassen
local JOHN_KULBA_GIFT_IN_DRASSEN = ( BOBBYR_SHIPMENT_ARRIVED + BOBBYR_SHIPMENT_ARRIVED_LENGTH )
local JOHN_KULBA_GIFT_IN_DRASSEN_LENGTH = 4
-- When a merc dies on ANOTHER assignment ( ie not with the player )
local MERC_DIED_ON_OTHER_ASSIGNMENT = ( JOHN_KULBA_GIFT_IN_DRASSEN + JOHN_KULBA_GIFT_IN_DRASSEN_LENGTH )
local MERC_DIED_ON_OTHER_ASSIGNMENT_LENGTH = 5
local INSUR_1HOUR_FRAUD = ( MERC_DIED_ON_OTHER_ASSIGNMENT + MERC_DIED_ON_OTHER_ASSIGNMENT_LENGTH )
local INSUR_1HOUR_FRAUD_LENGTH = 3
-- When a merc is fired, and is injured
local AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND = ( INSUR_1HOUR_FRAUD + INSUR_1HOUR_FRAUD_LENGTH )
local AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND_LENGTH = 3
-- When a merc is fired, and is dead
local AIM_MEDICAL_DEPOSIT_NO_REFUND = ( AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND + AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND_LENGTH )
local AIM_MEDICAL_DEPOSIT_NO_REFUND_LENGTH = 3
local BOBBY_R_MEDUNA_SHIPMENT = ( AIM_MEDICAL_DEPOSIT_NO_REFUND + AIM_MEDICAL_DEPOSIT_NO_REFUND_LENGTH )
local BOBBY_R_MEDUNA_SHIPMENT_LENGTH = 4
History =
{
HISTORY_ENTERED_HISTORY_MODE = 0,
HISTORY_HIRED_MERC_FROM_AIM = 1,
HISTORY_HIRED_MERC_FROM_MERC = 2,
HISTORY_MERC_KILLED = 3,
HISTORY_SETTLED_ACCOUNTS_AT_MERC = 4,
HISTORY_ACCEPTED_ASSIGNMENT_FROM_ENRICO = 5,
HISTORY_CHARACTER_GENERATED = 6,
HISTORY_PURCHASED_INSURANCE = 7,
HISTORY_CANCELLED_INSURANCE = 8,
HISTORY_INSURANCE_CLAIM_PAYOUT = 9,
HISTORY_EXTENDED_CONTRACT_1_DAY = 10,
HISTORY_EXTENDED_CONTRACT_1_WEEK = 11,
HISTORY_EXTENDED_CONTRACT_2_WEEK = 12,
HISTORY_MERC_FIRED = 13,
HISTORY_MERC_QUIT = 14,
HISTORY_QUEST_STARTED = 15,
HISTORY_QUEST_FINISHED = 16,
HISTORY_TALKED_TO_MINER = 17,
HISTORY_LIBERATED_TOWN = 18,
HISTORY_CHEAT_ENABLED = 19,
HISTORY_TALKED_TO_FATHER_WALKER = 20,
HISTORY_MERC_MARRIED_OFF = 21,
HISTORY_MERC_CONTRACT_EXPIRED = 22,
HISTORY_RPC_JOINED_TEAM = 23,
HISTORY_ENRICO_COMPLAINED = 24,
HISTORY_WONBATTLE = 25,
HISTORY_MINE_RUNNING_OUT = 26,
HISTORY_MINE_RAN_OUT = 27,
HISTORY_MINE_SHUTDOWN = 28,
HISTORY_MINE_REOPENED = 29,
HISTORY_DISCOVERED_TIXA = 30,
HISTORY_DISCOVERED_ORTA = 31,
HISTORY_GOT_ROCKET_RIFLES = 32,
HISTORY_DEIDRANNA_DEAD_BODIES = 33,
HISTORY_BOXING_MATCHES = 34,
HISTORY_SOMETHING_IN_MINES = 35,
HISTORY_DEVIN = 36,
HISTORY_MIKE = 37,
HISTORY_TONY = 38,
HISTORY_KROTT = 39,
HISTORY_KYLE = 40,
HISTORY_MADLAB = 41,
HISTORY_GABBY = 42,
HISTORY_KEITH_OUT_OF_BUSINESS = 43,
HISTORY_HOWARD_CYANIDE = 44,
HISTORY_KEITH = 45,
HISTORY_HOWARD = 46,
HISTORY_PERKO = 47,
HISTORY_SAM = 48,
HISTORY_FRANZ = 49,
HISTORY_ARNOLD = 50,
HISTORY_FREDO = 51,
HISTORY_RICHGUY_BALIME = 52,
HISTORY_JAKE = 53,
HISTORY_BUM_KEYCARD = 54,
HISTORY_WALTER = 55,
HISTORY_DAVE = 56,
HISTORY_PABLO = 57,
HISTORY_KINGPIN_MONEY = 58,
HISTORY_WON_BOXING = 59,
HISTORY_LOST_BOXING = 60,
HISTORY_DISQUALIFIED_BOXING = 61,
HISTORY_FOUND_MONEY = 62,
HISTORY_ASSASSIN = 63,
HISTORY_LOSTTOWNSECTOR = 64,
HISTORY_DEFENDEDTOWNSECTOR = 65,
HISTORY_LOSTBATTLE = 66,
HISTORY_FATALAMBUSH = 67,
HISTORY_WIPEDOUTENEMYAMBUSH = 68,
HISTORY_UNSUCCESSFULATTACK = 69,
HISTORY_SUCCESSFULATTACK = 70,
HISTORY_CREATURESATTACKED = 71,
HISTORY_KILLEDBYBLOODCATS = 72,
HISTORY_SLAUGHTEREDBLOODCATS = 73,
HISTORY_NPC_KILLED = 74,
HISTORY_GAVE_CARMEN_HEAD = 75,
HISTORY_SLAY_MYSTERIOUSLY_LEFT = 76,
HISTORY_MERC_KILLED_CHARACTER = 77,
}
Sender =
{
MAIL_ENRICO = 0,
CHAR_PROFILE_SITE = 1,
GAME_HELP = 2,
IMP_PROFILE_RESULTS = 3,
SPECK_FROM_MERC = 4,
RIS_EMAIL = 5,
BARRY_MAIL = 6,
INSURANCE_COMPANY = 46,
BOBBY_R = 47,
KING_PIN = 48,
JOHN_KULBA = 49,
AIM_SITE = 50,
}
Items =
{
MONEY = 219,
SW38 = 5,
STUN_GRENADE = 131,
DESERTEAGLE = 7,
GASMASK = 213,
}
Profil =
{
FATHER = 100,
HAMOUS = 63,
PROF_ICECREAM = 162,
RAT = 81,
VINCE = 69,
STEVE = 80,
JENNY = 132,
DARREN = 87,
TONY = 91,
DEVIN = 61,
CARMEN = 78,
SAL = 99,
PABLO = 98,
SPIKE = 93,
ROBOT = 62,
JOEY = 90,
MADLAB = 146,
CONRAD = 70,
KINGPIN = 86,
MADAME = 107,
}
Facts =
{
FACT_VINCE_EXPECTING_MONEY = 149,
FACT_TONY_NOT_AVAILABLE = 86,
FACT_DAVE_HAS_GAS = 226,
FACT_PABLOS_BRIBED = 41,
FACT_PACKAGE_DAMAGED = 58,
FACT_SHIPMENT_DELAYED_24_HOURS = 56,
FACT_PACKAGE_LOST_PERMANENTLY = 58,
FACT_PABLO_RETURNED_GOODS = 39,
FACT_PABLO_PUNISHED_BY_PLAYER = 37,
FACT_REALLY_NEW_BOBBYRAY_SHIPMENT_WAITING = 34,
FACT_LARGE_SIZED_SHIPMENT_WAITING = 62,
FACT_LARGE_SIZED_OLD_SHIPMENT_WAITING = 35,
FACT_24_HOURS_SINCE_DOCTOR_TALKED_TO = 306,
FACT_24_HOURS_SINCE_JOEY_RESCUED = 305,
FACT_KINGPIN_KNOWS_MONEY_GONE = 103,
FACT_KINGPIN_DEAD = 308,
FACT_KINGPIN_CAN_SEND_ASSASSINS = 276,
FACT_FOOD_QUEST_OVER = 52,
FACT_WILLIS_HEARD_ABOUT_JOEY_RESCUE = 271,
FACT_BRENDA_PATIENCE_TIMER_EXPIRED = 360,
FACT_FIRST_ROBOT_DESTROYED = 203,
FACT_ROBOT_READY_SECOND_TIME = 205,
FACT_ROBOT_READY = 202,
FACT_JOEY_ESCORTED = 108,
FACT_KIDS_ARE_FREE = 318,
FACT_OK_USE_HUMMER = 224,
}
Flags2 =
{
PROFILE_MISC_FLAG2_DONT_ADD_TO_SECTOR = 0,
PROFILE_MISC_FLAG2_LEFT_COUNTRY = 1,
PROFILE_MISC_FLAG2_BANDAGED_TODAY = 2,
PROFILE_MISC_FLAG2_SAID_FIRSTSEEN_QUOTE = 3,
PROFILE_MISC_FLAG2_NEEDS_TO_SAY_HOSTILE_QUOTE = 4,
PROFILE_MISC_FLAG2_MARRIED_TO_HICKS = 5,
PROFILE_MISC_FLAG2_ASKED_BY_HICKS = 6,
}
SectorY =
{
MAP_ROW_A = 1,
MAP_ROW_B = 2,
MAP_ROW_C = 3,
MAP_ROW_D = 4,
MAP_ROW_E = 5,
MAP_ROW_F = 6,
MAP_ROW_G = 7,
MAP_ROW_H = 8,
MAP_ROW_I = 9,
MAP_ROW_J = 10,
MAP_ROW_K = 11,
MAP_ROW_L = 12,
MAP_ROW_M = 13,
MAP_ROW_N = 14,
MAP_ROW_O = 15,
MAP_ROW_P = 16,
}
NpcAction =
{
NPC_ACTION_ADD_JOEY_TO_WORLD = 136,
NPC_ACTION_RETURN_STOLEN_SHIPMENT_ITEMS = 108,
NPC_ACTION_SET_RANDOM_PACKAGE_DAMAGE_TIMER = 116,
NPC_ACTION_ENABLE_CAMBRIA_DOCTOR_BONUS = 139,
NPC_ACTION_TRIGGER_END_OF_FOOD_QUEST = 112,
NPC_ACTION_DELAYED_MAKE_BRENDA_LEAVE = 121,
NPC_ACTION_SET_DELAY_TILL_GIRLS_AVAILABLE = 126,
NPC_ACTION_SET_GIRLS_AVAILABLE = 125,
NPC_ACTION_READY_ROBOT = 194,
NPC_ACTION_SEND_ENRICO_MIGUEL_EMAIL = 230,
NPC_ACTION_TIMER_FOR_VEHICLE = 211,
NPC_ACTION_FREE_KIDS = 117,
}
Sectors =
{
HOSPITAL_SECTOR_X = 8,
HOSPITAL_SECTOR_Y = 6,
HOSPITAL_SECTOR_Z = 0,
}
EventTypes =
{
EVENT_SET_BY_NPC_SYSTEM = 27,
}
Group =
{
KINGPIN_CIV_GROUP = 2,
}
StatusGroup =
{
CIV_GROUP_NEUTRAL = 0,
CIV_GROUP_WILL_EVENTUALLY_BECOME_HOSTILE = 1,
CIV_GROUP_WILL_BECOME_HOSTILE = 2,
CIV_GROUP_HOSTILE = 3,
}
qStatus =
{
QUESTNOTSTARTED =0,
QUESTINPROGRESS = 1,
QUESTDONE = 2,
}
Quests =
{
QUEST_DELIVER_LETTER = 0,
QUEST_FOOD_ROUTE = 1,
QUEST_KILL_TERRORISTS = 2,
QUEST_KINGPIN_IDOL = 3,
QUEST_KINGPIN_MONEY = 4,
QUEST_RUNAWAY_JOEY = 5,
QUEST_RESCUE_MARIA = 6,
QUEST_CHITZENA_IDOL = 7,
QUEST_HELD_IN_ALMA = 8,
QUEST_INTERROGATION = 9,
QUEST_ARMY_FARM = 10,
QUEST_FIND_SCIENTIST = 11,
QUEST_DELIVER_VIDEO_CAMERA = 12,
QUEST_BLOODCATS = 13,
QUEST_FIND_HERMIT = 14,
QUEST_CREATURES = 15,
QUEST_CHOPPER_PILOT = 16,
QUEST_ESCORT_SKYRIDER = 17,
QUEST_FREE_DYNAMO = 18,
QUEST_ESCORT_TOURISTS = 19,
QUEST_FREE_CHILDREN = 20,
QUEST_LEATHER_SHOP_DREAM = 21,
QUEST_KILL_DEIDRANNA = 25,
}
ProfileType =
{
None = 0,
AIM = 1,
MERC = 2,
RPC = 3,
NPC = 4,
Vehicle = 5,
IMP = 6,
}
local MERC_OK = 0
local MERC_HAS_NO_TEXT_FILE = -1
local MERC_ANNOYED_BUT_CAN_STILL_CONTACT = -2
local MERC_ANNOYED_WONT_CONTACT = -3
local MERC_HIRED_BUT_NOT_ARRIVED_YET = -4
local MERC_IS_DEAD = -5
local MERC_RETURNING_HOME = -6
local MERC_WORKING_ELSEWHERE = -7
local MERC_FIRED_AS_A_POW = -8
local guiPabloExtraDaysBribed = 0
local BOBBYR_SHIPPING_DEST_SECTOR_X = 13
local BOBBYR_SHIPPING_DEST_SECTOR_Y = 2
local BOBBYR_SHIPPING_DEST_SECTOR_Z = 0
local BOBBYR_SHIPPING_DEST_GRIDNO = 10112
local PABLOS_STOLEN_DEST_GRIDNO = 1
local LOST_SHIPMENT_GRIDNO = 2
local NPC_SYSTEM_EVENT_ACTION_PARAM_BONUS = 10000
local gubCambriaMedicalObjects
function HandleEarlyMorningEvents()
for i = 0, 254 do
if ( WhoIs(ProfileType.RPC,i) == i or WhoIs(ProfileType.NPC,i) == i or WhoIs(ProfileType.Vehicle,i) == i ) then
-- Set FALSE
-- Loop through all *NPCs* and reset "default response used recently" flags
SetThreatenDefaultResponseUsedRecently(i,false)
SetRecruitDefaultResponseUsedRecently(i,false)
SetFriendlyOrDirectDefaultResponseUsedRecently(i,false)
SetMiscFlags2(i,Flags2.PROFILE_MISC_FLAG2_BANDAGED_TODAY)
end
end
r = math.random(1, 4)
SetNPCData1(Profil.FATHER,r)
-- Set Walker's location
o = math.random(1, 2)
if (o > 1) then
-- Move the father to the other sector, provided neither are loaded
if (not ( ( gWorldSectorX == 13) and ( ( gWorldSectorY == 3) or gWorldSectorY == 4 ) and ( gbWorldSectorZ == 0 ) )) then
SetCharacterSectorX(Profil.FATHER,13)
SectorY = CheckCharacterSectorY(Profil.FATHER)
-- Swap his location
if ( SectorY == 3 ) then
SetCharacterSectorY(Profil.FATHER,4)
else
SetCharacterSectorY(Profil.FATHER,3)
end
end
end
if ( CheckLastDateSpokenTot(Profil.TONY) > 0 and not ( gWorldSectorX == 5 and gWorldSectorY == 3 and gWorldSectorZ == 0 )) then
-- San Mona C5 is not loaded so make Tony possibly not available
p = math.random(0, 100)
if ( p <= iniCHANCE_TONY_AVAILABLE ) then
-- Tony IS available
SetFactFalse( Facts.FACT_TONY_NOT_AVAILABLE )
AddNPCtoSector (Profil.TONY,5,3,0)
else
-- Tony is NOT available
SetFactTrue( Facts.FACT_TONY_NOT_AVAILABLE )
AddNPCtoSector (Profil.TONY,0,0,0)
end
end
if ( CheckLastDateSpokenTot(Profil.DEVIN) == 0 ) then
DData = CheckNPCData1 (Profil.DEVIN)
i = DData + 1
SetNPCData1 (Profil.DEVIN,i)
if ( CheckNPCData1 (Profil.DEVIN) > 3 ) then
Devinid,Devinx,Deviny,Devinz = CheckNPCinSector(Profil.DEVIN)
if ( not ( (gWorldSectorX == Devinx) and (gWorldSectorY == Deviny) and (gWorldSectorZ == 0) ) ) then
-- Ok, Devin's sector not loaded, so time to move!
-- Might be same sector as before, if so, oh well!
p = math.random(1, 5)
if ( p == 1 ) then
--G9
AddNPCtoSector (Profil.DEVIN,9,7,0)
elseif ( p == 2 ) then
--D13
AddNPCtoSector (Profil.DEVIN,13,4,0)
elseif ( p == 3 ) then
--C5
AddNPCtoSector (Profil.DEVIN,5,3,0)
elseif ( p == 4 ) then
--H2
AddNPCtoSector (Profil.DEVIN,2,8,0)
elseif ( p == 5 ) then
--C6
AddNPCtoSector (Profil.DEVIN,6,3,0)
end
end
end
end
-- Stop moving the truck if Hamous is dead!!
-- Stop moving them if the player has the truck or Hamous is hired!
HAMOUSid,HAMOUSx,HAMOUSy,HAMOUSz = CheckNPCinSector(Profil.HAMOUS)
if ( CheckNPCLife(Profil.HAMOUS) > 0 and CheckMercIsDead (Profil.HAMOUS) == false and CheckMercIsDead (Profil.PROF_ICECREAM) == false and (not ( (gWorldSectorX == HAMOUSx) and (gWorldSectorY == HAMOUSy) and (gWorldSectorZ == 0) )) ) then
-- Ok, HAMOUS's sector not loaded, so time to move!
-- Might be same sector as before, if so, oh well!
i = math.random(1, 5)
if i == 1 then
-- G6
AddNPCtoSector (Profil.HAMOUS,6,7,0)
AddNPCtoSector (Profil.PROF_ICECREAM,6,7,0)
elseif i == 2 then
-- F12
AddNPCtoSector (Profil.HAMOUS,12,6,0)
AddNPCtoSector (Profil.PROF_ICECREAM,12,6,0)
elseif i == 3 then
-- D7
AddNPCtoSector (Profil.HAMOUS,7,4,0)
AddNPCtoSector (Profil.PROF_ICECREAM,7,4,0)
elseif i == 4 then
-- D3
AddNPCtoSector (Profil.HAMOUS,3,4,0)
AddNPCtoSector (Profil.PROF_ICECREAM,3,4,0)
elseif i == 5 then
-- D9
AddNPCtoSector (Profil.HAMOUS,9,4,0)
AddNPCtoSector (Profil.PROF_ICECREAM,9,4,0)
end
end
-- Does Rat take off?
if ( CheckNPCData1 (Profil.RAT) > 0) then
SetCharacterSectorX (Profil.RAT,0)
SetCharacterSectorY (Profil.RAT,0)
SetCharacterSectorZ (Profil.RAT,0)
end
-- Empty money from pockets of Vince 69, Willis 80, and Jenny 132
SetMoneyInSoldierProfile( Profil.VINCE, 0 )
SetMoneyInSoldierProfile( Profil.STEVE, 0 )
SetMoneyInSoldierProfile( Profil.JENNY, 0 )
-- Vince is no longer expecting money
SetFactFalse( Facts.FACT_VINCE_EXPECTING_MONEY )
-- Reset Darren's balance and money
SetNPCBalance(Profil.DARREN,0)
SetMoneyInSoldierProfile( Profil.DARREN, 15000 )
-- Set Carmen to be placed on the map in case he moved and is waiting off screen
if CheckMiscFlags2(Profil.CARMEN,Flags2.PROFILE_MISC_FLAG2_DONT_ADD_TO_SECTOR) == true then
SetMiscFlags2(Profil.CARMEN, Flags2.PROFILE_MISC_FLAG2_DONT_ADD_TO_SECTOR)
-- Move Carmen to C13
AddNPCtoSector (Profil.CARMEN,13,3,0)
-- We should also reset # of terrorist heads and give him cash
if CheckNPCData2 (Profil.CARMEN) > 0 then
Money = CheckMoney(Profil.CARMEN)
if (Money < 10000 ) then
uiAmount = 0
else
uiAmount = Money
end
uiAmount = uiAmount + 10000 * CheckNPCData2( Profil.CARMEN )
SetMoneyInSoldierProfile( Profil.CARMEN, uiAmount )
SetNPCData2(Profil.CARMEN,0)
for i = 249, 254 do
RemoveObjectFromSoldierProfile( Profil.CARMEN, i )
end
end
else
-- Randomize where he'll be today... so long as his sector's not loaded
CARMENid,CARMENx,CARMENy,CARMENz = CheckNPCinSector(Profil.CARMEN)
if ( CARMENx ~= gWorldSectorX or CARMENy ~= gWorldSectorY ) then
i = math.random(1, 3)
if i == 1 then
AddNPCtoSector (Profil.CARMEN,5,3,0) -- C5
elseif i == 2 then
AddNPCtoSector (Profil.CARMEN,13,3,0) -- C13
elseif i == 3 then
AddNPCtoSector (Profil.CARMEN,9,7,0) -- G9
end
-- He should have $5000... unless the player forgot to meet him
if ( CheckMoney(Profil.CARMEN) < 5000 ) then
SetMoneyInSoldierProfile( Profil.CARMEN, 5000 )
end
end
end
i = math.random(1, 3)
if i == 1 then
SetFactTrue( Facts.FACT_DAVE_HAS_GAS )
else
SetFactFalse( Facts.FACT_DAVE_HAS_GAS )
end
if ( gWorldSectorX == Sectors.HOSPITAL_SECTOR_X and gWorldSectorY == Sectors.HOSPITAL_SECTOR_Y and gWorldSectorZ == Sectors.HOSPITAL_SECTOR_Z ) then
CheckForMissingHospitalSupplies()
end
end
@@ -0,0 +1,338 @@
--[[
http://www.legion.zone.zg.pl/doku.php/modowanie/ja/art_ja_m_22_lua
**********************
** Global variables **
**********************
- giLairID
1 = Drassen
2 = Cambria
3 = Alma
4 = Grumm
***************
** Functions **
***************
- SectorEnemyControlled ( IDSector )
check if enemy controls sector
- SECTOR( SectorX, SectorY )
- CheckMercIsDead (ProfilID)
check merc is dead
- AffectAllTownsLoyaltyByDistanceFrom( iLoyaltyChange, sSectorX, sSectorY, bSectorZ )
- IncrementTownLoyaltyEverywhere( idLoyalty )
increment all town loyalty
- IncrementTownLoyalty ( idLoyalty )
increment town loyalty
- DecrementTownLoyalty ( idTown, idLoyalty )
decrement town loyalty
- DecrementTownLoyaltyEverywhere ( idLoyalty )
decrement all town loyalty
- SetTownLoyalty ( idTown, idLoyalty )
set town loyalty
**************
** Examples **
**************
if SectorEnemyControlled ( SECTOR(4,13) ) == false then
-- instructions
end
if SectorEnemyControlled ( SECTOR(4,13) ) == false then
-- instructions
else
-- instructions
end
if ( CheckMercIsDead (101) == true ) then
-- merc is dead
else
-- instructions
end
-- 1 * 500 = 500 = 4%
DecrementTownLoyaltyEverywhere ( 1 )
-- 10 * 500 = 5000 = 45%
IncrementTownLoyalty (10)
-- 20 * 500 = 10000 = 90%
DecrementTownLoyalty ( 2 , 20 )
-- 30 * 500 = 15000 = 100%
IncrementTownLoyaltyEverywhere (30)
-- 100 = 100%
SetTownLoyalty ( 1, 100 )
-- 30 = 30%
SetTownLoyalty ( 1, 30 )
EventGlobal =
{
GLOBAL_LOYALTY_BATTLE_WON = 0,
.
.
MY_GLOBAL_LOYALTY_13 = 13,
MY_GLOBAL_LOYALTY_14 = 14,
.
. .
MY_GLOBAL_LOYALTY_100 = 100,
}
]]
Profil =
{
MIGUEL = 57,
DOREEN = 139,
MARTHA = 109,
KEITH = 147,
YANNI = 108,
AUNTIE = 76,
MATT = 148,
JOEY = 90,
}
Town =
{
OMERTA = 1,
DRASSEN = 2,
ALMA = 3,
GRUMM = 4,
CAMBRIA = 6,
SANMONA = 7,
ESTONI = 8,
BALIME = 10,
MEDUNa = 11,
CHITZENA = 12,
}
-- gain pts per real loyalty pt
local GAIN_PTS_PER_LOYALTY_PT = 500
-- --- LOYALTY BONUSES ---
-- Omerta
local LOYALTY_BONUS_MIGUEL_READS_LETTER = (10 * GAIN_PTS_PER_LOYALTY_PT) -- multiplied by 4.5 due to Omerta's high seniment, so it's 45%
-- Drassen
local LOYALTY_BONUS_CHILDREN_FREED_DOREEN_KILLED = (10 * GAIN_PTS_PER_LOYALTY_PT) -- +50% bonus for Drassen -- Overhead.cpp
local LOYALTY_BONUS_CHILDREN_FREED_DOREEN_SPARED = (20 * GAIN_PTS_PER_LOYALTY_PT) -- +50% bonus for Drassen -- Overhead.cpp
-- Cambria
local LOYALTY_BONUS_MARTHA_WHEN_JOEY_RESCUED = (15 * GAIN_PTS_PER_LOYALTY_PT) -- -25% for low Cambria sentiment
local LOYALTY_BONUS_KEITH_WHEN_HILLBILLY_SOLVED = (15 * GAIN_PTS_PER_LOYALTY_PT) -- -25% for low Cambria sentiment
-- Chitzena
local LOYALTY_BONUS_YANNI_WHEN_CHALICE_RETURNED_LOCAL = (20 * GAIN_PTS_PER_LOYALTY_PT) -- +75% higher in Chitzena -- no used
local LOYALTY_BONUS_YANNI_WHEN_CHALICE_RETURNED_GLOBAL = (10 * GAIN_PTS_PER_LOYALTY_PT) -- for ALL towns!
-- Alma
local LOYALTY_BONUS_AUNTIE_WHEN_BLOODCATS_KILLED = (20 * GAIN_PTS_PER_LOYALTY_PT) -- Alma's increases reduced by half due to low rebel sentiment
local LOYALTY_BONUS_MATT_WHEN_DYNAMO_FREED = (20 * GAIN_PTS_PER_LOYALTY_PT) -- Alma's increases reduced by half due to low rebel sentiment
local LOYALTY_BONUS_FOR_SERGEANT_KROTT = (20 * GAIN_PTS_PER_LOYALTY_PT) -- Alma's increases reduced by half due to low rebel sentiment (Interface Dialogue.cpp)
-- Everywhere
local LOYALTY_BONUS_TERRORISTS_DEALT_WITH = ( 5 * GAIN_PTS_PER_LOYALTY_PT)
local LOYALTY_BONUS_KILL_QUEEN_MONSTER = (10 * GAIN_PTS_PER_LOYALTY_PT)
-- Anywhere
-- Loyalty bonus for completing town training
local LOYALTY_BONUS_FOR_TOWN_TRAINING = ( 2 * GAIN_PTS_PER_LOYALTY_PT ) -- 2% (Town Militia.cpp i Map Screen Interface Map.cpp)
EventGlobal =
{
-- There are only for distance-adjusted global loyalty effects. Others go into list above instead!
GLOBAL_LOYALTY_BATTLE_WON = 0,
GLOBAL_LOYALTY_BATTLE_LOST = 1,
GLOBAL_LOYALTY_ENEMY_KILLED = 2,
GLOBAL_LOYALTY_NATIVE_KILLED = 3,
GLOBAL_LOYALTY_GAIN_TOWN_SECTOR = 4,
GLOBAL_LOYALTY_LOSE_TOWN_SECTOR = 5,
GLOBAL_LOYALTY_LIBERATE_WHOLE_TOWN = 6,
GLOBAL_LOYALTY_ABANDON_MILITIA = 7,
GLOBAL_LOYALTY_GAIN_MINE = 8,
GLOBAL_LOYALTY_LOSE_MINE = 9,
GLOBAL_LOYALTY_GAIN_SAM = 10,
GLOBAL_LOYALTY_LOSE_SAM = 11,
GLOBAL_LOYALTY_QUEEN_BATTLE_WON = 12,
GLOBAL_LOYALTY_GRIZZLY_DEAD = 13,
}
function CheckConditionsForTriggeringCreatureQuest( sSectorX, sSectorY, bSectorZ )
local ubValidMines = 0
if ( newGAME_STYLE == 0 or iniENABLE_CREPITUS == 0 ) then
return -- No scifi, no creatures...
end
if ( giLairID ) then
return -- Creature quest already begun
end
-- Count the number of "infectible mines" the player occupies
-- SEC_D13
if SectorEnemyControlled ( SECTOR(4,13) ) == false then
ubValidMines = ubValidMines + 1
end
-- SEC_H8
if SectorEnemyControlled ( SECTOR(8,8) ) == false then
ubValidMines = ubValidMines + 1
end
-- SEC_I14
if SectorEnemyControlled ( SECTOR(9,14) ) == false then
ubValidMines = ubValidMines + 1
end
-- SEC_H3
if SectorEnemyControlled ( SECTOR(8,3) ) == false then
ubValidMines = ubValidMines + 1
end
if ( ubValidMines >= 3 ) then
InitCreatureQuest()
end
end
function HandleGlobalLoyaltyEvent( ubEventType, sSectorX, sSectorY, bSectorZ )
local iLoyaltyChange = 0
if ubEventType == EventGlobal.GLOBAL_LOYALTY_BATTLE_WON then
CheckConditionsForTriggeringCreatureQuest( sSectorX, sSectorY, bSectorZ )
iLoyaltyChange = 500
AffectAllTownsLoyaltyByDistanceFrom( iLoyaltyChange, sSectorX, sSectorY, bSectorZ )
elseif ubEventType == EventGlobal.GLOBAL_LOYALTY_QUEEN_BATTLE_WON then
CheckConditionsForTriggeringCreatureQuest( sSectorX, sSectorY, bSectorZ )
iLoyaltyChange = 1000
AffectAllTownsLoyaltyByDistanceFrom( iLoyaltyChange, sSectorX, sSectorY, bSectorZ )
elseif ubEventType == EventGlobal.GLOBAL_LOYALTY_BATTLE_LOST then
iLoyaltyChange = -750
AffectAllTownsLoyaltyByDistanceFrom( iLoyaltyChange, sSectorX, sSectorY, bSectorZ )
elseif ubEventType == EventGlobal.GLOBAL_LOYALTY_ENEMY_KILLED then
iLoyaltyChange = 50
AffectAllTownsLoyaltyByDistanceFrom( iLoyaltyChange, sSectorX, sSectorY, bSectorZ )
elseif ubEventType == EventGlobal.GLOBAL_LOYALTY_NATIVE_KILLED then
-- Note that there is special code (much more severe) for murdering civilians in the currently loaded sector.
-- This event is intended more for processing militia casualties, and the like
iLoyaltyChange = -50
AffectAllTownsLoyaltyByDistanceFrom( iLoyaltyChange, sSectorX, sSectorY, bSectorZ )
elseif ubEventType == EventGlobal.GLOBAL_LOYALTY_ABANDON_MILITIA then
-- It doesn't matter how many of them are being abandoned
iLoyaltyChange = -750
AffectAllTownsLoyaltyByDistanceFrom( iLoyaltyChange, sSectorX, sSectorY, bSectorZ )
elseif ubEventType == EventGlobal.GLOBAL_LOYALTY_GAIN_TOWN_SECTOR then
iLoyaltyChange = 500
AffectAllTownsLoyaltyByDistanceFrom( iLoyaltyChange, sSectorX, sSectorY, bSectorZ )
elseif ubEventType == EventGlobal.GLOBAL_LOYALTY_LOSE_TOWN_SECTOR then
iLoyaltyChange = -1000
AffectAllTownsLoyaltyByDistanceFrom( iLoyaltyChange, sSectorX, sSectorY, bSectorZ )
elseif ubEventType == EventGlobal.GLOBAL_LOYALTY_LIBERATE_WHOLE_TOWN then
iLoyaltyChange = 1000
AffectAllTownsLoyaltyByDistanceFrom( iLoyaltyChange, sSectorX, sSectorY, bSectorZ )
elseif ubEventType == EventGlobal.GLOBAL_LOYALTY_GAIN_MINE then
iLoyaltyChange = 1000
AffectAllTownsLoyaltyByDistanceFrom( iLoyaltyChange, sSectorX, sSectorY, bSectorZ )
elseif ubEventType == EventGlobal.GLOBAL_LOYALTY_LOSE_MINE then
iLoyaltyChange = -1500
AffectAllTownsLoyaltyByDistanceFrom( iLoyaltyChange, sSectorX, sSectorY, bSectorZ )
elseif ubEventType == EventGlobal.GLOBAL_LOYALTY_GAIN_SAM then
iLoyaltyChange = 250
AffectAllTownsLoyaltyByDistanceFrom( iLoyaltyChange, sSectorX, sSectorY, bSectorZ )
elseif ubEventType == EventGlobal.GLOBAL_LOYALTY_LOSE_SAM then
iLoyaltyChange = -250
AffectAllTownsLoyaltyByDistanceFrom( iLoyaltyChange, sSectorX, sSectorY, bSectorZ )
elseif ubEventType == EventGlobal.GLOBAL_LOYALTY_GRIZZLY_DEAD then
if ( CheckMercIsDead(3) == false ) then
iLoyaltyChange = 1000
AffectAllTownsLoyaltyByDistanceFrom( iLoyaltyChange, sSectorX, sSectorY, bSectorZ )
end
end
end
function HandleLoyaltyChangeForNPCAction( ubNPCProfileId )
-- Omerta loyalty increases when Miguel receives letter from Enrico
if ubNPCProfileId == Profil.MIGUEL then
IncrementTownLoyalty ( Town.OMERTA, LOYALTY_BONUS_MIGUEL_READS_LETTER )
end
-- Having freed the child labourers... she is releasing them herself!
if ubNPCProfileId == Profil.DOREEN then
IncrementTownLoyalty( Town.DRASSEN, LOYALTY_BONUS_CHILDREN_FREED_DOREEN_SPARED )
end
-- If Joey is still alive
if ubNPCProfileId == Profil.MARTHA then
if ( CheckMercIsDead(Profil.JOEY) == false ) then
IncrementTownLoyalty( Town.CAMBRIA, LOYALTY_BONUS_MARTHA_WHEN_JOEY_RESCUED )
end
end
-- Hillbilly problem solved
if ubNPCProfileId == Profil.KEITH then
IncrementTownLoyalty( Town.CAMBRIA, LOYALTY_BONUS_KEITH_WHEN_HILLBILLY_SOLVED )
end
-- Chalice of Chance returned to Chitzena
if ubNPCProfileId == Profil.YANNI then
IncrementTownLoyalty( Town.CHITZENA, LOYALTY_BONUS_YANNI_WHEN_CHALICE_RETURNED_LOCAL )
-- NOTE: This affects Chitzena,too, a second time, so first value is discounted for it
IncrementTownLoyaltyEverywhere( LOYALTY_BONUS_YANNI_WHEN_CHALICE_RETURNED_GLOBAL )
end
-- Bloodcats killed
if ubNPCProfileId == Profil.AUNTIE then
IncrementTownLoyalty( Town.ALMA, LOYALTY_BONUS_AUNTIE_WHEN_BLOODCATS_KILLED )
end
-- Brother Dynamo freed
if ubNPCProfileId == Profil.MATT then
IncrementTownLoyalty( Town.ALMA, LOYALTY_BONUS_MATT_WHEN_DYNAMO_FREED )
end
end
+353
View File
@@ -0,0 +1,353 @@
--[[
*************
** Remarks **
*************
The purpose of this Lua script is to provide the code and data needed to
initialize the strategic mines. There are two reasons for the game to make
calls to this script:
1. The strategic layer gets initialized.
Right after a new game is started, the program calls InitializeMines to
gather the data defining the mines (see §1.). It then uses that data to
actually create the mines.
2. The player enters a mine sector.
When a mine sector gets loaded (tactical mode), the program calls
InitializeHeadMiners to collect information on creation of head miners
and how to distribute them among the mines (see §2.).
**********************
** Global variables **
**********************
- newDIFFICULTY_LEVEL (Start new game setting)
1 = easy
2 = experienced
3 = expert
4 = insane
- iniWHICH_MINE_SHUTS_DOWN (ja2_options.ini setting)
-1 = Game chooses a mine randomly.
0 = No mine will shut down!
2 = Drassen
3 = Alma
4 = Cambria
5 = Chitzena
6 = Grumm
]]
-- For debugging purposes you might want to have some basic logging output
-- from the game. Uncommenting the following line will create "initmines.log"
-- in your profile directory.
--logging = true
----------------------------------------
-- §0. Some setup code to get started --
----------------------------------------
-- Initialize the pseudo random number generator
math.randomseed( os.time() ); math.random(); math.random(); math.random()
-- http://lua-users.org/wiki/MathLibraryTutorial
MineType = { Silver = 0, Gold = 1 }
-----------------------------
-- §1. Mine initialization --
-----------------------------
--[[
function InitializeMines()
Gets called on initialization of strategic layer.
This function is supposed to return an array table of initialization data
for each mine. Every element itself must be a table consisting of the
following members:
- Location (required)
String, defining the sector to place the mine, e.g. "A10".
- Type
Use MineType.Gold or MineType.Silver (cp. §0.).
- MaxRemovalRate
Amount of income to be gained at each production period ( = 1/4 of
daily income).
- RemainingOreSupply
Total amount of money available to be extracted.
- Infectible (0/1)
Boolean, specifying whether or not a mine can be infected by crepitus.
This is kind of a hack until creature quest becomes externalized.
Do not set this to 1 for mines other than Drassen, Alma, Cambria, Grumm.
- AssociatedUnderground
Array table of strings specifying sector coordinates, e.g. "A10-1".
This relates underground sectors to the mine. In these sectors the game
adds miners working underground, and also uses that information to build
the sector name.
]]
function InitializeMines()
--------------------------------------
-- §1.1. Set up initial mine status --
--------------------------------------
local mines =
{
-- San Mona
{
Location = "D4", Type = MineType.Gold,
MinimumProduction = 0,
AssociatedUnderground = { "D4-1", "D5-1" },
},
-- Drassen
{
Location = "D13", Type = MineType.Silver,
MinimumProduction = 1000,
AssociatedUnderground = { "D13-1", "E13-1" },
Infectible = 1,
},
-- Alma
{
Location = "I14", Type = MineType.Silver,
MinimumProduction = 1500,
AssociatedUnderground = { "I14-1", "J14-1" },
Infectible = 1,
},
-- Cambria
{
Location = "H8", Type = MineType.Silver,
MinimumProduction = 1500,
AssociatedUnderground = { "H8-1", "H9-1" },
Infectible = 1,
},
-- Chitzena
{
Location = "B2", Type = MineType.Silver,
MinimumProduction = 500,
AssociatedUnderground = { "B2-1" },
},
-- Grumm
{
Location = "H3", Type = MineType.Gold,
MinimumProduction = 2000,
AssociatedUnderground = { "H3-1", "I3-1", "I3-2", "H3-2", "H4-2" },
Infectible = 1,
},
}
-----------------------------------
-- §1.2. Vanilla JA2 logic below --
-----------------------------------
-- create variables for easy identification at quest related stuff
local DrassenMine = mines[2]
local AlmaMine = mines[3]
-- more initialization
for i = 1, #mines do
local m = mines[i]
m.MaxRemovalRate = m.MinimumProduction
if m.MinimumProduction > 0 then
m.RemainingOreSupply = 999999999
else
m.RemainingOreSupply = 0
end
end
-- Randomize the exact size of each mine. The total production is always
-- the same and depends on the game difficulty, but some mines will
-- produce more in one game than another, while others produce less.
local numProductionIncreases = ({ 25, 25, 20, 15 })[newDIFFICULTY_LEVEL]
while numProductionIncreases > 0 do
local m
-- pick a producing mine at random and increase its production
repeat
m = mines[math.random(#mines)]
until m.MinimumProduction > 0
-- increase mine production by 20% of the base (minimum) rate
m.MaxRemovalRate = m.MaxRemovalRate + m.MinimumProduction / 5
numProductionIncreases = numProductionIncreases - 1
end
-- Incorporate cheat option...
-- switch on iniWHICH_MINE_SHUTS_DOWN
-- 0: no mine runs out, skip this altogether
-- -1: choose mine randomly
-- >0: ID of the mine that shall run out
if iniWHICH_MINE_SHUTS_DOWN ~= 0 then
local m
if iniWHICH_MINE_SHUTS_DOWN == -1 then
-- Choose which mine will run out of production.
-- This will never be the Alma mine or an empty mine (San Mona)...
-- choose randomly
repeat
m = mines[math.random(#mines)]
-- Alma mine can't run out for quest-related reasons
until m.MinimumProduction > 0 and m ~= AlmaMine
else
-- Select mine by given index
-- No safety checks whatsoever, any error will be pretty much in
-- your face. If it breaks it's all their fault, I don't care...
m = mines[iniWHICH_MINE_SHUTS_DOWN]
end
if m == DrassenMine then
minDaysBeforeDepletion = 20
else
minDaysBeforeDepletion = 10
end
m.RemainingOreSupply = minDaysBeforeDepletion * 4 * m.MaxRemovalRate
-- We don't want the creatures to infect the mine that runs out.
m.Infectible = 0
end
return mines;
end -- function InitializeMines
------------------------------------
-- §2. Head miners initialization --
------------------------------------
--[[
function InitializeHeadMiners(mines, currentMine)
This function is called when the player enters a mine sector.
It can return either nil or the head miners initialization and
distribution. If it returns nil, it will be called again when a mine
sector gets loaded. If it returns a value other than nil, it will not be
called again.
Parameters:
- mines
An array of tables featuring only the following member:
- MaxRemovalRate
- currentMine
This is the index of the mine being entered by the player (cp. §1.1.).
If the function does not return nil but the head miners distribution, it
must return an array of tables consisting of the following members:
- Profile
The profile ID of the head miner.
- Quotes
Array of exactly four integers defining the quote IDs of the head miner
for the following strategic events:
1. RUNNING_OUT
2. CREATURES_ATTACK
3. CREATURES_GONE
4. CREATURES_AGAIN
It is valid to insert -1 for missing quotes.
- MineID
The index of the mine the head miner is assigned to (cp. §1.1.).
]]
function InitializeHeadMiners(mines, currentMine)
local headMinerInfo = {
-- Fred
{ Profile = 106, Quotes = { 17, 18, 27, 26 }, },
-- Matt
{ Profile = 148, Quotes = { -1, 18, 32, 31 }, },
-- Oswald
{ Profile = 156, Quotes = { 14, 15, 24, 23 }, },
-- Calvin
{ Profile = 157, Quotes = { 14, 15, 24, 23 }, },
-- Carl
{ Profile = 158, Quotes = { 14, 15, 24, 23 }, },
}
local Fred = headMinerInfo[1]
local Matt = headMinerInfo[2]
local AlmaID = 3 -- cp. §1.1.
-- don't place miners until player enters a producing mine
if mines[currentMine].MaxRemovalRate == 0 then
return nil
end
-- Matt is always head miner in Alma
Matt.MineID = AlmaID
-- Fred is the first miner the player encounters unless it's Alma
if currentMine ~= AlmaID then
Fred.MineID = currentMine
end
-- collect IDs of all producing mines except Alma mine and Fred's
local MinesLeft = {}
for i = 1, #mines do
if i ~= AlmaID and i ~= currentMine then
if mines[i].MaxRemovalRate > 0 then
table.insert(MinesLeft, i)
end
end
end
-- randomly distribute miners
for i = 1, #headMinerInfo do
if headMinerInfo[i].MineID == nil then
local index = math.random(#MinesLeft)
headMinerInfo[i].MineID = MinesLeft[index]
table.remove(MinesLeft, index)
end
end
return headMinerInfo
end -- function InitializeHeadMiners
+429 -156
View File
@@ -1,17 +1,52 @@
-----------------------
-- Set some stuff up --
-----------------------
-- Initialize the pseudo random number generator
math.randomseed( os.time() ); math.random(); math.random(); math.random()
-- http://lua-users.org/wiki/MathLibraryTutorial
--[[
REMARKS
=======
December 27, 2010
TOC
===
Preamble
§0. Constants
§1. Underground sector list compilation
§2. Defining enemy garrisons and creature population
§3. Internal workings
§3.1. Underground sector names
Preamble
========
This script sets up and initializes underground sectors. It defines where
underground sectors are located on the map, what enemy garrisons and
creature population they feature, and what loading screen to present to
the player.
Sector definitions are read whenever a new game starts. They are then
stored within the savegame meaning various changes to this script don't
have an effect on a game in progress.
Modders likely want to focus on §1. and §2.
There is also another script closely related to this one, which defines
sector names ("undergroundsectornames.lua" and localized versions). See
§3.1. for more details.
The game will call this script for any of three reasons:
1. When a new game starts it will call 'BuildUndergroundSectorList' in
order to create and initialize the array of underground sectors.
2. The game will call 'GetLoadscreen' whenever an underground sector
needs to be loaded.
3. When the game requests an underground sector name it will call
'GetSectorName'.
Remarks
- Several vanilla JA2 sectors may be unsafe to remove due to hardcoded
behaviour such as creature spreading, Deidranna escaping or other quest
@@ -19,172 +54,410 @@ math.randomseed( os.time() ); math.random(); math.random(); math.random()
- Contrary to random number generators used in JA2, Lua's math.random
function includes the range boundaries. Also, indexing in Lua starts at
1 as opposed to C (starting at 0). Find further information about Lua at
http://www.lua.org/docs.html
- Global variables:
- difficultyLevel
1: easy, 2: experienced, 3: expert, 4: insane
- gameStyle
0: realistic, 1: scifi
- To add an underground sector to the list, create a table and pass it as
an argument to addSector function. These tables may consist of the
following members:
- location (required)
string of the form "[R][C]-[L]", where [R] is a row
identifier (A-P), [C] is a column identifier (1-16), [L] is a
sublevel identifier (1-3), e.g. "A9-1"
- numAdmins
- numTroops
- numElites
integers, specifying numbers of enemy garrisons, default: 0
- numBloodcats
integer, specifying quantity of bloodcat population, default: 0
This requires bloodcat placements to be set.
- numCreatures
integer, specifying number of creatures in total, default: 0
Distribution of creature types depends on creature habitat (see below)
- creatureHabitat
integer, specifying creature distribution type
Use one of the constants below (also featuring details).
1 as opposed to C (starting at 0). For further information about Lua
consult the Lua documentation at http://www.lua.org/docs.html
]]
Habitat = { -- creature type distribution in percentages
-- young young adult adult
-- larvae infants male female male female
QueenLair = 0, -- 20 40 0 0 30 10
Lair = 1, -- 15 35 10 5 25 10
LairEntrance = 2, -- 0 15 30 10 35 10
InnerMine = 3, -- 0 0 20 40 10 30
OuterMine = 4, -- 0 0 10 65 5 20
MineExit = 6, -- 0 0 10 65 5 20
-- For debugging purposes you might want to have some basic logging output
-- from the game. Uncommenting the following line will create
-- "initunderground.log" in your profile directory.
--logging = true
-- Initialize the pseudo random number generator
math.randomseed( os.time() ); math.random(); math.random(); math.random()
-- http://lua-users.org/wiki/MathLibraryTutorial
-------------------
-- §0. Constants --
-------------------
Habitat = { -- creature type distribution in percentages
-- young young adult adult
-- larvae infants male female male female
QueenLair = 0, -- 20 40 0 0 30 10 (default)
Lair = 1, -- 15 35 10 5 25 10
LairEntrance = 2, -- 0 15 30 10 35 10
InnerMine = 3, -- 0 0 20 40 10 30
OuterMine = 4, -- 0 0 10 65 5 20
FeedingGrounds = 5, -- - - - - - - (unused)
MineExit = 6, -- 0 0 10 65 5 20
}
CreatureMusic = {
Compat = 0, -- default, use creepy music in the presence of creatures
-- or blue lights (default, also vanilla default);
Auto = 1, -- use creepy music if and only if there any creatures
-- present (ignoring lights);
Never = 2, -- do not use creepy music, regardless of any creatures;
Always = 3, -- do use creepy music, regardless of any creatures
}
---------------------------------------------
-- §1. Underground sector list compilation --
---------------------------------------------
--[[
In this list add underground sectors by specifying their location.
If no loadscreen attribute is given the script will use "LS_Mine" for
level 1 sectors and "LS_Cave" for level 2 and level 3 sectors (see §3.).
Also specify any other static attributes in this list (cf. §2.)
]]
local sectorList = {
-- Miguel's basement
{ location = "A10-1", loadscreen = "LS_Basement", },
-- Tixa
{ location = "J9-1", loadscreen = "LS_Basement", },
-- feeding zone
{ location = "J9-2", loadscreen = "LS_Cave", },
-- Orta
{ location = "K4-1", loadscreen = "LS_Basement", },
-- Meduna
{ location = "O3-1", loadscreen = "LS_Basement", },
{ location = "P3-1", loadscreen = "LS_Basement", },
-- San Mona mine
{ location = "D4-1", },
{ location = "D5-1", },
-- Drassen mine
{ location = "D13-1", },
{ location = "E13-1", },
{ location = "E13-2", },
{ location = "F13-2", },
{ location = "G13-2", },
{ location = "G13-3", },
{ location = "F13-3", },
-- Alma Mine
{ location = "I14-1", },
{ location = "J14-1", },
{ location = "J14-2", },
{ location = "J13-2", },
{ location = "J13-3", },
{ location = "K13-3", },
-- Cambria mine
{ location = "H8-1", },
{ location = "H9-1", },
{ location = "H9-2", },
{ location = "H8-2", },
{ location = "H8-3", },
{ location = "I8-3", },
{ location = "J8-3", },
-- Chitzena mine
{ location = "B2-1", },
-- Grumm mine
{ location = "H3-1", },
{ location = "I3-1", },
{ location = "I3-2", },
{ location = "H3-2", },
{ location = "H4-2", },
{ location = "H4-3", },
{ location = "G4-3", },
-- Demoville
{ location = "P1-1", loadscreen = "LS_Basement", },
{
location = "P1-2", loadscreen = "LS_Cave",
creatureHabitat = Habitat.InnerMine, music = CreatureMusic.Compat,
},
}
-----------------------------
-- INTERESTING STUFF BELOW --
-----------------------------
--[[
PopulateSectors
-- Miguel's basement
addSector( { location = "A10-1" } )
Remarks
This function is supposed to initialize sector settings that depend on
what difficulty level and game style the player chooses.
Parameters
-- Chitzena mine
addSector( { location = "B2-1" } )
difficultyLevel (integer)
Indicates the level of difficulty.
1: easy, 2: experienced, 3: expert, 4: insane
gameStyle (integer)
Indicates whether or not the player selected the scifi option.
0: realistic, 1: scifi
]]
local function PopulateSectors(difficultyLevel, gameStyle)
-- San Mona mine
addSector( { location = "D4-1" } )
addSector( { location = "D5-1" } )
local s = sectorList
----------------------------------------------------------
-- §2. Defining enemy garrisons and creature population --
----------------------------------------------------------
-- Tixa
tixa_1 = { }
tixa_1.location = "J9-1"
tixa_1.numTroops = ({ 8, 11, 15, 20 })[difficultyLevel]
addSector( tixa_1 )
-- feeding zone
tixa_2 = { }
tixa_2.location = "J9-2"
tixa_2.numCreatures = 2 + difficultyLevel*2 + math.random(0, 1)
addSector( tixa_2 )
s["J9-1"].numTroops = ({ 8, 11, 15, 20 })[difficultyLevel]
s["J9-2"].numCreatures = 2 + 2*difficultyLevel + math.random(0, 1)
-- Orta
orta = { }
orta.location = "K4-1"
orta.numTroops = 6 + difficultyLevel*2 + math.random(0, 2)
orta.numElites = 4 + difficultyLevel + math.random(0, 1)
addSector( orta )
s["K4-1"].numTroops = 6 + 2*difficultyLevel + math.random(0, 2)
s["K4-1"].numElites = 4 + difficultyLevel + math.random(0, 1)
-- Meduna
o3 = { location = "O3-1" }
o3.numTroops = 6 + difficultyLevel*2 + math.random(0, 2)
o3.numElites = 4 + difficultyLevel + math.random(0, 1)
addSector( o3 )
p3 = { location = "P3-1" }
if difficultyLevel == 1 then
-- easy
p3.numElites = 8 + math.random(0, 2)
elseif difficultyLevel == 2 then
-- medium
p3.numElites = 10 + math.random(0, 5)
elseif difficultyLevel == 3 then
-- hard
p3.numElites = 14 + math.random(0, 6)
elseif difficultyLevel == 4 then
-- insane
p3.numElites = 20
end
addSector(p3)
-- Drassen mine
addSector( { location = "D13-1" } )
addSector( { location = "E13-1" } )
addSector( { location = "E13-2" } )
addSector( { location = "F13-2" } )
addSector( { location = "G13-2" } )
addSector( { location = "G13-3" } )
addSector( { location = "F13-3" } )
-- Cambria mine
addSector( { location = "H8-1" } )
addSector( { location = "H9-1" } )
addSector( { location = "H9-2" } )
addSector( { location = "H8-2" } )
addSector( { location = "H8-3" } )
addSector( { location = "I8-3" } )
addSector( { location = "J8-3" } )
-- Alma Mine
addSector( { location = "I14-1" } )
addSector( { location = "J14-1" } )
addSector( { location = "J14-2" } )
addSector( { location = "J13-2" } )
addSector( { location = "J13-3" } )
addSector( { location = "K13-3" } )
-- Grumm mine
addSector( { location = "H3-1" } )
addSector( { location = "I3-1" } )
addSector( { location = "I3-2" } )
addSector( { location = "H3-2" } )
addSector( { location = "H4-2" } )
addSector( { location = "H4-3" } )
addSector( { location = "G4-3" } )
s["O3-1"].numTroops = 6 + 2*difficultyLevel + math.random(0, 2)
s["O3-1"].numElites = 4 + difficultyLevel + math.random(0, 1)
s["P3-1"].numElites = ({ 8, 10, 14, 20 })[difficultyLevel]
+ math.random(0, ({ 2, 5, 6, 0 })[difficultyLevel])
-- Demoville
p1_1 = { location = "P1-1" }
p1_1.numTroops = ({ 12, 16, 16, 0 })[difficultyLevel]
p1_1.numElites = ({ 0, 0, 4, 24 })[difficultyLevel]
addSector(p1_1)
s["P1-1"].numTroops = ({ 12, 16, 16, 0 })[difficultyLevel]
s["P1-1"].numElites = ({ 0, 0, 4, 24 })[difficultyLevel]
p1_2 = { location = "P1-2", creatureHabitat = Habitat.InnerMine }
p1_2.numCreatures = ({ 3, 5, 8, 13 })[difficultyLevel]
addSector(p1_2)
s["P1-2"].numCreatures = ({ 3, 5, 8, 13 })[difficultyLevel]
end
---------------------------
-- §3. Internal workings --
---------------------------
--[[
BuildUndergroundSectorList
Remarks
This function gets called by the game when a new game starts. It is
supposed to return the initialized list of underground sectors.
Parameters
gameSettings
Table holding these keys:
- difficultyLevel (integer)
1: easy, 2: experienced, 3: expert, 4: insane
- gameStyle (integer)
0: realistic, 1: scifi
Return value
This function shall return a table of tables that may feature the
following keys:
- location (required)
string of the form "[R][C]-[L]", where [R] is a row
identifier (A-P), [C] is a column identifier (1-16), [L] is a
sublevel identifier (1-3), e.g. "A9-1"
- numAdmins
- numTroops
- numElites
integers, specifying numbers of enemy garrisons, default: 0
- numBloodcats
integer, specifying quantity of bloodcat population, default: 0
This requires bloodcat placements to be set in the map itself.
- numCreatures
integer, specifying number of creatures in total, default: 0
Distribution of creature types depends on creature habitat (see §0.)
- creatureHabitat
integer, specifying creature distribution type
Use one of the constants from the Habitat enumeration (see §0.)
- music
integer, specifying under which circumstances to use creepy music
Use one of the costants from CreatureMusic enumeration (see §0.)
]]
function BuildUndergroundSectorList(gameSettings)
local difficultyLevel = gameSettings["difficultyLevel"]
local gameStyle = gameSettings["gameStyle"]
PopulateSectors(difficultyLevel, gameStyle)
return sectorList
end
--[[
GetLoadscreen
Remarks
Provides the game with the name and file format of the loadscreen for a
given sector. The function forwards the loadscreen attribute as declared
in the sectorList (cf. §1.) or uses default screens.
The game will use the name and format as well as screen resolution to
build the complete file name itself.
Parameters
location (string)
The usual sector location string of the sector the loadscreen is
requested for, e.g. "A10-1".
timeOfDay (integer)
The time in minutes that has passed since midnight.
Return values
This function shall return a 2-tuple of strings, of which the first shall
be the loadscreen name and the second the file extension.
]]
function GetLoadscreen(location, timeOfDay)
local s = sectorList[location]
if s ~= nil and s.loadscreen ~= nil then
return "Loadscreens\\" .. s.loadscreen, "sti"
else
-- resorting to defaults
-- get last character, aka z level
level = location:sub(#location, #location)
if level == "1" then
return "Loadscreens\\LS_Mine", "sti"
else
return "Loadscreens\\LS_Cave", "sti"
end
end
end
------------------------------------
-- §3.1. Underground sector names --
------------------------------------
--[[
Before the game loads this very script it processes another one,
'undergroundsectornames.lua', specifically. For this purpose, it basically
concatenates the two scripts.
'undergroundsectornames.lua' shall define a table of strings, which will
then be referenced in this script to provide the game with sector names.
That specific table shall be called 'sectornames', so make sure to not
overwrite that variable by accident.
]]
--[[
GetSectorName
Remarks
Provides the game with underground sector names.
This function can be called often (i.e. every frame) since currently the
result will not be cached.
Parameters:
sectorCoods
usual coordiantes string, e.g. "A10-1"
sectorDetails
table featuring the following items
- visited (boolean)
Indicates if the player has entered the sector at least once.
- creaturesPresent (boolean)
Indicates whether or not there are any monsters alive.
- detailed (boolean)
Indicates whether the game requests a detailed name.
Return value
This function shall return the requested sector name as a UTF-8 encoded
string.
]]
function GetSectorName(sectorCoords, sectorDetails)
if sectorDetails.visited then
local dash = sectorCoords:find("-")
local coords = sectorCoords:sub(1, dash-1)
if sectornames[sectorCoords] ~= nil then
return coords .. ": " .. sectornames[sectorCoords]
elseif sectornames[sectorCoords:lower()] ~= nil then
-- try lowercase version
return coords .. ": " .. sectornames[sectorCoords:lower()]
else
if sectorDetails.creaturesPresent then
return coords .. ": " .. sectornames.creatureLair
else
return sectorCoords
end
end
else
-- not visited
return ""
end
end
-- For convenient access allow indexing the sectorList by location string.
mt = {}
setmetatable(sectorList, mt)
mt.__index = function(table, key)
for i = 1, #table do
local t = rawget(table, i)
if (t.location == key) then
return t
end
end
return nil
end
@@ -0,0 +1,66 @@
--[[
This file (or its localized versions respectively) are included in
"initunderground.lua" to provide the underground sector names.
Make sure to save this file as UTF-8, preferably with BOM signature in
order to help editors to not mess up the encoding. Also make sure to not
save BOM in any other script unless it explicitly allows that.
]]
sectornames = {
["A10-1"] = "Rebel Hideout",
["J9-1"] = "Tixa Dungeon",
["J9-2"] = "Tixa Dungeon",
["K4-1"] = "Orta Basement",
["O3-1"] = "Tunnel",
["P3-1"] = "Shelter",
["B2-1"] = "Chitzena Mine",
["D4-1"] = "San Mona Mine",
["D5-1"] = "San Mona Mine",
["D13-1"] = "Drassen Mine",
["E13-1"] = "Drassen Mine",
["E13-2"] = "Drassen Mine",
["F13-2"] = "Drassen Mine",
["G13-2"] = "Drassen Mine",
["G13-3"] = "Drassen Mine",
["F13-3"] = "Drassen Mine",
["H8-1"] = "Cambria Mine",
["H9-1"] = "Cambria Mine",
["H9-2"] = "Cambria Mine",
["H8-2"] = "Cambria Mine",
["H8-3"] = "Cambria Mine",
["I8-3"] = "Cambria Mine",
["J8-3"] = "Cambria Mine",
["I14-1"] = "Alma Mine",
["J14-1"] = "Alma Mine",
["J14-2"] = "Alma Mine",
["J13-2"] = "Alma Mine",
["J13-3"] = "Alma Mine",
["K13-3"] = "Alma Mine",
["H3-1"] = "Grumm Mine",
["I3-1"] = "Grumm Mine",
["I3-2"] = "Grumm Mine",
["H3-2"] = "Grumm Mine",
["H4-2"] = "Grumm Mine",
["H4-3"] = "Grumm Mine",
["G4-3"] = "Grumm Mine",
["P1-1"] = "Demoville",
["P1-2"] = "Demoville",
creatureLair = "Creature Lair",
}