Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Block or Replace Object Creation v1.2 by H® Shaft
- -- This script will:
- -- Help you with replacing one object with another, or blocking it from being created, and using the best method for doing so.
- -- Note: Not intended as a game script, but a sample script to illustrate replacing one object with another, or blocking it from being created
- -- Advantage to replacing or blocking an object:
- -- You could disable a weapon with execute_command("disable_object weapons\\plasma_cannon\\plasma_cannon") or in events using disable_object, BUT,
- -- instead, why not replace it with a weapon/vehicle/equipment/projectile you WANT? Or, block it from being created?
- -- sapp api version
- api_version = "1.8.0.0"
- function OnScriptLoad()
- register_callback(cb['EVENT_GAME_START'], "OnNewGame")
- register_callback(cb['EVENT_OBJECT_SPAWN'], "OnObjectSpawn")
- if get_var(0, "$gt") ~= "n/a" then
- GetMetaIDs()
- end
- end
- function OnScriptUnload() end
- function OnNewGame()
- GetMetaIDs()
- end
- function OnObjectSpawn(PlayerIndex, MapID, ParentID, ObjectID)
- -- note: vehicles, flag/oddball can be ONLY be replaced/blocked using get_tag_info (Examine both below to see the difference).
- -- Weapons, Equipment, Bipeds and Projectiles can use both metaid replacement or get_tag_info methods.
- -- replace chain warthog with banshee
- if MapID == get_tag_info("vehi", "vehicles\\warthog\\mp_warthog") then
- return true, get_tag_info("vehi", "vehicles\\banshee\\banshee_mp")
- end
- -- replace rocket warthog with banshee
- if MapID == get_tag_info("vehi", "vehicles\\rwarthog\\rwarthog") then
- return true, get_tag_info("vehi", "vehicles\\banshee\\banshee_mp")
- end
- -- replace ghost vehicle with a banshee
- if MapID == get_tag_info("vehi", "vehicles\\ghost\\ghost_mp") then
- return true, get_tag_info("vehi", "vehicles\\banshee\\banshee_mp")
- end
- -- replace the active camo with an overshield
- if MapID == eqip_camo_metaid then
- return true, eqip_overshield_metaid
- end
- -- replace the fuel rod gun with a flame-thrower
- if MapID == weap_fuel_rod_gun_metaid then
- return true, weap_flamer_metaid
- end
- -- replace the flame thrower projectile with covie turret bolt - Very anti-banshee flamer- (you will still see the flames, but are shooting the bolt)
- if MapID == proj_flame_metaid then
- return true, proj_turret_bolt_metaid
- end
- -- replace the rocket launcher with a sniper rifle
- if MapID == weap_rocket_launcher_metaid then
- return true, weap_sniper_rifle_metaid
- end
- -- replace the pistol with a flame thrower
- if MapID == weap_pistol_metaid then
- return true, weap_flamer_metaid
- end
- -- replace frag grenade equipment with plasma grenades:
- if MapID == eqip_frag_metaid then
- return true, eqip_plasma_metaid
- end
- -- replace frag grenade projectiles with plasma projectiles (doesn't happen until you throw):
- if MapID == proj_frag_nade_metaid then
- return true, proj_plasma_nade_metaid
- end
- -- block the creation of the banshees fuel rod (alternate fire) projectile (you will still see it, but it won't be there, no damage)
- if MapID == proj_banshee_fuelrod_metaid then
- return false
- end
- -- block the creation of scorpion tank
- if MapID == get_tag_info("vehi", "vehicles\\scorpion\\scorpion_mp") then
- return false
- end
- -- block the creation of covenant turret
- if MapID == get_tag_info("vehi", "vehicles\\c gun turret\\c gun turret_mp") then
- return false
- 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
- -- items commented out here with "--" are still valid, but not used in THIS script, simply remove the "--" to use them in YOUR script
- function GetMetaIDs()
- vehi_cov_turret_metaid = read_dword(lookup_tag("vehi", "vehicles\\c gun turret\\c gun turret_mp") + 12)
- vehi_tank_metaid = read_dword(lookup_tag("vehi", "vehicles\\scorpion\\scorpion_mp") + 12)
- vehi_ghost_metaid = read_dword(lookup_tag("vehi", "vehicles\\ghost\\ghost_mp") + 12)
- vehi_banshee_metaid = read_dword(lookup_tag("vehi", "vehicles\\banshee\\banshee_mp") + 12)
- vehi_rocket_hog_metaid = read_dword(lookup_tag("vehi", "vehicles\\rwarthog\\rwarthog") + 12)
- vehi_chain_hog_metaid = read_dword(lookup_tag("vehi", "vehicles\\warthog\\mp_warthog") + 12)
- weap_fuel_rod_gun_metaid = read_dword(lookup_tag("weap", "weapons\\plasma_cannon\\plasma_cannon") + 12)
- weap_rocket_launcher_metaid = read_dword(lookup_tag("weap", "weapons\\rocket launcher\\rocket launcher") + 12)
- weap_sniper_rifle_metaid = read_dword(lookup_tag("weap", "weapons\\sniper rifle\\sniper rifle") + 12)
- --weap_plasma_pistol_metaid = read_dword(lookup_tag("weap", "weapons\\plasma pistol\\plasma pistol") + 12)
- --weap_flag_metaid = read_dword(lookup_tag("weap", "weapons\\flag\\flag") + 12)
- --weap_plasma_rifle_metaid = read_dword(lookup_tag("weap", "weapons\\plasma rifle\\plasma rifle") + 12)
- --weap_assault_rifle_metaid = read_dword(lookup_tag("weap", "weapons\\assault rifle\\assault rifle") + 12)
- weap_flamer_metaid = read_dword(lookup_tag("weap", "weapons\\flamethrower\\flamethrower") + 12)
- --weap_needler_metaid = read_dword(lookup_tag("weap", "weapons\\needler\\mp_needler") + 12)
- weap_pistol_metaid = read_dword(lookup_tag("weap", "weapons\\pistol\\pistol") + 12)
- --weap_shotgun_metaid = read_dword(lookup_tag("weap", "weapons\\shotgun\\shotgun") + 12)
- eqip_frag_metaid = read_dword(lookup_tag("eqip", "weapons\\frag grenade\\frag grenade") + 12)
- eqip_plasma_metaid = read_dword(lookup_tag("eqip", "weapons\\plasma grenade\\plasma grenade") + 12)
- eqip_camo_metaid = read_dword(lookup_tag("eqip", "powerups\\active camouflage") + 12)
- eqip_overshield_metaid = read_dword(lookup_tag("eqip", "powerups\\over shield") + 12)
- --eqip_health_metaid = read_dword(lookup_tag("eqip", "powerups\\health pack") + 12)
- proj_plasma_nade_metaid = read_dword(lookup_tag("proj", "weapons\\plasma grenade\\plasma grenade") + 12)
- proj_frag_nade_metaid = read_dword(lookup_tag("proj", "weapons\\frag grenade\\frag grenade") + 12)
- proj_banshee_fuelrod_metaid = read_dword(lookup_tag("proj", "vehicles\\banshee\\mp_banshee fuel rod") + 12)
- --proj_banshee_bolt_metaid = read_dword(lookup_tag("proj", "vehicles\\banshee\\banshee bolt") + 12)
- proj_turret_bolt_metaid = read_dword(lookup_tag("proj", "vehicles\\c gun turret\\mp gun turret") + 12)
- --proj_ghost_bolt_metaid = read_dword(lookup_tag("proj", "vehicles\\ghost\\ghost bolt") + 12)
- --proj_tank_bullet_metaid = read_dword(lookup_tag("proj", "vehicles\\scorpion\\bullet") + 12)
- --proj_tank_shell_metaid = read_dword(lookup_tag("proj", "vehicles\\scorpion\\tank shell") + 12)
- --proj_warthog_bullet_metaid = read_dword(lookup_tag("proj", "vehicles\\warthog\\bullet") + 12)
- --proj_assault_bullet_metaid = read_dword(lookup_tag("proj", "weapons\\assault rifle\\bullet") + 12)
- proj_flame_metaid = read_dword(lookup_tag("proj", "weapons\\flamethrower\\flame") + 12)
- --proj_needle_metaid = read_dword(lookup_tag("proj", "weapons\\needler\\mp_needle") + 12)
- --proj_pistol_bullet_metaid = read_dword(lookup_tag("proj", "weapons\\pistol\\bullet") + 12)
- --proj_plasma_pistol_bolt_metaid = read_dword(lookup_tag("proj", "weapons\\plasma pistol\\bolt") + 12)
- --proj_plasma_pistol_charge_metaid = read_dword(lookup_tag("proj", "weapons\\plasma rifle\\charged bolt") + 12)
- --proj_plasma_rifle_bolt_metaid = read_dword(lookup_tag("proj", "weapons\\plasma rifle\\bolt") + 12)
- --proj_fuelrod_metaid = read_dword(lookup_tag("proj", "weapons\\plasma_cannon\\plasma_cannon") + 12)
- --proj_rocket_metaid = read_dword(lookup_tag("proj", "weapons\\rocket launcher\\rocket") + 12)
- --proj_shotgun_pellet_metaid = read_dword(lookup_tag("proj", "weapons\\shotgun\\pellet") + 12)
- --proj_sniper_bullet_metaid = read_dword(lookup_tag("proj", "weapons\\sniper rifle\\sniper bullet") + 12)
- --bipd_campaign_biped_metaid = read_dword(lookup_tag("bipd", "characters\\cyborg\\cyborg") + 12)
- --bipd_mp_biped_metaid = read_dword(lookup_tag("bipd", "characters\\cyborg_mp\\cyborg_mp") + 12)
- end
- -- Created by H® Shaft with thanks to sehé°° and 002
- -- Visit http://halorace.org/forum/index.php
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement