Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Replace Plasma Grenades with Frags v1.2 by H® Shaft for SAPP
- -- This script will:
- -- Set Frag and Plasma Grenade counts to what you specify
- -- Replace both the plasma grenade equipment and projectile with the frag grenade equipment and projectiles
- -- If you would like to do the opposite; replace Frag Grenades with Plasma, see other script.
- -- set grenade counts to what you want them. I suggest leaving 'plasma'_count to 0 (zero)
- -- Note: plasma count will show, but only frags will be thrown/picked up.
- frag_count = 2
- plasma_count = 0
- -- sapp api version
- api_version = "1.8.0.0"
- function OnScriptLoad()
- register_callback(cb['EVENT_GAME_START'],"OnNewGame")
- register_callback(cb['EVENT_SPAWN'],"OnPlayerSpawn")
- 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 OnPlayerSpawn(PlayerIndex)
- -- set grenade counts as they are set above
- if (player_alive(PlayerIndex) == true) then
- local player_object = get_dynamic_player(PlayerIndex)
- safe_write(true)
- write_word(player_object + 0x31E, frag_count)
- write_word(player_object + 0x31F, plasma_count)
- safe_write(false)
- end
- end
- function OnObjectSpawn(PlayerIndex, MapID, ParentID, ObjectID)
- -- Note: you cannot replace one object type for another, they must be the same type.
- -- obj_types: vehi, weap, bipd, eqip, proj
- -- replace plasma grenade eqip/equipment with frag grenades:
- if MapID == eqip_plasma_metaid then
- return true, eqip_frag_metaid
- end
- -- replace plasma grenade proj/projectiles with frag projectiles (doesn't happen until you throw):
- if MapID == proj_plasma_nade_metaid then
- return true, proj_frag_nade_metaid
- end
- -- end --
- return true
- end
- function GetMetaIDs()
- 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)
- 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)
- end
- -- Created by H® Shaft
- -- Visit http://halorace.org/forum/index.php
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement