get paid to paste

Random Encounters 1.0 sr3city.lua

--  xQd's sr3 city lua file --


-- Gameplay Choice IDs -------------------------------
-- these should match values from level_scripts.cpp
MISSION_06_CHOICE = 0
MISSION_22_CHOICE = 1
MISSION_21_CHOICE = 2

M06_CHOICE_BLOWN_TOWER = true;
M06_CHOICE_BRANDED_TOWER = false;
M22_CHOICE_KILLBANE_KILL = true;
M22_CHOICE_KILLBANE_ESCAPE = false;	
M21_CHOICE_KILLBANE_UNMASKED = true;
M21_CHOICE_KILLBANE_NOT_UNMASKED = false;

------------------------------------------------------


 --- Encounter Mod Shit --- 
 local Encounter = INVALID_THREAD_HANDLE
 local NotChecknone = INVALID_THREAD_HANDLE

 --- weapons removal on death and disable weapons from stash ---
 local NoMoreCribWeaponsStash = INVALID_THREAD_HANDLE
 local Removeweps = INVALID_THREAD_HANDLE
 local Removewepscoop = INVALID_THREAD_HANDLE

 
function sr3_city_init()
end


function sr3_city_main()
       -- turn_invulnerable(LOCAL_PLAYER) -- for testing purposes
        Encounter = thread_new("encm_notoriety_thread") -- random enc mod
     -- NoMoreCribWeaponsStash = thread_new("disable_add_weapons_to_crib_stash_thread") -- new game highly recommended(will be available ni realism mod)
     -- Removeweps = thread_new("removeallweps_thread") -- remove guns when dead (will be available in my realism mod)
end

--- Sum other encoeuter mod shit ---

function encm_notoriety_thread()
 local enc_thread = true
 local rti_ue -- rand int between encounters after m03
 local rti_cooldown = 20
 while enc_thread == true do
  local ambush = false
  if( mission_is_active() == false ) then
   local notdice
    if( mission_is_complete("m22") ) then
     rti_ue = rand_int(300,540)
     notdice = encm_luchadores_interest()
    elseif( mission_is_complete("m21") ) then 
     rti_ue = rand_int(300,580)
     notdice = encm_luchadores_interest()
    elseif( mission_is_complete("m20") ) then
     rti_ue = rand_int(300,620)
     notdice = encm_luchadores_interest()
    elseif( mission_is_complete("m16") ) then
     rti_ue = rand_int(300,700)
     notdice = encm_deckers_interest()
    elseif( mission_is_complete("m15") ) then
     rti_ue = rand_int(300,760)
     notdice = encm_deckers_interest() 
    elseif( mission_is_complete("m14") ) then
     rti_ue = rand_int(300,800)
     notdice = encm_deckers_interest()     
    elseif( mission_is_complete("m09") ) then
     rti_ue = rand_int(300,820)
     notdice = encm_morningstar_interest() 
    elseif( mission_is_complete("m08") ) then
     rti_ue = rand_int(300,840)
     notdice = encm_morningstar_interest() 
    elseif( mission_is_complete("m07") ) then
     rti_ue = rand_int(300,860)
     notdice = encm_morningstar_interest() 
    elseif( mission_is_complete("m06") ) then
     rti_ue = rand_int(300,900)
     notdice = encm_morningstar_interest() 
    elseif( mission_is_complete("m05") ) then
     rti_ue = rand_int(300,925)
     notdice = encm_morningstar_interest() 
    elseif( mission_is_complete("m04") ) then
     rti_ue = rand_int(300,950)
     notdice = encm_morningstar_interest() 
    elseif( mission_is_complete("m03") ) then 
     rti_ue = rand_int(300,1000)
     notdice = encm_morningstar_interest()        
    end
   delay(rti_ue)
    if ( (notoriety_gang_inexistent() == true ) or (notoriety_get("deckers") == 1 or notoriety_get("luchadores") == 1 or notoriety_get("Morningstar") == 1) ) then
     ambush = true
       NotChecknone = thread_new("notoriety_checkifnone_thread") --in case playa enters owned property so prevents extra noto for nothing
     hud_set_fake_notoriety( "deckers", true, 1 ) 
     hud_set_fake_notoriety( "luchadores", true, 1 ) 
     hud_set_fake_notoriety( "Morningstar", true, 1 ) 
     if( notdice == 2 ) then
       notoriety_set("deckers",5)
     elseif ( notdice == 3 ) then
       notoriety_set("luchadores",5)
     elseif ( notdice == 1 ) then
       notoriety_set("Morningstar",5)
     end
       delay(rti_cooldown)
      if( notoriety_gang_inexistent() == true ) then
       ambush = false
      end
      if( ambush == true) then
       thread_kill(NotChecknone) --dont need that bitch anymore
       if( notdice == 1 ) then
        hud_set_fake_notoriety( "Morningstar", false, 0 ) 
        notoriety_set_min("Morningstar", 2)
        notoriety_set("Morningstar", 2)
        notoriety_set_max("Morningstar", 3)
       elseif( notdice == 2 ) then
        hud_set_fake_notoriety( "deckers", false, 0 ) 
        notoriety_set_min("deckers", 2)
        notoriety_set("deckers", 2)
        notoriety_set_max("deckers", 3)
       elseif( notdice == 3 ) then
        hud_set_fake_notoriety( "luchadores", false, 0 ) 
        notoriety_set_min("luchadores", 2)
        notoriety_set("luchadores", 2)
        notoriety_set_max("luchadores", 3)   
       end 
      repeat
       delay(0.5) --delay to prevent the code insta repeat itself so it prevents crashing
       if ( notoriety_gang_inexistent() == true ) then
        notoriety_gang_set_to_normal()
       end
      until notoriety_gang_inexistent() == true
      end
    end
  end
   thread_yield()
 end
end

function encm_morningstar_interest()
    if(rand_int(1,10) == 1) then
      if(rand_int(1,2) == 1) then
       return 2
      else
       return 3
      end
     else
      return 1
    end       
end

function encm_deckers_interest()
    if(rand_int(1,10) == 1) then
      if(rand_int(1,2) == 1) then
       return 1
      else
       return 3
      end
     else
      return 2
    end 
end

function encm_luchadores_interest()
    if(rand_int(1,10) == 1) then
      if(rand_int(1,2) == 1) then
       return 1
      else
       return 2
      end
     else
      return 3
    end  
end


function notoriety_checkifnone_thread()
 local notchecknone = true
 while notchecknone == true do
    if ( notoriety_gang_inexistent() == true ) then
     notoriety_gang_set_to_normal()
    end
  thread_yield()
 end
end

function notoriety_gang_inexistent()
 if ( notoriety_get("deckers") == 0 and notoriety_get("luchadores") == 0 and notoriety_get("Morningstar") == 0) then
  return true
 else
  return false
 end
end

function notoriety_gang_set_to_normal()
     hud_set_fake_notoriety( "deckers", false, 0 )
     hud_set_fake_notoriety( "luchadores", false, 0 )
     hud_set_fake_notoriety( "Morningstar", false, 0 ) 
     notoriety_set_min("deckers", 0 )
     notoriety_set_min("luchadores", 0 )
     notoriety_set_min("Morningstar", 0 )
     notoriety_set_max("deckers", 5)
     notoriety_set_max("luchadores", 5)
     notoriety_set_max("Morningstar", 5)
end


--- Disable weapons to be added to crib stash ---

function disable_add_weapons_to_crib_stash_thread()
   while (true) do
      crib_weapon_add_disable()
      thread_yield()
   end   
end

--- Remove all the weapons from the player when he/she dies ---

function removeallweps_thread()
  Removewepscoop = thread_new("removeallweps_coop_thread") 
 while(true) do
  if( mission_is_active() == false) then
   if( character_is_dead(LOCAL_PLAYER) ) then
      remove_weapons(LOCAL_PLAYER)
   end   
  end
  thread_yield()
 end
end

function removeallweps_coop_thread()
 while(true) do
  if( coop_is_active() == true ) then
   if( character_is_dead(REMOTE_PLAYER) ) then
      remove_weapons(REMOTE_PLAYER)
   end
  end
 thread_yield()
 end
end
   

function remove_weapons()
 inv_item_remove_all()
end




                                --- Vanilla functions below (things we shouldnt be playin with) ---





-- ALL FOLLOWING COOP SKIP FUNCTIONS CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++)

-- Teleport players to a mission start node
--
-- mission_name:	(string) name of the mission start node (should be same as mission name)
-- skip_teleport:	(boolean) true to basically skip this whole function, nil or not true will run it
--
function sr3_teleport_mission_start(mission_name, skip_teleport)
	if skip_teleport == nil or skip_teleport ~= true then
		-- send them to the mission start
		local vehicle_exit = true
		local offset_x = 0.5
		teleport_to_object(LOCAL_PLAYER, mission_name, vehicle_exit, nil, offset_x)
		-- remote player not on top of player
		offset_x = -0.5
		teleport_to_object(REMOTE_PLAYER, mission_name, vehicle_exit, nil, offset_x)
	end
end

function m03_coop_skip( )
	crib_purchasing_unlock( )
end

function m06_coop_skip(skip_teleport)
	sr3_teleport_mission_start("m06", skip_teleport)
	-- Update the world state based on the choice that they made during the mission
	if game_choice_get_state( MISSION_06_CHOICE ) == M06_CHOICE_BRANDED_TOWER then
		city_zone_swap("tower_saints")
	else
		city_zone_swap("tower_dmg")
	end
	-- kill the building interior either way
	city_zone_swap("m6")

	-- Set Hood ('Henry Steel Mills') to Spawn THE BALL from now on as ambient
	spawn_override_change_hood_alternate_spawning("HOOD_DT_01", true)

	if not mission_is_complete( "m07" ) then
		-- make sure we unlocked it
		mission_unlock( "m07" )
		mission_set_next_mission( "m07" )
	end
end

function m10_coop_skip(skip_teleport)
	sr3_teleport_mission_start("m10", skip_teleport)
	set_stag_active(true)
	spawn_override_change_hood_alternate_spawning("HOOD_DT_02", true)
	
	city_zone_swap("thermext1") -- Thermopolye moves to south of DT
	city_zone_swap("therm2") -- This swap just the interior trigger and volume for thermext1.  Those two should be consolidated.
	city_zone_swap("stag") -- STAG shows up in DT
	traffic_disable_drawbridge_area(34, true) -- Disables splines on road through Sunset Park that STAG cordons off
end

function m13_coop_skip(skip_teleport)
	sr3_teleport_mission_start("m13", skip_teleport)
	city_zone_swap("hq_dmg") -- HQ is damaged during this mission, swap it in
end

function m14_coop_skip( )
	-- Set Saints to be 'Hated' following this mission
	set_saints_hated(true)
end

function m17_coop_skip(skip_teleport)
	sr3_teleport_mission_start("m17", skip_teleport)
	-- Set STAG Lockdown spawning for downtown hoods to True (Hood DT_02 still missing change, waiting on Chris N. solution to having two alternate spawn groups)
	spawn_override_change_hood_alternate_spawning("HOOD_DT_02", true)
	spawn_override_change_hood_alternate_spawning("HOOD_DT_03", true)
	
	-- Set STAG Lockdown area as immediate notoriety area
	set_stag_notoriety_area_active(true)
	
	-- Post mission swaps, Thermopolye destroyed and STAG take over downtown
	city_zone_swap("thermext1", false)
	city_zone_swap("therm2", false) -- This swap just the interior trigger and volume for thermext1.  Those two should be consolidated.
	city_zone_swap("therm3_dst")
	city_zone_swap("lockdown")
	
	-- Disable Traffic Splines Over Drawbridges
	traffic_disable_drawbridge_area(1, true)
	traffic_disable_drawbridge_area(2, true)
	traffic_disable_drawbridge_area(7, true)
	traffic_disable_drawbridge_area(8, true)
	traffic_disable_drawbridge_area(9, true)
	traffic_disable_drawbridge_area(10, true)
	traffic_disable_drawbridge_area(11, true)
	traffic_disable_drawbridge_area(12, true)
	traffic_disable_drawbridge_area(13, true)
	traffic_disable_drawbridge_area(14, true)
	traffic_disable_drawbridge_area(15, true)
	traffic_disable_drawbridge_area(16, true)
	traffic_disable_drawbridge_area(17, true)
	traffic_disable_drawbridge_area(18, true)
	traffic_disable_drawbridge_area(19, true)
	traffic_disable_drawbridge_area(20, true)
	traffic_disable_drawbridge_area(21, true)
	traffic_disable_drawbridge_area(22, true)
	traffic_disable_drawbridge_area(23, true)
	traffic_disable_drawbridge_area(24, true)
	traffic_disable_drawbridge_area(25, true)
	traffic_disable_drawbridge_area(27, true)
	traffic_disable_drawbridge_area(28, true)
	traffic_disable_drawbridge_area(29, true)
	traffic_disable_drawbridge_area(30, true)
	traffic_disable_drawbridge_area(31, true)
	traffic_disable_drawbridge_area(32, true)
	traffic_disable_drawbridge_area(33, true)
end

function m18_coop_skip(skip_teleport)
	sr3_teleport_mission_start("m18", skip_teleport)
	-- Set Hood ('Arapice Island') to Spawn Zombies from now on as ambient
	spawn_override_change_hood_alternate_spawning("HOOD_ZOMBIE", true)
	
	-- Set Drawbridge Traffic Splines to Arapice Island as 'Disabled'
	traffic_disable_drawbridge_area(3, true)
	traffic_disable_drawbridge_area(4, true)
	traffic_disable_drawbridge_area(5, true)
	traffic_disable_drawbridge_area(6, true)
	traffic_disable_drawbridge_area(26, true)
	
	-- Swap the Zombie zone
	city_zone_swap("chemcrash")
	city_zone_swap("zombies")
end

function m22_coop_skip(skip_teleport)
	sr3_teleport_mission_start("m22", skip_teleport)
	if game_choice_get_state( MISSION_22_CHOICE ) == M22_CHOICE_KILLBANE_KILL then
		mission_unlock( "m23" )
		city_zone_swap("rubble") -- Player went for Killbane, statue got blowed up
	else
		mission_unlock( "m24" )
	end
end

function m23_m24_coop_skip(skip_teleport)
	sr3_teleport_mission_start("m23", skip_teleport)
	
	-- Set STAG Inactive
	set_stag_active(false)
	
	-- Remove Lockdown Spawning from Downtown Hoods
	spawn_override_change_hood_alternate_spawning("HOOD_DT_02", false)
	spawn_override_change_hood_alternate_spawning("HOOD_DT_03", false)
	
	-- Set Traffic to Be Enabled Across Lockdown Drawbridges Again
	traffic_disable_drawbridge_area(7, false)
	traffic_disable_drawbridge_area(8, false)
	traffic_disable_drawbridge_area(9, false)
	traffic_disable_drawbridge_area(10, false)
	traffic_disable_drawbridge_area(11, false)
	traffic_disable_drawbridge_area(12, false)
	traffic_disable_drawbridge_area(13, false)
	traffic_disable_drawbridge_area(14, false)
	traffic_disable_drawbridge_area(15, false)
	traffic_disable_drawbridge_area(16, false)
	traffic_disable_drawbridge_area(17, false)
	traffic_disable_drawbridge_area(18, false)
	traffic_disable_drawbridge_area(19, false)
	traffic_disable_drawbridge_area(20, false)
	traffic_disable_drawbridge_area(21, false)
	traffic_disable_drawbridge_area(22, false)
	traffic_disable_drawbridge_area(23, false)
	traffic_disable_drawbridge_area(24, false)
	traffic_disable_drawbridge_area(25, false)
	traffic_disable_drawbridge_area(27, false)
	traffic_disable_drawbridge_area(28, false)
	traffic_disable_drawbridge_area(29, false)
	traffic_disable_drawbridge_area(30, false)
	traffic_disable_drawbridge_area(31, false)
	traffic_disable_drawbridge_area(32, false)
	traffic_disable_drawbridge_area(33, false)
	traffic_disable_drawbridge_area(34, false)
	
	-- Disable Downtown Notoriety Areas
	set_stag_notoriety_area_active(false)
	
	-- Set Saints to be beloved again
	set_saints_hated(false)
	
	-- Perform zone swaps
	city_zone_swap("hq_dmg", DISABLE) -- restore saints HQ
	
	-- Maybe allow you to play through again
	mission_maybe_uncomplete_m22()
end

function sh02_coop_skip(skip_teleport)
	sr3_teleport_mission_start("sh02", skip_teleport)
	crib_unlock_strongold("Crib_BDSM")
end

function sh03_coop_skip(skip_teleport)
	sr3_teleport_mission_start("sh03", skip_teleport)
	crib_unlock_strongold("Crib_Nuke")
end

function sh04_coop_skip(skip_teleport)
	sr3_teleport_mission_start("sh04", skip_teleport)
	crib_unlock_strongold("Crib_3Count")
end

Pasted: Sep 21, 2013, 9:15:48 am
Views: 10