Hi, I was wondering if someone could help me complete this script. I'm not familiar with lua but I think I already have the necessary functions in it.
I think I just need to finish the OnDeath() function. Keep in mind that everyone in the mod will only spawn with one weapon. Also deleting the weapon should work at death because this worked in the events.txt:
event_die wdel $n 1'
api_version = "1.9.0.0"
function OnScriptLoad()
register_callback(cb['EVENT_DIE'],"OnDeath")
end
function OnDeath()
--should get the map_ids object
--if the weapon they were holding ~= map_ids.ball or map_ids.flag
--then delete the weapon dropped
end
function get_map_ids()
local globals_tag = read_dword(lookup_tag("matg","globals\\globals") + 0x14)
if read_dword(globals_tag + 0x14C) ~= 16 or read_dword(globals_tag + 0x158) ~= 5 then return end
local map_ids = {}
local weapons_address = read_dword(globals_tag + 0x14C + 0x4) + 0xC
map_ids.assault_rifle = read_dword(weapons_address + 0 * 16)
map_ids.flamethrower = read_dword(weapons_address + 1 * 16)
map_ids.gravity_rifle = read_dword(weapons_address + 2 * 16)
map_ids.needler = read_dword(weapons_address + 3 * 16)
map_ids.pistol = read_dword(weapons_address + 4 * 16)
map_ids.plasma_pistol = read_dword(weapons_address + 5 * 16)
map_ids.plasma_rifle = read_dword(weapons_address + 6 * 16)
map_ids.rocket_launcher = read_dword(weapons_address + 7 * 16)
map_ids.shotgun = read_dword(weapons_address + 8 * 16)
map_ids.sniper_rifle = read_dword(weapons_address + 9 * 16)
map_ids.frag_grenade = read_dword(weapons_address + 12 * 16)
map_ids.plasma_grenade = read_dword(weapons_address + 13 * 16)
map_ids.plasma_cannon = read_dword(weapons_address + 14 * 16)
map_ids.mp_needler = read_dword(weapons_address + 15 * 16)
local powerups_address = read_dword(globals_tag + 0x158 + 0x4) + 0xC
map_ids.active_camouflage = read_dword(powerups_address + 0 * 16)
map_ids.double_speed = read_dword(powerups_address + 1 * 16)
map_ids.full_spectrum_vision = read_dword(powerups_address + 2 * 16)
map_ids.overshield = read_dword(powerups_address + 3 * 16)
map_ids.health_pack = read_dword(powerups_address + 4 * 16)
local multiplayer_information = read_dword(globals_tag + 0x164 + 0x4)
map_ids.ball = read_dword(multiplayer_information + 0x4C + 0xC)
map_ids.flag = read_dword(multiplayer_information + 0x0 + 0xC)
local vehicles_address = read_dword(multiplayer_information + 0x20 + 0x4) + 0xC
map_ids.mp_warthog = read_dword(vehicles_address + 0 * 16)
map_ids.ghost_mp = read_dword(vehicles_address + 1 * 16)
map_ids.scorpion_mp = read_dword(vehicles_address + 2 * 16)
map_ids.banshee_mp = read_dword(vehicles_address + 3 * 16)
map_ids.c_gun_turret_mp = read_dword(vehicles_address + 4 * 16)
map_ids.rwarthog = read_dword(vehicles_address + 5 * 16)
return map_ids
end
function OnScriptUnload()
end