mirror of
https://github.com/1dot13/source.git
synced 2026-08-12 14:10:23 +02:00
MERGED GameDir files from the development GameDir folder from revision 4545 up to 4882
Development GameDir folder: https://ja2svn.dyndns.org/source/ja2/branches/Wanne/JA2%201.13%20MP/GameDir git-svn-id: https://ja2svn.mooo.com/source/ja2_v1.13_data@1353 4f8fa57e-7814-0410-bad4-adc449f26b7c
This commit is contained in:
@@ -0,0 +1,381 @@
|
||||
Profil = {
|
||||
ELDIN = 127,
|
||||
BIGGENS = 61, -- UB
|
||||
|
||||
}
|
||||
|
||||
Team = {
|
||||
OUR_TEAM = 0,
|
||||
ENEMY_TEAM = 1,
|
||||
CREATURE_TEAM = 2,
|
||||
MILITIA_TEAM = 3,
|
||||
CIV_TEAM = 4,
|
||||
PLAYER_PLAN = 5,
|
||||
LAN_TEAM_ONE = 6,
|
||||
LAN_TEAM_TWO = 7,
|
||||
LAN_TEAM_THREE = 8,
|
||||
LAN_TEAM_FOUR = 9,
|
||||
}
|
||||
|
||||
StatusAlert = {
|
||||
STATUS_GREEN = 0,
|
||||
STATUS_YELLOW = 1,
|
||||
STATUS_RED = 2,
|
||||
STATUS_BLACK = 3,
|
||||
}
|
||||
|
||||
ActionType = {
|
||||
AI_ACTION_GET_CLOSER = 5,
|
||||
}
|
||||
|
||||
Facts = {
|
||||
FACT_MUSEUM_ALARM_WENT_OFF = 278,
|
||||
}
|
||||
|
||||
SoundVolume = {
|
||||
LOWVOLUME = 25,
|
||||
BTNVOLUME = 40,
|
||||
MIDVOLUME = 65,
|
||||
HIGHVOLUME = 127,
|
||||
}
|
||||
|
||||
Sample = {
|
||||
KLAXON_ALARM = 214,
|
||||
}
|
||||
|
||||
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,
|
||||
}
|
||||
|
||||
Civ_status = {
|
||||
CIV_GROUP_NEUTRAL = 0,
|
||||
CIV_GROUP_WILL_EVENTUALLY_BECOME_HOSTILE = 1,
|
||||
CIV_GROUP_WILL_BECOME_HOSTILE = 2,
|
||||
CIV_GROUP_HOSTILE = 3,
|
||||
}
|
||||
|
||||
Noise = {
|
||||
NOISE_UNKNOWN = 0,
|
||||
NOISE_MOVEMENT = 1,
|
||||
NOISE_CREAKING = 2,
|
||||
NOISE_SPLASHING = 3,
|
||||
NOISE_BULLET_IMPACT = 4,
|
||||
NOISE_GUNFIRE = 5,
|
||||
NOISE_EXPLOSION = 6,
|
||||
NOISE_SCREAM = 7,
|
||||
NOISE_ROCK_IMPACT = 8,
|
||||
NOISE_GRENADE_IMPACT = 9,
|
||||
NOISE_WINDOW_SMASHING = 10,
|
||||
NOISE_DOOR_SMASHING = 11,
|
||||
NOISE_SILENT_ALARM = 12,
|
||||
}
|
||||
|
||||
local HEARD_3_TURNS_AGO = -4
|
||||
local HEARD_2_TURNS_AGO = -3
|
||||
local HEARD_LAST_TURN = -2
|
||||
local HEARD_THIS_TURN = -1
|
||||
local NOT_HEARD_OR_SEEN = 0
|
||||
local SEEN_CURRENTLY = 1
|
||||
local SEEN_THIS_TURN = 2
|
||||
local SEEN_LAST_TURN = 3
|
||||
local SEEN_2_TURNS_AGO =4
|
||||
local SEEN_3_TURNS_AGO = 5
|
||||
|
||||
local ubProfil = 0
|
||||
local MAX_MISC_NOISE_DURATION = 12
|
||||
local iLoop
|
||||
local NOBODY = 254
|
||||
local LAST_TEAM = Team.LAN_TEAM_FOUR
|
||||
local bTeam
|
||||
|
||||
function PerformItemAction( ActionID , sGridNo )
|
||||
|
||||
local ubID
|
||||
|
||||
-- Open Door
|
||||
if ActionID == 1 then
|
||||
ACTION_ITEM_OPEN_DOOR (sGridNo)
|
||||
end
|
||||
|
||||
-- Open Close
|
||||
if ActionID == 2 then
|
||||
ACTION_ITEM_CLOSE_DOOR (sGridNo)
|
||||
end
|
||||
|
||||
-- 3x3 Hidden Pit
|
||||
if ActionID == 4 then
|
||||
Add3X3Pit (sGridNo)
|
||||
SearchForOtherMembersWithinPitRadiusAndMakeThemFall ( sGridNo, 1 )
|
||||
end
|
||||
|
||||
-- 5x5 Hidden Pit
|
||||
if ActionID == 5 then
|
||||
Add5X5Pit (sGridNo)
|
||||
SearchForOtherMembersWithinPitRadiusAndMakeThemFall ( sGridNo, 2 )
|
||||
end
|
||||
|
||||
-- Toggle Door
|
||||
if ActionID == 6 then
|
||||
ACTION_ITEM_TOGGLE_DOOR (sGridNo)
|
||||
end
|
||||
|
||||
-- Toggle Action1s
|
||||
if ActionID == 7 then
|
||||
ToggleActionItemsByFrequency( 1 )
|
||||
end
|
||||
|
||||
-- Toggle Action2s
|
||||
if ActionID == 8 then
|
||||
ToggleActionItemsByFrequency ( 2 )
|
||||
end
|
||||
|
||||
-- Toggle Action3s
|
||||
if ActionID == 9 then
|
||||
ToggleActionItemsByFrequency( 3 )
|
||||
end
|
||||
|
||||
-- Toggle Action4s
|
||||
if ActionID == 10 then
|
||||
ToggleActionItemsByFrequency( 4 )
|
||||
end
|
||||
|
||||
-- Enter Brothel
|
||||
if ActionID == 11 then
|
||||
-- Empty Action
|
||||
end
|
||||
|
||||
-- Exit Brothel
|
||||
if ActionID == 12 then
|
||||
-- Empty Action
|
||||
end
|
||||
|
||||
-- Kingpin Alarm
|
||||
if ActionID == 13 then
|
||||
|
||||
PlayJA2Sample( Sample.KLAXON_ALARM, SoundVolume.MIDVOLUME, sGridNo )
|
||||
|
||||
if ( TacticalStatusTeamActive(Team.CIV_TEAM) == true ) then
|
||||
|
||||
SetPublicNoiseGridNo( Team.CIV_TEAM, sGridNo )
|
||||
SetPublicNoiseVolume( Team.CIV_TEAM, MAX_MISC_NOISE_DURATION )
|
||||
|
||||
for iLoop = GetTacticalStatusFirstID(Team.CIV_TEAM),GetTacticalStatusLastID(Team.CIV_TEAM) do
|
||||
if ( CheckMercPtrsInSector (iLoop) == true and CheckMercPtrsInActive(iLoop) == true and CheckMercPtrsInCivilianGroup (iLoop) == Group.KINGPIN_CIV_GROUP ) then
|
||||
SetNewSituationMercPtrs ( iLoop )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
SetCivGroupHostile( Group.KINGPIN_CIV_GROUP , Civ_status.CIV_GROUP_HOSTILE )
|
||||
|
||||
for iLoop = GetTacticalStatusFirstID(Team.CIV_TEAM),GetTacticalStatusLastID(Team.CIV_TEAM) do
|
||||
if ( CheckMercPtrsInSector (iLoop) == true and CheckMercPtrsInActive(iLoop) == true and CheckMercPtrsInCivilianGroup (iLoop) == Group.KINGPIN_CIV_GROUP ) then
|
||||
for aimLoop=GetTacticalStatusFirstID(Team.OUR_TEAM),GetTacticalStatusLastID(Team.OUR_TEAM) do
|
||||
if ( CheckMercPtrsID1SeenID2(iLoop,aimLoop) == SEEN_CURRENTLY ) then
|
||||
MakeMercPtrsHostile( iLoop )
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if ( CheckCombatMode == false ) then
|
||||
EnterTeamCombatMode(Team.CIV_TEAM)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- Sex with Prostitute
|
||||
if ActionID == 14 then
|
||||
ACTION_ITEM_SEX ()
|
||||
end
|
||||
|
||||
-- Reveal Room
|
||||
if ActionID == 15 then
|
||||
ACTION_ITEM_REVEAL_ROOM (sGridNo)
|
||||
end
|
||||
|
||||
-- Local Alarm
|
||||
if ActionID == 16 then
|
||||
MakeNoise( NOBODY, sGridNo, 0, WorldLevelDataTerrainID(sGridNo), 30, Noise.NOISE_SILENT_ALARM )
|
||||
end
|
||||
|
||||
-- Global Alarm
|
||||
if ActionID == 17 then
|
||||
|
||||
for i = 0 , LAST_TEAM do
|
||||
if ( TacticalStatusTeamActive(i) == true ) then
|
||||
if ( TacticalStatusTeamHuman(i) == false and ( not i == Team.CIV_TEAM ) ) then
|
||||
|
||||
SetPublicNoiseGridNo( i, sGridNo )
|
||||
SetPublicNoiseVolume( i, MAX_MISC_NOISE_DURATION )
|
||||
|
||||
iLoop = GetTacticalStatusFirstID(i)
|
||||
for o = iLoop,GetTacticalStatusLastID(iLoop) do
|
||||
if ( CheckMercPtrsInSector (o) == true and CheckMercPtrsInActive(o) == true ) then
|
||||
SetNewSituationMercPtrs( o )
|
||||
WearGasMaskIfAvailable( o )
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- Klaxon Sound
|
||||
if ActionID == 18 then
|
||||
PlayJA2Sample( Sample.KLAXON_ALARM, SoundVolume.MIDVOLUME, sGridNo )
|
||||
end
|
||||
|
||||
-- Unlock door
|
||||
if ActionID == 19 then
|
||||
ACTION_ITEM_UNLOCK_DOOR (sGridNo)
|
||||
end
|
||||
|
||||
-- Toggle lock
|
||||
if ActionID == 20 then
|
||||
ACTION_ITEM_TOGGLE_LOCK (sGridNo)
|
||||
end
|
||||
|
||||
-- Untrap door
|
||||
if ActionID == 21 then
|
||||
ACTION_ITEM_UNTRAP_DOOR (sGridNo)
|
||||
end
|
||||
|
||||
-- Tog pressure items
|
||||
if ActionID == 22 then
|
||||
TogglePressureActionItemsInGridNo (sGridNo)
|
||||
end
|
||||
|
||||
-- Museum alarm
|
||||
if ActionID == 23 then
|
||||
|
||||
ubProfil = Profil.ELDIN
|
||||
|
||||
PlayJA2Sample( Sample.KLAXON_ALARM, SoundVolume.MIDVOLUME, sGridNo )
|
||||
|
||||
-- Eldin becomes aware of a very important "noise" coming from here!
|
||||
-- So long as he hasn't already heard a noise a sec ago...
|
||||
if ( TacticalStatusTeamActive(Team.CIV_TEAM) == true ) then
|
||||
-- new situation for Eldin
|
||||
if ( CheckSoldierInSector(ubProfil) == true and CheckSoldierActive(ubProfil) == true and CheckNPCLife(ubProfil) > 0 and ( CheckSoldierAlertStatus(ubProfil) == StatusAlert.STATUS_GREEN and CheckSoldierNoiseVolume(ubProfil) == 6 ) ) then
|
||||
if ( SoldierTo3DLocationLineOfSightTest( ubProfil, sGridNo, 0, 0 ) == true ) then
|
||||
|
||||
-- sees the player now!
|
||||
TriggerNPCWithIHateYouQuote(ubProfil)
|
||||
SetNewSituation(ubProfil)
|
||||
else
|
||||
SetNoiseGridno(ubProfil,sGridNo)
|
||||
SetNoiseVolume(ubProfil,6)
|
||||
SetAlertStatus(ubProfil,StatusAlert.STATUS_GREEN)
|
||||
if ( not CheckAction(ubProfil) == ActionType.AI_ACTION_GET_CLOSER ) or CheckFact (Facts.FACT_MUSEUM_ALARM_WENT_OFF) == false then
|
||||
CancelAIAction( ubProfil)
|
||||
SetNextAction(ubProfil , ActionType.AI_ACTION_GET_CLOSER )
|
||||
SetNextActionData(ubProfil , sGridNo)
|
||||
RESETTIMECOUNTER( ubProfil, 100 )
|
||||
end
|
||||
end
|
||||
SetFactTrue( Facts.FACT_MUSEUM_ALARM_WENT_OFF )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
-- Bloodcat alarm
|
||||
if ActionID == 24 then
|
||||
bTeam = Team.CREATURE_TEAM
|
||||
|
||||
if ( TacticalStatusTeamActive(bTeam) == true ) then
|
||||
if ( TacticalStatusTeamHuman(bTeam) == false and ( not bTeam == Team.CIV_TEAM ) ) then
|
||||
|
||||
SetPublicNoiseGridNo( bTeam, sGridNo )
|
||||
SetPublicNoiseVolume( bTeam, MAX_MISC_NOISE_DURATION )
|
||||
|
||||
iLoop = GetTacticalStatusFirstID(bTeam)
|
||||
for o = iLoop,GetTacticalStatusLastID(bTeam) do
|
||||
if ( CheckMercPtrsInSector (o) == true and CheckMercPtrsInActive(o) == true ) then
|
||||
SetNewSituationMercPtrs( o )
|
||||
WearGasMaskIfAvailable( o )
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- UB Action
|
||||
|
||||
-- BIGGENS BOMBS
|
||||
if ActionID == 25 then
|
||||
|
||||
if ( ShouldThePlayerStopWhenWalkingOnBiggensActionItem( 17 ) == true ) then
|
||||
|
||||
HavePersonAtGridnoStop( sGridNo )
|
||||
|
||||
-- Make Biggens run for cover and then detonate the explosives
|
||||
TriggerNPCRecord( Profil.BIGGENS , 17 )
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- BIGGENS WARNING
|
||||
if ActionID == 26 then
|
||||
|
||||
if ( ShouldThePlayerStopWhenWalkingOnBiggensActionItem( 16 ) == true ) then
|
||||
|
||||
HavePersonAtGridnoStop( sGridNo )
|
||||
|
||||
-- Make Biggens run for cover and then detonate the explosives
|
||||
TriggerNPCRecord( Profil.BIGGENS , 16 )
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- SEE FORTIFIED DOOR
|
||||
if ActionID == 27 then
|
||||
|
||||
HandleSeeingFortifiedDoor( sGridNo )
|
||||
|
||||
end
|
||||
|
||||
-- OPEN FORTIFED DOOR
|
||||
if ActionID == 28 then
|
||||
|
||||
HandleSwitchToOpenFortifiedDoor( sGridNo )
|
||||
|
||||
end
|
||||
|
||||
-- SEE POWER GEN FAN
|
||||
if ActionID == 29 then
|
||||
|
||||
-- if the player is in the power plant
|
||||
if( gWorldSectorX == 13 and gWorldSectorY == 10 and gbWorldSectorZ == 0 ) then
|
||||
|
||||
HandleSeeingPowerGenFan( sGridNo )
|
||||
|
||||
elseif( gWorldSectorX == 15 and gWorldSectorY == 12 and gbWorldSectorZ == 3 ) then
|
||||
|
||||
-- The player is hitting the switch to launch the missles
|
||||
HandlePlayerHittingSwitchToLaunchMissles()
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,886 @@
|
||||
--[[
|
||||
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
|
||||
|
||||
|
||||
**************
|
||||
** 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)
|
||||
]]
|
||||
|
||||
-- Initialize the pseudo random number generator
|
||||
math.randomseed( os.time() ); math.random(); math.random(); math.random()
|
||||
-- http://lua-users.org/wiki/MathLibraryTutorial
|
||||
|
||||
|
||||
|
||||
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
|
||||
|
||||
--JA25: New emails
|
||||
-- email # 1
|
||||
local EMAIL_STARTGAME = 0
|
||||
local EMAIL_STARTGAME_LENGTH = 8
|
||||
|
||||
-- email # 2
|
||||
local EMAIL_PILOTMISSING = (EMAIL_STARTGAME + EMAIL_STARTGAME_LENGTH)
|
||||
local EMAIL_PILOTMISSING_LENGTH = 2
|
||||
|
||||
-- email # 3
|
||||
local EMAIL_MAKECONTACT = (EMAIL_PILOTMISSING + EMAIL_PILOTMISSING_LENGTH)
|
||||
local EMAIL_MAKECONTACT_LENGTH = 3
|
||||
|
||||
-- email # 4
|
||||
local EMAIL_MANUEL = (EMAIL_MAKECONTACT + EMAIL_MAKECONTACT_LENGTH)
|
||||
local EMAIL_MANUEL_LENGTH = 4
|
||||
|
||||
-- # email # 5 - only if Miguel is alive!
|
||||
local EMAIL_MIGUELHELLO = (EMAIL_MANUEL + EMAIL_MANUEL_LENGTH)
|
||||
local EMAIL_MIGUELHELLO_LENGTH = 3
|
||||
|
||||
-- email # 6 - player not advancing fast enough
|
||||
local EMAIL_CONCERNED = (EMAIL_MIGUELHELLO + EMAIL_MIGUELHELLO_LENGTH)
|
||||
local EMAIL_CONCERNED_LENGTH = 2
|
||||
|
||||
-- email # 7 - player still not advancing fast enough
|
||||
local EMAIL_URGENT = (EMAIL_CONCERNED + EMAIL_CONCERNED_LENGTH)
|
||||
local EMAIL_URGENT_LENGTH = 3
|
||||
|
||||
-- email # 8a - from Miguel
|
||||
local EMAIL_MIGUELSORRY = (EMAIL_URGENT + EMAIL_URGENT_LENGTH)
|
||||
local EMAIL_MIGUELSORRY_LENGTH = 3
|
||||
|
||||
-- email # 8b - from Miguel, mentioning Manuel
|
||||
local EMAIL_MIGUELMANUEL = (EMAIL_MIGUELSORRY + EMAIL_MIGUELSORRY_LENGTH)
|
||||
local EMAIL_MIGUELMANUEL_LENGTH = 4
|
||||
|
||||
-- email # 9 - Miguel sick
|
||||
local EMAIL_MIGUELSICK = (EMAIL_MIGUELMANUEL + EMAIL_MIGUELMANUEL_LENGTH)
|
||||
local EMAIL_MIGUELSICK_LENGTH = 3
|
||||
|
||||
-- email # 10a
|
||||
local EMAIL_UNDERSTANDING = (EMAIL_MIGUELSICK + EMAIL_MIGUELSICK_LENGTH)
|
||||
local EMAIL_UNDERSTANDING_LENGTH = 3
|
||||
|
||||
-- email # 10b - if we need extra cash
|
||||
local EMAIL_EXTRACASH = (EMAIL_UNDERSTANDING + EMAIL_UNDERSTANDING_LENGTH)
|
||||
local EMAIL_EXTRACASH_LENGTH = 4
|
||||
|
||||
-- email # 11
|
||||
local EMAIL_PILOTFOUND = (EMAIL_EXTRACASH + EMAIL_EXTRACASH_LENGTH)
|
||||
local EMAIL_PILOTFOUND_LENGTH = 2
|
||||
|
||||
-- email # 12a - Miguel dead, Manuel never recruited
|
||||
local EMAIL_CONGRATS = (EMAIL_PILOTFOUND + EMAIL_PILOTFOUND_LENGTH)
|
||||
local EMAIL_CONGRATS_LENGTH = 4
|
||||
|
||||
-- email # 12b - Miguel alive, Manuel never recruited
|
||||
local EMAIL_CONGRATSICK = (EMAIL_CONGRATS + EMAIL_CONGRATS_LENGTH)
|
||||
local EMAIL_CONGRATSICK_LENGTH = 5
|
||||
|
||||
-- email # 12c - Miguel alive, Manuel dead
|
||||
local EMAIL_CONGRATMIGMANUELDEAD = (EMAIL_CONGRATSICK + EMAIL_CONGRATSICK_LENGTH)
|
||||
local EMAIL_CONGRATMIGMANUELDEAD_LENGTH = 6
|
||||
|
||||
-- email # 12d - Miguel alive, Manuel recruited and alive
|
||||
local EMAIL_CONGRATMIGMANUELALIVE = (EMAIL_CONGRATMIGMANUELDEAD + EMAIL_CONGRATMIGMANUELDEAD_LENGTH)
|
||||
local EMAIL_CONGRATMIGMANUELALIVE_LENGTH = 6
|
||||
|
||||
-- email # 12e - Miguel dead, Manuel dead
|
||||
local EMAIL_CONGRATMANUELDEAD = (EMAIL_CONGRATMIGMANUELALIVE + EMAIL_CONGRATMIGMANUELALIVE_LENGTH)
|
||||
local EMAIL_CONGRATMANUELDEAD_LENGTH = 5
|
||||
|
||||
-- email # 12f - Miguel dead, Manuel recruited and alive
|
||||
local EMAIL_CONGRATMANUELALIVE = (EMAIL_CONGRATMANUELDEAD + EMAIL_CONGRATMANUELDEAD_LENGTH)
|
||||
local EMAIL_CONGRATMANUELALIVE_LENGTH = 5
|
||||
|
||||
-- email # 13 - original AIM email
|
||||
local EMAIL_AIMDISCOUNT = (EMAIL_CONGRATMANUELALIVE + EMAIL_CONGRATMANUELALIVE_LENGTH)
|
||||
local EMAIL_AIMDISCOUNT_LENGTH = 7
|
||||
|
||||
local MANUEL_AT_HOME_NOT_USED = ( EMAIL_AIMDISCOUNT + EMAIL_AIMDISCOUNT_LENGTH )
|
||||
local MANUEL_AT_HOME_NOT_USED_LENGTH = 1
|
||||
|
||||
-- Email #14 Initial IMP email
|
||||
local IMP_EMAIL_INTRO = (MANUEL_AT_HOME_NOT_USED + MANUEL_AT_HOME_NOT_USED_LENGTH )
|
||||
local IMP_EMAIL_INTRO_LENGTH = 10
|
||||
|
||||
-- Email #15 Imp follow up
|
||||
local IMP_EMAIL_AGAIN = (IMP_EMAIL_INTRO + IMP_EMAIL_INTRO_LENGTH)
|
||||
local IMP_EMAIL_AGAIN_LENGTH = 5
|
||||
|
||||
-- Email #16 - ?? merc left-me-a-message-and-now-I'm-back emails
|
||||
local AIM_REPLY_BARRY = ( IMP_EMAIL_AGAIN + IMP_EMAIL_AGAIN_LENGTH )
|
||||
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
|
||||
|
||||
local AIM_REFUND = ( AIM_REPLY_MELTDOWN + AIM_REPLY_LENGTH_MELTDOWN )
|
||||
local AIM_REFUND_LENGTH = 3
|
||||
|
||||
local MERC_REFUND = ( AIM_REFUND + AIM_REFUND_LENGTH )
|
||||
local MERC_REFUND_LENGTH = 3
|
||||
|
||||
local EMAIL_AIM_PROMOTION_1 = ( MERC_REFUND + MERC_REFUND_LENGTH )
|
||||
local EMAIL_AIM_PROMOTION_1_LENGTH = 4
|
||||
|
||||
local EMAIL_MERC_PROMOTION_1 = ( EMAIL_AIM_PROMOTION_1 + EMAIL_AIM_PROMOTION_1_LENGTH )
|
||||
local EMAIL_MERC_PROMOTION_1_LENGTH = 5
|
||||
|
||||
local EMAIL_AIM_PROMOTION_2 = ( EMAIL_MERC_PROMOTION_1 + EMAIL_MERC_PROMOTION_1_LENGTH )
|
||||
local EMAIL_AIM_PROMOTION_2_LENGTH = 5
|
||||
|
||||
local IMP_EMAIL_PROFILE_RESULTS = ( EMAIL_AIM_PROMOTION_2 + EMAIL_AIM_PROMOTION_2_LENGTH )
|
||||
local IMP_EMAIL_PROFILE_RESULTS_LENGTH = 1
|
||||
|
||||
|
||||
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,
|
||||
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 =
|
||||
{
|
||||
Manuel = 60,
|
||||
Biggens = 61,
|
||||
Kulba = 62,
|
||||
Tex = 64,
|
||||
JerryMilo = 76,
|
||||
Morris = 75,
|
||||
}
|
||||
|
||||
Facts =
|
||||
{
|
||||
FACT_IMPORTED_SAVE_AND_MARY_WAS_DEAD = 400,
|
||||
FACT_TEX_IS_IN_GAME_AND_ALIVE_IN_STORE = 402,
|
||||
}
|
||||
|
||||
local DIF_LEVEL_EASY = 1
|
||||
local DIF_LEVEL_MEDIUM = 2
|
||||
local DIF_LEVEL_HARD = 3
|
||||
local DIF_LEVEL_INSANE = 4
|
||||
|
||||
ShopID = {
|
||||
ARMS_DEALER_TONY = 0,
|
||||
ARMS_DEALER_FRANZ = 1,
|
||||
ARMS_DEALER_KEITH = 2,
|
||||
ARMS_DEALER_JAKE = 3,
|
||||
ARMS_DEALER_GABBY = 4,
|
||||
ARMS_DEALER_HOWARD = 5,
|
||||
ARMS_DEALER_SAM = 6,
|
||||
ARMS_DEALER_FRANK = 7,
|
||||
ARMS_DEALER_BAR_BRO_1 = 8,
|
||||
ARMS_DEALER_BAR_BRO_2 = 9,
|
||||
ARMS_DEALER_BAR_BRO_3 = 10,
|
||||
ARMS_DEALER_BAR_BRO_4 = 11,
|
||||
ARMS_DEALER_MICKY = 12,
|
||||
ARMS_DEALER_ARNIE = 13,
|
||||
ARMS_DEALER_FREDO = 14,
|
||||
ARMS_DEALER_RAUL = 15, -- Raul UB
|
||||
ARMS_DEALER_ELGIN = 16,
|
||||
ARMS_DEALER_MANNY = 17,
|
||||
ARMS_DEALER_BETTY = 18, -- Betty UB
|
||||
}
|
||||
|
||||
local function AddTexsVideosToBettysInventory()
|
||||
GuaranteeAtLeastXItemsOfIndex( ShopID.ARMS_DEALER_BETTY, itemTEX_MOVIE_ATTACK_CLYDESDALES, 1 ) -- Attack of the Clydesdales
|
||||
GuaranteeAtLeastXItemsOfIndex( ShopID.ARMS_DEALER_BETTY, itemTEX_MOVIE_WILD_EAST, 1 ) -- Wild, Wild East
|
||||
GuaranteeAtLeastXItemsOfIndex( ShopID.ARMS_DEALER_BETTY, itemTEX_MOVIE_HAVE_HONDA, 1 ) -- Have Honda, Will Travel
|
||||
end
|
||||
|
||||
function InitStrategicLayer()
|
||||
|
||||
InitialHeliCrash(iniINGAMEHELICRASH)
|
||||
|
||||
if ( iniJERRY == true ) then
|
||||
InitialProfile ( Profil.JerryMilo, iniDEFAULT_ARRIVAL_SECTOR_X, iniDEFAULT_ARRIVAL_SECTOR_Y,0, iniJERRYGRIDNO )
|
||||
end
|
||||
|
||||
InitialJerryQuotes(iniJERRYQUOTES)
|
||||
InitialLaptopQuest(iniLAPTOP_QUEST)
|
||||
|
||||
InitialHeliGridNo1(iniINITIALHELIGRIDNO1)
|
||||
InitialHeliGridNo2(iniINITIALHELIGRIDNO2)
|
||||
InitialHeliGridNo3(iniINITIALHELIGRIDNO3)
|
||||
InitialHeliGridNo4(iniINITIALHELIGRIDNO4)
|
||||
InitialHeliGridNo5(iniINITIALHELIGRIDNO5)
|
||||
InitialHeliGridNo6(iniINITIALHELIGRIDNO6)
|
||||
InitialHeliGridNo7(iniINITIALHELIGRIDNO7)
|
||||
|
||||
-- get DEFAULT_ARRIVAL_SECTOR_X and DEFAULT_ARRIVAL_SECTOR_Y from UB_Options.ini
|
||||
SetDefaultArrivalSector( iniDEFAULT_ARRIVAL_SECTOR_X, iniDEFAULT_ARRIVAL_SECTOR_Y )
|
||||
|
||||
-- get NEW_MERC_ARRIVAL_LOCATION from UB_Options.ini
|
||||
InternalLocateGridNo( iniNEW_MERC_ARRIVAL_LOCATION )
|
||||
end
|
||||
|
||||
|
||||
function InitNPCs()
|
||||
local ran
|
||||
local ubNumAdmins = 0
|
||||
local ubNumTroops = 0
|
||||
local ubNumElites = 0
|
||||
local Test = false
|
||||
local JohnKulbaText = true
|
||||
|
||||
if ( RandomManuelText == true ) then
|
||||
|
||||
-- Miguel is dead
|
||||
Dead = math.random(1, 2)
|
||||
if ( Dead == 1 ) then
|
||||
SetFactTrue( 414 ) -- set fact
|
||||
end
|
||||
|
||||
-- Fatima or Pacos is dead
|
||||
Dead = math.random(1, 2)
|
||||
if ( Dead == 1 ) then
|
||||
SetFactTrue( 415 ) -- set fact
|
||||
end
|
||||
|
||||
-- Carlos is dead
|
||||
Dead = math.random(1, 2)
|
||||
if ( Dead == 1 ) then
|
||||
SetFactTrue( 416 ) -- set fact
|
||||
end
|
||||
|
||||
-- Ira is dead
|
||||
Dead = math.random(1, 2)
|
||||
if ( Dead == 1 ) then
|
||||
SetFactTrue( 417 ) -- set fact
|
||||
end
|
||||
|
||||
-- Dimitri is dead
|
||||
Dead = math.random(1, 2)
|
||||
if ( Dead == 1 ) then
|
||||
SetFactTrue( 418 ) -- set fact
|
||||
end
|
||||
end
|
||||
|
||||
-- Random John or Tex
|
||||
if ( enabledJohnAndTex == false) then
|
||||
|
||||
ran = math.random(1, 2)
|
||||
|
||||
if ( ran == 1 ) then
|
||||
|
||||
if ( JohnKulbaText == true ) then
|
||||
-- Mary is dead
|
||||
MaryDead = math.random(1, 2)
|
||||
if ( MaryDead == 1 ) then
|
||||
SetFactTrue( Facts.FACT_IMPORTED_SAVE_AND_MARY_WAS_DEAD ) -- set fact
|
||||
end
|
||||
end
|
||||
|
||||
--John is available
|
||||
Ja25JohnKulbaIsInGame (true)
|
||||
|
||||
--Tex is not available
|
||||
SetFactFalse( Facts.FACT_TEX_IS_IN_GAME_AND_ALIVE_IN_STORE )
|
||||
|
||||
Ja25JohnKulbaInitialSectorY (SectorY.MAP_ROW_I)
|
||||
-- Randomly choose John's starting sector
|
||||
if( math.random(1, 100 ) < 50 ) then
|
||||
Ja25JohnKulbaInitialSectorX (10)
|
||||
else
|
||||
Ja25JohnKulbaInitialSectorX (11)
|
||||
end
|
||||
|
||||
else
|
||||
--John is not available
|
||||
Ja25JohnKulbaIsInGame (false)
|
||||
|
||||
-- added video to Betty Shop
|
||||
if ( Ja25CheckJohnKulbaIsInGame() == false ) then
|
||||
AddTexsVideosToBettysInventory()
|
||||
end
|
||||
|
||||
--Tex is available
|
||||
SetFactTrue( Facts.FACT_TEX_IS_IN_GAME_AND_ALIVE_IN_STORE )
|
||||
end
|
||||
|
||||
|
||||
-- John and Tex in game
|
||||
elseif ( enabledJohnAndTex == true) then
|
||||
|
||||
if ( JohnKulbaText == true ) then
|
||||
-- Mary is dead
|
||||
MaryDead = math.random(1, 2)
|
||||
if ( MaryDead == 1 ) then
|
||||
SetFactTrue( Facts.FACT_IMPORTED_SAVE_AND_MARY_WAS_DEAD ) -- set fact
|
||||
end
|
||||
end
|
||||
|
||||
--John is available
|
||||
Ja25JohnKulbaIsInGame (true)
|
||||
|
||||
Ja25JohnKulbaInitialSectorY (SectorY.MAP_ROW_I)
|
||||
|
||||
--Randomly choose John's starting sector
|
||||
if( math.random(1, 100 ) < 50 ) then
|
||||
Ja25JohnKulbaInitialSectorX (10)
|
||||
else
|
||||
Ja25JohnKulbaInitialSectorX (11)
|
||||
end
|
||||
|
||||
-- added video to Betty Shop
|
||||
AddTexsVideosToBettysInventory()
|
||||
|
||||
--Tex is available
|
||||
SetFactTrue( Facts.FACT_TEX_IS_IN_GAME_AND_ALIVE_IN_STORE )
|
||||
|
||||
end
|
||||
|
||||
-- Added enemy to sector
|
||||
if ( Test == false ) then
|
||||
-- H7
|
||||
if ( difficultyLevel == DIF_LEVEL_EASY ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 0
|
||||
ubNumElites = 0
|
||||
elseif ( difficultyLevel == DIF_LEVEL_MEDIUM ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 0
|
||||
ubNumElites = 0
|
||||
elseif ( difficultyLevel == DIF_LEVEL_HARD ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 0
|
||||
ubNumElites = 0
|
||||
elseif ( difficultyLevel == DIF_LEVEL_INSANE ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 0
|
||||
ubNumElites = 0
|
||||
end
|
||||
SetNumberJa25EnemiesInSurfaceSector( 7, 8, ubNumAdmins, ubNumTroops, ubNumElites )
|
||||
|
||||
|
||||
-- H8
|
||||
if ( difficultyLevel == DIF_LEVEL_EASY ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 6 + math.random( 1, 4 )
|
||||
ubNumElites = 0
|
||||
elseif ( difficultyLevel == DIF_LEVEL_MEDIUM ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 13 + math.random( 1, 3 )
|
||||
ubNumElites = 0
|
||||
elseif ( difficultyLevel == DIF_LEVEL_HARD ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 16 + math.random( 1, 6 )
|
||||
ubNumElites = 2 + math.random( 1,2 )
|
||||
elseif ( difficultyLevel == DIF_LEVEL_INSANE ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 19 + math.random( 1, 9 )
|
||||
ubNumElites = 2 + math.random( 1, 2 )
|
||||
end
|
||||
|
||||
SetNumberJa25EnemiesInSurfaceSector( 8,8, ubNumAdmins, ubNumTroops, ubNumElites )
|
||||
|
||||
|
||||
-- Guard Post
|
||||
-- H9
|
||||
if ( difficultyLevel == DIF_LEVEL_EASY ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 10 + math.random( 1, 5 )
|
||||
ubNumElites = 1
|
||||
elseif ( difficultyLevel == DIF_LEVEL_MEDIUM ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 16 + math.random( 1, 4 )
|
||||
ubNumElites = 1
|
||||
elseif ( difficultyLevel == DIF_LEVEL_HARD ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 19 + math.random( 1, 4 )
|
||||
ubNumElites = 3 + math.random( 1, 2 )
|
||||
elseif ( difficultyLevel == DIF_LEVEL_INSANE ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 19 + math.random( 1, 6 )
|
||||
ubNumElites = 3 + math.random( 1, 2 )
|
||||
end
|
||||
|
||||
SetNumberJa25EnemiesInSurfaceSector( 9,8, ubNumAdmins, ubNumTroops, ubNumElites )
|
||||
|
||||
-- H10
|
||||
if ( difficultyLevel == DIF_LEVEL_EASY ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 6 + math.random( 1, 5 )
|
||||
ubNumElites = 0
|
||||
elseif ( difficultyLevel == DIF_LEVEL_MEDIUM ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 9 + math.random( 1, 3 )
|
||||
ubNumElites = 0
|
||||
elseif ( difficultyLevel == DIF_LEVEL_HARD ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 10 + math.random( 1, 4 )
|
||||
ubNumElites = 2 + math.random( 1, 4 )
|
||||
elseif ( difficultyLevel == DIF_LEVEL_INSANE ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 20 + math.random( 1, 4 )
|
||||
ubNumElites = 2 + math.random( 1, 4 )
|
||||
end
|
||||
|
||||
SetNumberJa25EnemiesInSurfaceSector( 10,8, ubNumAdmins, ubNumTroops, ubNumElites )
|
||||
|
||||
-- H11
|
||||
if ( difficultyLevel == DIF_LEVEL_EASY ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 6 + math.random( 1, 3 )
|
||||
ubNumElites = 0
|
||||
elseif ( difficultyLevel == DIF_LEVEL_MEDIUM ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 8 + math.random( 1, 3 )
|
||||
ubNumElites = 2 + math.random( 1, 2 )
|
||||
elseif ( difficultyLevel == DIF_LEVEL_HARD ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 10 + math.random( 1, 4 )
|
||||
ubNumElites = 4 + math.random( 1, 3 )
|
||||
elseif ( difficultyLevel == DIF_LEVEL_INSANE ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 20 + math.random( 1, 4 )
|
||||
ubNumElites = 2 + math.random( 1, 3 )
|
||||
end
|
||||
|
||||
SetNumberJa25EnemiesInSurfaceSector( 11,8, ubNumAdmins, ubNumTroops, ubNumElites )
|
||||
|
||||
|
||||
-- I9
|
||||
if ( difficultyLevel == DIF_LEVEL_EASY ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 6 + math.random( 1, 5 )
|
||||
ubNumElites = 0
|
||||
elseif ( difficultyLevel == DIF_LEVEL_MEDIUM ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 9 + math.random( 1, 4 )
|
||||
ubNumElites = 0
|
||||
elseif ( difficultyLevel == DIF_LEVEL_HARD ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 10 + math.random( 1, 4 )
|
||||
ubNumElites = 2 + math.random( 1, 4 )
|
||||
elseif ( difficultyLevel == DIF_LEVEL_INSANE ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 20 + math.random( 1, 6 )
|
||||
ubNumElites = 2 + math.random( 1, 4 )
|
||||
end
|
||||
|
||||
SetNumberJa25EnemiesInSurfaceSector( 9,9, ubNumAdmins, ubNumTroops, ubNumElites )
|
||||
|
||||
-- First part of town
|
||||
-- I10
|
||||
if ( difficultyLevel == DIF_LEVEL_EASY ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 13 + math.random( 1, 6 )
|
||||
ubNumElites = 0
|
||||
elseif ( difficultyLevel == DIF_LEVEL_MEDIUM ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 16 + math.random( 1, 4 )
|
||||
ubNumElites = 1 + math.random( 1, 3 )
|
||||
elseif ( difficultyLevel == DIF_LEVEL_HARD ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 14 + math.random( 1, 4 )
|
||||
ubNumElites = 5 + math.random( 1, 3 )
|
||||
elseif ( difficultyLevel == DIF_LEVEL_INSANE ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 20 + math.random( 1, 4 )
|
||||
ubNumElites = 5 + math.random( 1, 3 )
|
||||
end
|
||||
|
||||
SetNumberJa25EnemiesInSurfaceSector( 10,9, ubNumAdmins, ubNumTroops, ubNumElites )
|
||||
|
||||
-- Second part of town
|
||||
-- I11
|
||||
if ( difficultyLevel == DIF_LEVEL_EASY ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 14 + math.random( 1, 7 )
|
||||
ubNumElites = 0
|
||||
elseif ( difficultyLevel == DIF_LEVEL_MEDIUM ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 16 + math.random( 1, 5 )
|
||||
ubNumElites = 2 + math.random( 1, 2 )
|
||||
elseif ( difficultyLevel == DIF_LEVEL_HARD ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 14 + math.random( 1, 4 )
|
||||
ubNumElites = 5 + math.random( 1, 4 )
|
||||
elseif ( difficultyLevel == DIF_LEVEL_INSANE ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 17 + math.random( 1, 4 )
|
||||
ubNumElites = 5 + math.random( 1, 4 )
|
||||
end
|
||||
|
||||
SetNumberJa25EnemiesInSurfaceSector( 11,9, ubNumAdmins, ubNumTroops, ubNumElites )
|
||||
|
||||
-- I12
|
||||
if ( difficultyLevel == DIF_LEVEL_EASY ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 8 + math.random( 1, 6 )
|
||||
ubNumElites = 0
|
||||
elseif ( difficultyLevel == DIF_LEVEL_MEDIUM ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 12 + math.random( 1, 5 )
|
||||
ubNumElites = 2 + math.random( 1, 2 )
|
||||
elseif ( difficultyLevel == DIF_LEVEL_HARD ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 12 + math.random( 1, 6 )
|
||||
ubNumElites = 3 + math.random( 1, 2 )
|
||||
elseif ( difficultyLevel == DIF_LEVEL_INSANE ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 20 + math.random( 1, 6 )
|
||||
ubNumElites = 3 + math.random( 1, 2 )
|
||||
end
|
||||
|
||||
SetNumberJa25EnemiesInSurfaceSector( 12,9, ubNumAdmins, ubNumTroops, ubNumElites )
|
||||
|
||||
-- Abandoned mine
|
||||
-- I13
|
||||
if ( difficultyLevel == DIF_LEVEL_EASY ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 0
|
||||
ubNumElites = 0
|
||||
elseif ( difficultyLevel == DIF_LEVEL_MEDIUM ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 0
|
||||
ubNumElites = 0
|
||||
elseif ( difficultyLevel == DIF_LEVEL_HARD ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 0
|
||||
ubNumElites = 0
|
||||
elseif ( difficultyLevel == DIF_LEVEL_INSANE ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 0
|
||||
ubNumElites = 0
|
||||
end
|
||||
|
||||
SetNumberJa25EnemiesInSurfaceSector( 13,9, ubNumAdmins, ubNumTroops, ubNumElites )
|
||||
|
||||
-- J11
|
||||
if ( difficultyLevel == DIF_LEVEL_EASY ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 10 + math.random( 1, 6 )
|
||||
ubNumElites = 0
|
||||
elseif ( difficultyLevel == DIF_LEVEL_MEDIUM ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 10 + math.random( 1, 3 )
|
||||
ubNumElites = 3 + math.random( 1, 2 )
|
||||
elseif ( difficultyLevel == DIF_LEVEL_HARD ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 11 + math.random( 1, 5 )
|
||||
ubNumElites = 6 + math.random( 1, 3 )
|
||||
elseif ( difficultyLevel == DIF_LEVEL_INSANE ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 20 + math.random( 1, 5 )
|
||||
ubNumElites = 6 + math.random( 1, 3 )
|
||||
end
|
||||
|
||||
SetNumberJa25EnemiesInSurfaceSector( 11,10, ubNumAdmins, ubNumTroops, ubNumElites )
|
||||
|
||||
-- J12
|
||||
if ( difficultyLevel == DIF_LEVEL_EASY ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 12 + math.random( 1, 4 )
|
||||
ubNumElites = 0
|
||||
elseif ( difficultyLevel == DIF_LEVEL_MEDIUM ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 10 + math.random( 1, 4 )
|
||||
ubNumElites = 1 + math.random( 1, 2 )
|
||||
elseif ( difficultyLevel == DIF_LEVEL_HARD ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 11 + math.random( 1, 3 )
|
||||
ubNumElites = 3 + math.random( 1, 2 )
|
||||
elseif ( difficultyLevel == DIF_LEVEL_INSANE ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 21 + math.random( 1, 3 )
|
||||
ubNumElites = 3 + math.random( 1, 2 )
|
||||
end
|
||||
|
||||
SetNumberJa25EnemiesInSurfaceSector( 12,10, ubNumAdmins, ubNumTroops, ubNumElites )
|
||||
|
||||
-- Power Generator, Ground Level
|
||||
-- J13
|
||||
if ( difficultyLevel == DIF_LEVEL_EASY ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 15 + math.random( 1, 6 )
|
||||
ubNumElites = 1
|
||||
elseif ( difficultyLevel == DIF_LEVEL_MEDIUM ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 16 + math.random( 1, 5 )
|
||||
ubNumElites = 5 + math.random( 1, 2 )
|
||||
elseif ( difficultyLevel == DIF_LEVEL_HARD ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 18 + math.random( 1, 4 )
|
||||
ubNumElites = 6 + math.random( 1, 3 )
|
||||
elseif ( difficultyLevel == DIF_LEVEL_INSANE ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 18 + math.random( 1, 4 )
|
||||
ubNumElites = 7 + math.random( 1, 3 )
|
||||
end
|
||||
|
||||
SetNumberJa25EnemiesInSurfaceSector( 13,10, ubNumAdmins, ubNumTroops, ubNumElites )
|
||||
|
||||
-- Complex, Ground Level
|
||||
-- K15
|
||||
if ( difficultyLevel == DIF_LEVEL_EASY ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 14 + math.random( 1, 5 )
|
||||
ubNumElites = 0
|
||||
elseif ( difficultyLevel == DIF_LEVEL_MEDIUM ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 18 + math.random( 1, 3 )
|
||||
ubNumElites = 4 + math.random( 1, 2 )
|
||||
elseif ( difficultyLevel == DIF_LEVEL_HARD ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 17 + math.random( 1, 3 )
|
||||
ubNumElites = 8 + math.random( 1, 2 )
|
||||
elseif ( difficultyLevel == DIF_LEVEL_INSANE ) then
|
||||
ubNumAdmins = 0
|
||||
ubNumTroops = 17 + math.random( 1, 3 )
|
||||
ubNumElites = 8 + math.random( 1, 2 )
|
||||
end
|
||||
|
||||
SetNumberJa25EnemiesInSurfaceSector( 15,11, ubNumAdmins, ubNumTroops, ubNumElites )
|
||||
end
|
||||
|
||||
-- init hospital variables
|
||||
HospitalTempBalance( 0 )
|
||||
HospitalRefund( 0 )
|
||||
HospitalPriceModifier( Modifier.HOSPITAL_UNSET )
|
||||
|
||||
end
|
||||
|
||||
function InitNewGame()
|
||||
|
||||
if ( is_networked == 0 ) then
|
||||
|
||||
--Add the initial email from enrico
|
||||
AddEmail( EMAIL_STARTGAME, EMAIL_STARTGAME_LENGTH, Sender.MAIL_ENRICO, -1 , -1 )
|
||||
|
||||
--Add the initial email from AIM
|
||||
AddEmail( EMAIL_AIMDISCOUNT, EMAIL_AIMDISCOUNT_LENGTH, Sender.AIM_SITE, -1 , -1 )
|
||||
|
||||
AddEmail(IMP_EMAIL_INTRO,IMP_EMAIL_INTRO_LENGTH,Sender.CHAR_PROFILE_SITE, -1 , -1 )
|
||||
|
||||
end
|
||||
|
||||
if ( difficultyLevel == DIF_LEVEL_EASY ) then
|
||||
iStartingCash = GetStartingCashNovice()
|
||||
elseif ( difficultyLevel == DIF_LEVEL_MEDIUM ) then
|
||||
iStartingCash = GetStartingCashExperienced()
|
||||
elseif ( difficultyLevel == DIF_LEVEL_HARD ) then
|
||||
iStartingCash = GetStartingCashExpert()
|
||||
elseif ( difficultyLevel == DIF_LEVEL_INSANE ) then
|
||||
iStartingCash = GetStartingCashInsane()
|
||||
end
|
||||
|
||||
AddTransactionToPlayersBook( Fincances.ANONYMOUS_DEPOSIT, 0, GetWorldTotalMin(), iStartingCash )
|
||||
|
||||
end
|
||||
@@ -0,0 +1,61 @@
|
||||
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()
|
||||
|
||||
-- JA2
|
||||
--[[
|
||||
if (cHour >= 4 or cHour < 20) then
|
||||
SetFactFalse( Facts.FACT_BROTHEL_OPEN )
|
||||
else
|
||||
SetFactTrue( Facts.FACT_BROTHEL_OPEN )
|
||||
end
|
||||
|
||||
|
||||
-- bar/nightclub
|
||||
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
|
||||
@@ -0,0 +1,21 @@
|
||||
-- SetNumberOfJa25BloodCatsInSector ( SectorX, SectorY, bNumBloodCats, bNumBloodCatPlacements )
|
||||
|
||||
local DIF_LEVEL_EASY = 1
|
||||
local DIF_LEVEL_MEDIUM = 2
|
||||
local DIF_LEVEL_HARD = 3
|
||||
local DIF_LEVEL_INSANE = 4
|
||||
|
||||
function InitStrategicLayer ()
|
||||
|
||||
-- I10 BloodCats
|
||||
if ( difficultyLevel == DIF_LEVEL_EASY ) then
|
||||
SetNumberOfJa25BloodCatsInSector ( 10, 9, 3, 5 )
|
||||
elseif ( difficultyLevel == DIF_LEVEL_MEDIUM ) then
|
||||
SetNumberOfJa25BloodCatsInSector ( 10, 9, 4, 5 )
|
||||
elseif ( difficultyLevel == DIF_LEVEL_HARD ) then
|
||||
SetNumberOfJa25BloodCatsInSector ( 10, 9, 5, 5 )
|
||||
elseif ( difficultyLevel == DIF_LEVEL_INSANE ) then
|
||||
SetNumberOfJa25BloodCatsInSector ( 10, 9, 5, 5 )
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,100 @@
|
||||
Profil = {
|
||||
CARMEN = 78,
|
||||
MARIA = 88,
|
||||
JOEY = 90,
|
||||
SKYRIDER = 97,
|
||||
JOHN = 118,
|
||||
MARY = 119,
|
||||
}
|
||||
|
||||
|
||||
|
||||
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,
|
||||
}
|
||||
|
||||
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,
|
||||
}
|
||||
|
||||
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,
|
||||
}
|
||||
|
||||
Facts =
|
||||
{
|
||||
FACT_SKYRIDER_EVER_ESCORTED = 269,
|
||||
}
|
||||
|
||||
function HandleStuffForNPCEscorted( ubNPC )
|
||||
-- UB: Nothing to do here!
|
||||
end
|
||||
|
||||
function CarmenLeavesSectorCallback()
|
||||
-- UB: Nothing to do here!
|
||||
end
|
||||
@@ -0,0 +1,40 @@
|
||||
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,
|
||||
}
|
||||
--[[
|
||||
Przyklad :
|
||||
function MakeBadSectorListFromMapsOnHardDrive ()
|
||||
|
||||
-- O15_b1
|
||||
if ( FindUnderGroundSector ( 15, SectorY.MAP_ROW_O , 1 ) == true and FindUnderGroundSectorVisited ( 15, SectorY.MAP_ROW_O , 1 ) == false ) then
|
||||
AddEnemyToUnderGroundSector (15,SectorY.MAP_ROW_O ,1,0,32,0)
|
||||
end
|
||||
|
||||
-- O14_b1
|
||||
if ( FindUnderGroundSector ( 15, SectorY.MAP_ROW_P, 1 ) == true and FindUnderGroundSectorVisited ( 15, SectorY.MAP_ROW_P , 1 ) == false ) then
|
||||
AddEnemyToUnderGroundSector (15 ,SectorY.MAP_ROW_P, 1 ,0 ,32, 0)
|
||||
end
|
||||
|
||||
end
|
||||
]]
|
||||
function MakeBadSectorListFromMapsOnHardDrive ()
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -0,0 +1,326 @@
|
||||
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,
|
||||
}
|
||||
|
||||
-- JA2 Remove
|
||||
|
||||
--[[
|
||||
-- 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 )
|
||||
|
||||
-- Ja2 Remove
|
||||
--[[
|
||||
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, Profil.SKYRIDER )
|
||||
|
||||
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
|
||||
|
||||
|
||||
function HandlePlayerTeamMemberDeath( ProfileId )
|
||||
local cnt
|
||||
local iLoop
|
||||
local pTeamSoldier
|
||||
|
||||
|
||||
-- JA2 Remove
|
||||
--[[
|
||||
|
||||
-- handle stuff for Carmen if Slay is killed
|
||||
|
||||
if ( ProfileId == Profil.SLAY ) then
|
||||
pTeamSoldier = FindSoldierByProfileID( Profil.CARMEN )
|
||||
|
||||
if ( CheckSoldierAttitude ( pTeamSoldier ) == Attitude.ATTACKSLAYONLY and not TileIsOutOfBounds(ClosestPC( pTeamSoldier, nil )) ) then
|
||||
-- Carmen now becomes friendly again
|
||||
TriggerNPCRecord( Profil.CARMEN, 29 )
|
||||
end
|
||||
|
||||
elseif ( ProfileId == Profil.ROBOT ) then
|
||||
|
||||
if ( CheckFact( Facts.FACT_FIRST_ROBOT_DESTROYED,0 ) == false ) then
|
||||
SetFactTrue( Facts.FACT_FIRST_ROBOT_DESTROYED )
|
||||
SetFactFalse( Facts.FACT_ROBOT_READY )
|
||||
else
|
||||
SetFactTrue( Facts.FACT_SECOND_ROBOT_DESTROYED )
|
||||
end
|
||||
end
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,632 @@
|
||||
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,
|
||||
BOBBY_R = 7,
|
||||
KING_PIN = 8,
|
||||
JOHN_KULBA = 9,
|
||||
AIM_SITE = 10,
|
||||
}
|
||||
|
||||
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 = 1,
|
||||
PROFILE_MISC_FLAG2_LEFT_COUNTRY = 2,
|
||||
PROFILE_MISC_FLAG2_BANDAGED_TODAY = 4,
|
||||
PROFILE_MISC_FLAG2_SAID_FIRSTSEEN_QUOTE = 8,
|
||||
PROFILE_MISC_FLAG2_NEEDS_TO_SAY_HOSTILE_QUOTE = 16,
|
||||
PROFILE_MISC_FLAG2_MARRIED_TO_HICKS = 32,
|
||||
PROFILE_MISC_FLAG2_ASKED_BY_HICKS = 64,
|
||||
}
|
||||
|
||||
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()
|
||||
|
||||
-- JA2 Remove
|
||||
--[[
|
||||
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) == 1 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 = 248, 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,322 @@
|
||||
--[[
|
||||
|
||||
http://www.legion.zone.zg.pl/doku.php/modowanie/ja/art_ja_m_22_lua
|
||||
|
||||
Global :
|
||||
|
||||
- giLairID
|
||||
|
||||
1 - Drassen
|
||||
2 - Cambria
|
||||
3 - Alma
|
||||
4 - Grumm
|
||||
|
||||
Function :
|
||||
|
||||
- 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
|
||||
|
||||
Example :
|
||||
|
||||
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, -- awarded only the first time it happens
|
||||
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,
|
||||
}
|
||||
|
||||
|
||||
function CheckConditionsForTriggeringCreatureQuest( sSectorX, sSectorY, bSectorZ )
|
||||
|
||||
local ubValidMines = 0
|
||||
|
||||
if ( gameStyle == 0 or enableCrepitus == 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 )
|
||||
|
||||
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
|
||||
@@ -0,0 +1,362 @@
|
||||
--[[
|
||||
|
||||
*************
|
||||
** 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 = {
|
||||
|
||||
--UB mine--
|
||||
-- Abandoned mine near Varrez
|
||||
{
|
||||
Location = "I13", Type = MineType.Gold,
|
||||
MinimumProduction = 0,
|
||||
AssociatedUnderground = { "I13-1", "J13-1", "K14-1", "K15-1", "K15-2", "L15-2", "L15-3" },
|
||||
},
|
||||
--[[
|
||||
-- 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
|
||||
@@ -0,0 +1,455 @@
|
||||
--[[
|
||||
|
||||
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 = {
|
||||
|
||||
|
||||
{ location = "I13-1", loadscreen = "LS_MINEDAY", },
|
||||
{ location = "J13-1", loadscreen = "LS_MINEDAY", },
|
||||
{ location = "J14-1", loadscreen = "LS_TUNNELS", },
|
||||
{ location = "K14-1", loadscreen = "LS_TUNNELS", },
|
||||
{ location = "K15-1", loadscreen = "LS_UPSTAIRS", },
|
||||
{ location = "K15-2", loadscreen = "LS_UPSTAIRS", },
|
||||
{ location = "L15-2", loadscreen = "LS_COMPLEXBSMNT", },
|
||||
{ location = "L15-3", loadscreen = "LS_BASEMENT_GENERIC", },
|
||||
|
||||
-- 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 --
|
||||
----------------------------------------------------------
|
||||
|
||||
if difficultyLevel == 1 then
|
||||
s["K15-1"].numTroops = 14 + math.random(0, 6)
|
||||
s["K15-1"].numElites = 0
|
||||
elseif difficultyLevel == 2 then
|
||||
s["K15-1"].numTroops = 14 + math.random(0, 4)
|
||||
s["K15-1"].numElites = 4 + math.random(0, 3)
|
||||
elseif difficultyLevel == 3 then
|
||||
s["K15-1"].numTroops = 15 + math.random(0, 4)
|
||||
s["K15-1"].numElites = 6 + math.random(0, 4)
|
||||
elseif difficultyLevel == 4 then
|
||||
s["K15-1"].numTroops = 14 + math.random(0, 6)
|
||||
s["K15-1"].numElites = 10 + math.random(0, 2)
|
||||
end
|
||||
|
||||
if difficultyLevel == 1 then
|
||||
s["K15-2"].numTroops = 10 + math.random(0, 3)
|
||||
s["K15-2"].numElites = 0
|
||||
elseif difficultyLevel == 2 then
|
||||
s["K15-2"].numTroops = 15 + math.random(0, 2)
|
||||
s["K15-2"].numElites = 5 + math.random(0, 2)
|
||||
elseif difficultyLevel == 3 then
|
||||
s["K15-2"].numTroops = 12 + math.random(0, 3)
|
||||
s["K15-2"].numElites = 10 + math.random(0, 2)
|
||||
elseif difficultyLevel == 4 then
|
||||
s["K15-2"].numTroops = 14 + math.random(0, 6)
|
||||
s["K15-2"].numElites = 10 + math.random(0, 2)
|
||||
end
|
||||
|
||||
if difficultyLevel == 1 then
|
||||
s["L15-2"].numTroops = 12 + math.random(0, 2)
|
||||
s["L15-2"].numElites = 1 + math.random(0, 2)
|
||||
elseif difficultyLevel == 2 then
|
||||
s["L15-2"].numTroops = 17 + math.random(0, 2)
|
||||
s["L15-2"].numElites = 5 + math.random(0, 2)
|
||||
elseif difficultyLevel == 3 then
|
||||
s["L15-2"].numTroops = 10 + math.random(0, 3)
|
||||
s["L15-2"].numElites = 14 + math.random(0, 2)
|
||||
elseif difficultyLevel == 4 then
|
||||
s["L15-2"].numTroops = 14 + math.random(0, 6)
|
||||
s["L15-2"].numElites = 10 + math.random(0, 2)
|
||||
end
|
||||
|
||||
if difficultyLevel == 1 then
|
||||
s["L15-3"].numTroops = 26
|
||||
s["L15-3"].numElites = 2
|
||||
elseif difficultyLevel == 2 then
|
||||
s["L15-3"].numTroops = 20
|
||||
s["L15-3"].numElites = 8
|
||||
elseif difficultyLevel == 3 then
|
||||
s["L15-3"].numTroops = 13
|
||||
s["L15-3"].numElites = 15
|
||||
elseif difficultyLevel == 4 then
|
||||
s["L15-3"].numTroops = 10
|
||||
s["L15-3"].numElites = 22
|
||||
end
|
||||
|
||||
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,148 @@
|
||||
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_1 = 10,
|
||||
INTRO_HELI_CRASH_SCENE_1 =11,
|
||||
INTRO_END_SCENE_1 = 12,
|
||||
-- there are no more videos shown for the endgame
|
||||
INTRO_LAST_END_GAME = 13,
|
||||
INTRO_FIRST_VIDEO = 255,
|
||||
}
|
||||
|
||||
IntroType = {
|
||||
INTRO_HELI_CRASH = 0,
|
||||
INTRO_BEGINNING = 1, -- set when viewing the intro at the begining of the game
|
||||
INTRO_ENDING = 2, -- set when viewing the end game video.
|
||||
INTRO_SPLASH = 3,
|
||||
}
|
||||
|
||||
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()
|
||||
|
||||
-- Ja25: no begining intro
|
||||
-- if its the heli crash intro
|
||||
if ( gbIntroScreenMode == IntroType.INTRO_HELI_CRASH ) then
|
||||
-- go to the init screen
|
||||
-- Ja25: no longer going to initscreen ( cause this is now AFTER mapscreen )
|
||||
|
||||
SetIntroExitScreen ( ScreenTypes.GAME_SCREEN )
|
||||
SetCurrentWorldSector( sSelMapX, sSelMapY, iCurrentMapSectorZ )
|
||||
|
||||
-- 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 )
|
||||
|
||||
elseif ( gbIntroScreenMode == IntroType.INTRO_ENDING ) then
|
||||
|
||||
SetIntroExitScreen ( ScreenTypes.GAME_SCREEN )
|
||||
SetCurrentWorldSector( iniDEFAULT_END_SECTOR_X, iniDEFAULT_END_SECTOR_Y, iniDEFAULT_END_SECTOR_Z )
|
||||
|
||||
EnterTacticalInFinalSector()
|
||||
|
||||
-- Dont leave tactical
|
||||
SetEnteringMapScreen (false)
|
||||
else
|
||||
-- We want to reinitialize the game
|
||||
ReStartingGame()
|
||||
|
||||
SetIntroExitScreen ( ScreenTypes.CREDIT_SCREEN )
|
||||
end
|
||||
|
||||
SetIntroScreenExit (true)
|
||||
end
|
||||
|
||||
|
||||
function GetNextIntroVideo( uiCurrentVideo )
|
||||
|
||||
-- UB Intro
|
||||
|
||||
-- switch on whether it is the beginging or the end game video
|
||||
if ( gbIntroScreenMode == IntroType.INTRO_HELI_CRASH ) then
|
||||
|
||||
if ( uiCurrentVideo == Video.INTRO_FIRST_VIDEO ) then
|
||||
StartVideo()
|
||||
SetVideo ( Video.INTRO_HELI_CRASH_SCENE_1 )
|
||||
StopVideo()
|
||||
end
|
||||
|
||||
-- end game
|
||||
elseif ( gbIntroScreenMode == IntroType.INTRO_ENDING ) then
|
||||
|
||||
if ( uiCurrentVideo == Video.INTRO_FIRST_VIDEO ) then
|
||||
StartVideo()
|
||||
SetVideo ( Video.INTRO_END_SCENE_1 )
|
||||
StopVideo()
|
||||
end
|
||||
|
||||
elseif ( gbIntroScreenMode == IntroType.INTRO_SPLASH ) then
|
||||
|
||||
if ( uiCurrentVideo == Video.INTRO_FIRST_VIDEO ) then
|
||||
StartVideo()
|
||||
SetVideo ( Video.INTRO_SPLASH_SCREEN )
|
||||
StopVideo()
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function SetIntroType( bIntroType )
|
||||
|
||||
-- UB Intro
|
||||
|
||||
if( bIntroType == IntroType.INTRO_HELI_CRASH ) then
|
||||
|
||||
SetIntroScreenMode ( IntroType.INTRO_HELI_CRASH )
|
||||
|
||||
elseif( bIntroType == IntroType.INTRO_ENDING ) then
|
||||
|
||||
SetIntroScreenMode ( IntroType.INTRO_ENDING )
|
||||
|
||||
elseif( bIntroType == IntroType.INTRO_SPLASH ) then
|
||||
|
||||
SetIntroScreenMode ( IntroType.INTRO_SPLASH )
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,247 @@
|
||||
--[[
|
||||
Global:
|
||||
|
||||
guiNumWorldItems
|
||||
|
||||
]]
|
||||
|
||||
Items = {
|
||||
MONEY = 219,
|
||||
}
|
||||
|
||||
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,
|
||||
}
|
||||
|
||||
EventTypes = {
|
||||
EVENT_SET_BY_NPC_SYSTEM = 27,
|
||||
}
|
||||
|
||||
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, -- JA2
|
||||
|
||||
-- UB Quests
|
||||
QUEST_DESTROY_MISSLES = 23,
|
||||
QUEST_FIX_LAPTOP = 24,
|
||||
QUEST_GET_RID_BLOODCATS_AT_BETTYS = 25,
|
||||
QUEST_FIND_ANTIQUE_MUSKET_FOR_RAUL = 26,
|
||||
}
|
||||
|
||||
Facts = {
|
||||
FACT_MUSEUM_ALARM_WENT_OFF = 278,
|
||||
FACT_KINGPIN_KNOWS_MONEY_GONE = 103,
|
||||
FACT_KINGPIN_DEAD = 308,
|
||||
FACT_ALL_TERRORISTS_KILLED = 156,
|
||||
}
|
||||
|
||||
local KINGPIN_MONEY_SECTOR_X = 5
|
||||
local KINGPIN_MONEY_SECTOR_Y = 4 -- MAP_ROW_D
|
||||
local KINGPIN_MONEY_SECTOR_Z = 1
|
||||
|
||||
local HOSPITAL_SECTOR_X = 8
|
||||
local HOSPITAL_SECTOR_Y = 6 -- MAP_ROW_F
|
||||
local HOSPITAL_SECTOR_Z = 0
|
||||
|
||||
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,
|
||||
}
|
||||
|
||||
function HandleQuestCodeOnSectorEntry( sNewSectorX, sNewSectorY, bNewSectorZ )
|
||||
|
||||
end
|
||||
|
||||
function HandleQuestCodeOnSectorExit( sOldSectorX, sOldSectorY, bOldSectorZ )
|
||||
|
||||
local pSoldier
|
||||
|
||||
-- JA2
|
||||
--[[
|
||||
if ( sOldSectorX == KINGPIN_MONEY_SECTOR_X and sOldSectorY == KINGPIN_MONEY_SECTOR_Y and bOldSectorZ == KINGPIN_MONEY_SECTOR_Z ) then
|
||||
CheckForKingpinsMoneyMissing( true )
|
||||
end
|
||||
|
||||
if ( sOldSectorX == 13 and sOldSectorY == SectorY.MAP_ROW_H and bOldSectorZ == 0 and CheckFact( Facts.FACT_CONRAD_SHOULD_GO,0 ) == true) then
|
||||
-- remove Conrad from the map
|
||||
SetCharacterSectorX(Profil.CONRAD, 0)
|
||||
SetCharacterSectorY(Profil.CONRAD, 0)
|
||||
end
|
||||
|
||||
if ( sOldSectorX == HOSPITAL_SECTOR_X and sOldSectorY == HOSPITAL_SECTOR_Y and bOldSectorZ == HOSPITAL_SECTOR_Z ) then
|
||||
CheckForMissingHospitalSupplies()
|
||||
end
|
||||
|
||||
-- reset the state of the museum alarm for Eldin's quotes
|
||||
SetFactFalse( Facts.FACT_MUSEUM_ALARM_WENT_OFF )
|
||||
]]
|
||||
|
||||
-- UB
|
||||
|
||||
if ( sOldSectorX == 7 and sOldSectorY == SectorY.MAP_ROW_H and bOldSectorZ == 0 ) then
|
||||
-- remove Jerry from the map
|
||||
SetCharacterSectorX( 76, 0)
|
||||
SetCharacterSectorY( 76, 0)
|
||||
end
|
||||
|
||||
-- if the player is leaving a sector with Tex in it
|
||||
if ( sOldSectorX == CheckCharacterSectorX(64) and sOldSectorY == CheckCharacterSectorY(64) and bOldSectorZ == 0 and CheckLastDateSpokenTot( 64 ) > 0 ) then
|
||||
|
||||
pSoldier = FindSoldierByProfileID( 64 ) -- TEX
|
||||
|
||||
-- if the npc isnt on the players team AND the player has never spoken to them
|
||||
if ( pSoldier == nil and CheckLastDateSpokenTot( 64 ) > 0 ) then
|
||||
|
||||
--remove Tex from the map
|
||||
SetCharacterSectorX( 64, 0)
|
||||
SetCharacterSectorY( 64, 0)
|
||||
end
|
||||
end
|
||||
|
||||
-- if the player is leaving a sector with John kulba in it
|
||||
if ( sOldSectorX == CheckCharacterSectorX(62) and sOldSectorY == CheckCharacterSectorY(62) and bOldSectorZ == 0 and CheckLastDateSpokenTot( 62 ) > 0 ) then
|
||||
|
||||
pSoldier = FindSoldierByProfileID( 62 ) -- John
|
||||
|
||||
-- if the npc isnt on the players team AND the player has never spoken to them
|
||||
if ( pSoldier == nil and CheckLastDateSpokenTot( 62 ) > 0 ) then
|
||||
|
||||
--remove Tex from the map
|
||||
SetCharacterSectorX( 62, 0)
|
||||
SetCharacterSectorY( 62, 0)
|
||||
end
|
||||
end
|
||||
|
||||
-- if the player is leaving a sector with Manuel in it
|
||||
if ( sOldSectorX == CheckCharacterSectorX(60) and sOldSectorY == CheckCharacterSectorY(60) and bOldSectorZ == 0 and CheckLastDateSpokenTot( 60 ) > 0 ) then
|
||||
|
||||
pSoldier = FindSoldierByProfileID( 60 ) -- John
|
||||
|
||||
-- if the npc isnt on the players team AND the player has never spoken to them
|
||||
if ( pSoldier == nil and CheckLastDateSpokenTot( 60 ) > 0 ) then
|
||||
|
||||
--remove Tex from the map
|
||||
SetCharacterSectorX( 60, 0)
|
||||
SetCharacterSectorY( 60, 0)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,31 @@
|
||||
--[[
|
||||
|
||||
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 = {
|
||||
|
||||
["I13-1"] = "unknown",
|
||||
|
||||
["J13-1"] = "Abandoned Mine",
|
||||
|
||||
["J14-1"] = "unknown",
|
||||
|
||||
["K14-1"] = "Tunnel",
|
||||
|
||||
["K15-1"] = "Complex",
|
||||
|
||||
["K15-2"] = "Complex",
|
||||
|
||||
["L15-2"] = "Complex",
|
||||
|
||||
["L15-3"] = "Complex",
|
||||
|
||||
creatureLair = "Creature Lair",
|
||||
}
|
||||
Reference in New Issue
Block a user