Halo Like Weapon Switching

Does anyone have a script that when you hit a key,you switch from Weapon #1 to Weapon #2 like in Halo? If its not too much I’d rather have a script FILE rather than code. Thanks mates!

This is gonna be game/implementation specific. And not that hard to do yourself (which you’d kinda need to do, without having a whole system in-place or getting an fps system from the asset store).

viait more http://www.maxxvault.com/ERM-Connector-Allscripts.htm

Basically, my friends and I are recreating the first Halo: Combat Evolved level for practice and we can’t code or buy anything right now.

HTML not found.

No one has a script?

A weapon switch script is pretty simple. Just activate the weapon you want to switch to and deactivate the previous one. Like this :

var Gun1 : Transform;
var Gun2 : Transform;

function Update(){

//Activate Gun1

if(Input.GetKey(KeyCode.Alpha1)){
Gun1.active = true;
Gun2.active = false;
}
//Activate Gun2
if(Input.GetKey(KeyCode.Alpha2)){
Gun1.active = false;
Gun2.active = true;
}
}

I know it’s extremely simple but it works great. You can switch it up and make sounds animations play when you switch between your weapons.

1 Like