thank you
I seem to have missed something when making it switch by pressing F
I'm not sure what i did wrong. also I'm thinking that adding AEmitter to play a sound at switch would be redundant due to the reload sound would already play.
... Just ignore the AEmitter I'm going to edit it out.
Mode1 codeCode:
-- this edit is a work in progress
function Create(self)
self.switchToWeapon = "Spiderbot Grenade Launcher Alt-Fire"; -- PresetName of gun to switch to
self.switchToClass = "HDFirearm";
end
function Update(self)
local actor = MovableMan:GetMOFromID(self.RootID);
if MovableMan:IsActor(actor) then
local actor = ToAHuman(actor);
if UInputMan:KeyHeld(6) then -- press f to switch modes
HDFirearm:Reload(); -- force reload as soon as weapon switches
-- ?????? = CreateAEmitter("SwitchSound", "X-9.rte"); -- play sound... might not need this due to it reloading
if self.switchToClass == "HDFirearm" then
local switchGun = actor:AddInventoryItem(CreateHDFirearm(self.switchToWeapon));
elseif self.switchToClass == "TDExplosive" then
local switchGun = actor:AddInventoryItem(CreateTDExplosive(self.switchToWeapon));
elseif self.switchToClass == "HeldDevice" then
local switchGun = actor:AddInventoryItem(CreateHeldDevice(self.switchToWeapon));
end
actor:GetController():SetState(Controller.WEAPON_DROP,true);
self.ToDelete = true;
end
end
end