mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
- Added the JA2 Demo as a new 1-13 MOD (by Jazz)
o Now you can play the JA2 Demo (P1 - Demoville) maps with the features of 1.13 o The Demo has to be started with a special compiled 1.13 demo executable o This demo is as close as possible to the original JA2 Demo o There is a special "ja2_Demo.ini" file for the demo settings. git-svn-id: https://ja2svn.mooo.com/source/ja2_v1.13_data@1430 4f8fa57e-7814-0410-bad4-adc449f26b7c
This commit is contained in:
@@ -0,0 +1,418 @@
|
||||
--[[
|
||||
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, iCurrentShipmentDestinationID)
|
||||
iMessageOffset - record from email.edt
|
||||
iMessageLength - record from email.edt
|
||||
ubSender - uiIndex from SenderNameList.xml
|
||||
iCurrentIMPPosition - Default = -1, or the profile ID of the IMP
|
||||
iCurrentShipmentDestinationID - Default = -1, or the Bobby Ray shipment destination ID
|
||||
|
||||
- HireMerc (MercID)
|
||||
hires the merc with the specified MercID
|
||||
|
||||
|
||||
**************
|
||||
** 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)
|
||||
|
||||
-- Hire Ivan
|
||||
HireMerc(7)
|
||||
]]
|
||||
|
||||
-- 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()
|
||||
|
||||
AddNPCtoSector(113 ,1 ,SectorY.MAP_ROW_P ,0)
|
||||
AddNPCtoSector(104 ,1 ,SectorY.MAP_ROW_P ,0)
|
||||
AddNPCtoSector(66 ,1 ,SectorY.MAP_ROW_P ,1)
|
||||
|
||||
-- Init hospital variables
|
||||
HospitalTempBalance( 0 )
|
||||
HospitalRefund( 0 )
|
||||
HospitalPriceModifier( Modifier.HOSPITAL_UNSET )
|
||||
end
|
||||
|
||||
function InitNewGame()
|
||||
|
||||
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 )
|
||||
|
||||
-- HireMerc( MercID ) function applied only in 1.13 demo
|
||||
HireMerc( 4 ) -- Vicki
|
||||
HireMerc( 7 ) -- Ivan
|
||||
HireMerc( 10 ) -- Shadow
|
||||
HireMerc( 33 ) -- Dr.Q
|
||||
HireMerc( 42 ) -- Gastek
|
||||
HireMerc( 67 )
|
||||
|
||||
end
|
||||
@@ -0,0 +1,395 @@
|
||||
--[[
|
||||
|
||||
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
|
||||
related links.
|
||||
|
||||
- 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). For further information about Lua
|
||||
consult the Lua documentation at http://www.lua.org/docs.html
|
||||
|
||||
]]
|
||||
|
||||
|
||||
-- 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 = {
|
||||
|
||||
-- Demoville
|
||||
{ location = "P1-1", loadscreen = "LS_Basement", },
|
||||
{
|
||||
location = "P1-2", loadscreen = "LS_Cave",
|
||||
creatureHabitat = Habitat.InnerMine, music = CreatureMusic.Compat,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
||||
--[[
|
||||
|
||||
PopulateSectors
|
||||
|
||||
Remarks
|
||||
|
||||
This function is supposed to initialize sector settings that depend on
|
||||
what difficulty level and game style the player chooses.
|
||||
|
||||
Parameters
|
||||
|
||||
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)
|
||||
|
||||
local s = sectorList
|
||||
|
||||
|
||||
----------------------------------------------------------
|
||||
-- §2. Defining enemy garrisons and creature population --
|
||||
----------------------------------------------------------
|
||||
|
||||
-- Demoville
|
||||
s["P1-1"].numTroops = ({ 12, 16, 16, 0 })[difficultyLevel]
|
||||
s["P1-1"].numElites = ({ 0, 0, 4, 24 })[difficultyLevel]
|
||||
|
||||
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 function Return(name)
|
||||
return "Loadscreens\\" .. name, "sti"
|
||||
end
|
||||
|
||||
local s = sectorList[location]
|
||||
|
||||
if s ~= nil then
|
||||
|
||||
-- multiple screens to choose from?
|
||||
if s.loadscreens ~= nil and #s.loadscreens > 0 then
|
||||
local screen = s.loadscreens[math.random(#s.loadscreens)]
|
||||
return Return(screen)
|
||||
end
|
||||
|
||||
-- single screen?
|
||||
if s.loadscreen ~= nil then
|
||||
return Return(s.loadscreen)
|
||||
end
|
||||
end
|
||||
|
||||
-- resorting to defaults
|
||||
do
|
||||
-- get last character, aka z level
|
||||
local level = location:sub(#location, #location)
|
||||
if level == "1" then
|
||||
return Return("LS_Mine")
|
||||
else
|
||||
return Return("LS_Cave")
|
||||
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,67 @@
|
||||
--[[
|
||||
|
||||
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",
|
||||
["P1-3"] = "Demoville",
|
||||
|
||||
creatureLair = "Creature Lair",
|
||||
}
|
||||
Reference in New Issue
Block a user