#Uses "myweapon" as a filler for name of the weapon. #Comma separated, whitespace ignored. #List of all weapons added by this script $$weaponsAdded:"" #List of custom attibutes those weapons should have on initialization #Custom attributes in an "other" field are always included. This only matters for script input vars. $$customAttributes:"" #Disable default weapon logic $$myweaponPath:-1 #List stat vars here. Format as weaponAttributeName. weaponOther is supported. #=================== #basic weapon logic that should always run, if any #For instance, if your weapon has limited charge it could recharge passively. #=================== :once @InitializeWeapons @GetWeaponStats RegisterForMsg("WeaponFired" "Fire") RegisterForMsg("CrosshairUpdated" "UpdateCrosshair") RegisterForMsg("ItemCollected" "GetWeaponStats") #Fire the weapon :Fire #Only do something if your weapon is active if(<-*activeWeapon "myweapon" eq) #If the weapon is unable to fire, set <-*fireTimer to 0 #so the script doesn't start the weapon's cooldown. endif :UpdateCrosshair if(<-*activeWeapon "myweapon" eq) #Handle targeting in here if any visuals depend on it else #Disable or hide custom visuals while other weapons are active endif #Called whenever the ItemCollected message is sent. #Stores the attributes of myweapon to variables with matching names. #Note the variable names are Capitalized. :GetWeaponStats #If you don't need all the attributes, feel free to replace this with a smaller list. <-*weaponAttributes{"myweapon"} GetTableKeys ->neededStats <-neededStats GetListCount 0 do <-neededStats[i] ->attribute <-*weaponAttributes{"myweapon"}{<-attribute} <-attribute ->! loop #=================== #Required for the weapon pack to work. :InitializeWeapons Split(RemoveWhiteSpace(<-weaponsAdded) ",") ->weaponsAdded RegisterScript(<-weaponsAdded[0]) SendMsg("Initialize" <-weaponsAdded[0])