Looks like I figured a way to give your character specific weapons right from the start - pretty simple too so figured I'd share in case anyone else is interested. The project I'm working on calls for an external program "manager" of sorts where you will decide what weapons you want to carry on a mission and that will edit the scripts used in the map. That way one map can be used (the external manager will control other aspects of modifying the base map to customize your mission as well).
So, what I do is place every weapon that could be used into the level - location doesn't matter as there's no distance check. You don't pick up the weapons, they are just added automatically. Next, select, "myloadweapon.lua" as the script for each weapon. Script is as follows:
-- LUA Script - precede every function and global member with lowercase name of script + '_main'
function myloadweapon_init_name(e,name)
weapon_name[e] = name
end
function myloadweapon_main(e)
if weapon_name[e] == "Colt 1911" then
AddPlayerWeapon(e)
Destroy(e)
end
if weapon_name[e] == "Magnum 357" then
AddPlayerWeapon(e)
Destroy(e)
end
if weapon_name[e] == "Shotgun" then
AddPlayerWeapon(e)
Destroy(e)
end
if weapon_name[e] == "Sniper M700" then
AddPlayerWeapon(e)
Destroy(e)
end
if weapon_name[e] == "Uzi" then
AddPlayerWeapon(e)
Destroy(e)
end
if weapon_name[e] == "RPG" then
AddPlayerWeapon(e)
Destroy(e)
end
if weapon_name[e] == "Grenades (Explosive)" then
AddPlayerWeapon(e)
Destroy(e)
end
end
It's simple enough .. just check the name of the weapon and if it equals one that you want to use, add it to the player. It's easy enough to deselect weapons - just comment out the "AddPlayerWeapon(e)" line of the weapon(s) you don't want and they will be removed.
Only thing I'm not sure how to do yet is to set each weapon to a specific slot in the player's inventory. That WOULD be nice. And I'm not sure (haven't tested enough) if the order they are added is random or if it follows the order in which the weapons were added to the level. If the latter, that would make it easy to set what you want where.
Enjoy! Or don't - up to you. (lol)