Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Greenfall Setup v1.2 for CE Map: greenfall_v2 Link: http://www.mediafire.com/download/t2c816xht0mc1n8/greenfall_v2_release.zip
- -- by H® Shaft
- -- V1.2 Changes: Corrected a typo and the method of replacing RACE vehicles (cannot be done by metaid for metaid)
- -- Sets up Multi-Bipeds based on FFA/Team games:
- -- Team Games:
- -- Red Team are Grunts
- -- Blue Team are Cyborgs
- -- FFA Games: Random Player Selection of Cyborg or Grunt
- -- Zombies: Use your favorite zombie script, this script will set the Zombie Biped based on your gametype name/mode (see line 38)
- -- VEHICLE IDS: RACE vehicle setup: set the vehicle ID's you prefer for FFA Race and Team Race from these ID's
- -- chain_hog_id, epona_horse_id, walton_pickup_id, mesa_jeep_id, glendale_sedan_id, rocket_hog_id,
- -- sadler_pickup_id, hogfoot_fast_id, hogfoot_normal_id, hover_bike_id, hover_board_id, zeldas_horse_id
- -- ----- FFA RACE -----
- -- default FFA race vehicle 1 (normally the chain hog slot)
- default_ffa_race_vehicle_1 = "vehicles\\greenfall\\epona_horse"
- -- default FFA race vehicle 1 (normally the ghost slot)
- default_ffa_race_vehicle_2 = "vehicles\\greenfall\\hover_board"
- -- default FFA race vehicle 1 (normally the rocket hog slot)
- default_ffa_race_vehicle_3 = "vehicles\\greenfall\\zeldas_horse"
- -- ----- TEAM RACE -----
- -- default TEAM race vehicle 1 (normally the chain hog slot)
- default_team_race_vehicle_1 = "vehicles\\greenfall\\hogfoot_fast"
- -- default TEAM race vehicle 1 (normally the ghost slot)
- default_team_race_vehicle_2 = "vehicles\\greenfall\\walton_pickup"
- -- default TEAM race vehicle 1 (normally the rocket hog slot)
- default_team_race_vehicle_3 = "vehicles\\greenfall\\hogfoot_fast"
- -- Enter your zombie gametype/mode name (CASE sensitive) - only for Zombie biped selection, nothing else, (use your own zombie script)
- Zombie_Gametype_Name = "ZOMBIES"
- -- don't edit below --
- api_version = "1.9.0.0"
- team_play = false
- function OnScriptLoad()
- register_callback(cb['EVENT_OBJECT_SPAWN'], "OnObjectSpawn")
- register_callback(cb['EVENT_GAME_START'], "OnNewGame")
- register_callback(cb['EVENT_GAME_END'], "OnGameEnd")
- register_callback(cb['EVENT_CHAT'], "OnPlayerChat") -- delete maybe?
- if get_var(0, "$gt") ~= "n/a" then
- OnNewGame()
- end
- end
- function OnNewGame()
- map_name = get_var(0,"$map")
- if map_name ~= "greenfall_v2" then return end
- GetMetaIDs()
- team_play = getteamplay()
- end
- function OnGameEnd()
- OnScriptUnload()
- end
- function OnScriptUnload()
- DEFAULT_BIPED = nil
- end
- function OnObjectSpawn(PlayerIndex, MapID, ParentID, ObjectID)
- if not player_present(PlayerIndex) then return true end
- if (DEFAULT_BIPED == nil) then
- local tag_array = read_dword(0x40440000)
- for i=0,read_word(0x4044000C)-1 do
- local tag = tag_array + i * 0x20
- if(read_dword(tag) == 1835103335 and read_string(read_dword(tag + 0x10)) == "globals\\globals") then
- local tag_data = read_dword(tag + 0x14)
- local mp_info = read_dword(tag_data + 0x164 + 4)
- for j=0,read_dword(tag_data + 0x164)-1 do
- DEFAULT_BIPED = read_dword(mp_info + j * 160 + 0x10 + 0xC)
- end
- end
- end
- end
- if (MapID == DEFAULT_BIPED) then
- local team = get_var(PlayerIndex,"$team")
- local game_mode = get_var(0, "$mode")
- if team_play then
- if game_mode ~= Zombie_Gametype_Name then
- if team == "red" then
- return true, grunt_mp_id
- else
- return true, cyborg_mp_id
- end
- else
- if team == "red" then
- return true, altis_flood_id
- else
- return true, grunt_mp_id
- end
- end
- else
- local randbiped = rand(1,11)
- if randbiped > 5 then
- return true, grunt_mp_id
- else
- return true, cyborg_mp_id
- end
- end
- end
- if get_var(0, "$gt") == "race" then
- if not team_play then
- -- FFA RACE
- -- replace chain_hog_id with with default vehicle (chain hog slot) for FFA Race
- if MapID == get_tag_info("vehi", "vehicles\\greenfall\\chain_hog") then
- return true, get_tag_info("vehi", default_ffa_race_vehicle_1)
- end
- --replace epona_horse_id with with default vehicle (ghost slot) for FFA Race
- if MapID == get_tag_info("vehi", "vehicles\\greenfall\\epona_horse") then
- return true, get_tag_info("vehi", default_ffa_race_vehicle_2)
- end
- -- replace rocket_hog_id with with default vehicle (rocket hog slot) for FFA Race
- if MapID == get_tag_info("vehi", "vehicles\\greenfall\\rocket_hog") then
- return true, get_tag_info("vehi", default_ffa_race_vehicle_3)
- end
- else
- -- TEAM RACE
- -- replace chain_hog_id with with default vehicle (chain hog slot) for TEAM Race
- if MapID == get_tag_info("vehi", "vehicles\\greenfall\\chain_hog") then
- return true, get_tag_info("vehi", default_team_race_vehicle_1)
- end
- --replace epona_horse_id with with default vehicle (ghost slot) for TEAM Race
- if MapID == get_tag_info("vehi", "vehicles\\greenfall\\epona_horse") then
- return true, get_tag_info("vehi", default_team_race_vehicle_2)
- end
- -- replace rocket_hog_id with with default vehicle (rocket hog slot) for TEAM Race
- if MapID == get_tag_info("vehi", "vehicles\\greenfall\\rocket_hog") then
- return true, get_tag_info("vehi", default_team_race_vehicle_3)
- end
- end
- end
- return true
- end
- function get_tag_info(obj_type, obj_name)
- local tag_id = lookup_tag(obj_type, obj_name)
- return tag_id ~= 0 and read_dword(tag_id + 0xC) or nil
- end
- function GetMetaIDs()
- --Vehicles:
- chain_hog_id = read_dword(lookup_tag("vehi", "vehicles\\greenfall\\chain_hog") + 12)
- epona_horse_id = read_dword(lookup_tag("vehi", "vehicles\\greenfall\\epona_horse") + 12)
- walton_pickup_id = read_dword(lookup_tag("vehi", "vehicles\\greenfall\\walton_pickup") + 12)
- mesa_jeep_id = read_dword(lookup_tag("vehi", "vehicles\\greenfall\\mesa_jeep") + 12)
- glendale_sedan_id = read_dword(lookup_tag("vehi", "vehicles\\greenfall\\glendale_sedan") + 12)
- rocket_hog_id = read_dword(lookup_tag("vehi", "vehicles\\greenfall\\rocket_hog") + 12)
- sadler_pickup_id = read_dword(lookup_tag("vehi", "vehicles\\greenfall\\sadler_pickup") + 12)
- hogfoot_fast_id = read_dword(lookup_tag("vehi", "vehicles\\greenfall\\hogfoot_fast") + 12)
- hogfoot_normal_id = read_dword(lookup_tag("vehi", "vehicles\\greenfall\\hogfoot_normal") + 12)
- hover_bike_id = read_dword(lookup_tag("vehi", "vehicles\\greenfall\\hover_bike") + 12)
- hover_board_id = read_dword(lookup_tag("vehi", "vehicles\\greenfall\\hover_board") + 12)
- zeldas_horse_id = read_dword(lookup_tag("vehi", "vehicles\\greenfall\\zeldas_horse") + 12)
- --Bipeds:
- cyborg_mp_id = read_dword(lookup_tag("bipd", "nervebooger\\cyborg\\cyborg_mp") + 12)
- grunt_mp_id = read_dword(lookup_tag("bipd", "nervebooger\\grunt\\grunt_mp") + 12)
- altis_flood_id = read_dword(lookup_tag("bipd", "altis\\characters\\flood_human\\altis_flood") + 12)
- end
- function getteamplay()
- if get_var(0,"$ffa") == "0" then
- return true
- else
- return false
- end
- end
- function OnError(Message)
- print(debug.traceback())
- end
- function OnPlayerChat(PlayerIndex, Message)
- local response = nil
- local name = get_var(PlayerIndex,"$name")
- local Message = string.lower(Message)
- local isadmin = nil
- if (tonumber(get_var(PlayerIndex,"$lvl"))) >= 1 then isadmin = true else isadmin = false end
- -- | retrieve your coordinates x,y,z and rotation (yaw) (the direction you are facing, not "aim")
- if (Message == "coord") and isadmin then
- if isadmin then
- response = false
- local player_object = get_dynamic_player(PlayerIndex)
- local player_static = get_player(PlayerIndex)
- local x,y,z = read_vector3d(player_object + 0x5C)
- local rotation = read_float(player_static + 0x138)
- local map_name = get_var(0,"$map")
- local data = string.format("%s,%s,%s,%s,%s", tostring(map_name),tostring(x),tostring(y),tostring(z),tostring(rotation))
- execute_command("log_note \""..data.."\"")
- say(PlayerIndex, "X: " .. x .. " Y: " .. y .. " Z: " .. z .. " R: " .. rotation)
- else
- response = true
- end
- end
- return response
- end
- --Vehicle replacement slots for gametype setup in the lobby:
- --Warthog: Spawns Chain Hog (Race vehicle slot)
- --Ghost: Spawns Epona Horse (Race vehicle slot)
- --Scorpion: Spawns Walton Pickup
- --Banshee: Spawns a Mesa Jeep
- --Turret: Spawns a Glendale Sedan
- --Rocket hog: Spawns a Rocket Hog (Race vehicle slot)
- -- Created by H® Shaft
- -- Visit http://halorace.org/forum/index.php
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement