Difference between revisions of "Reloadable Automag"

From Oldunreal-Wiki
Jump to navigation Jump to search
(Added AI support and removed recasting)
 
Line 22: Line 22:


Compile and save. Once you are in a game, summon your new Automag, bind a key to the command "Button Bextra3" and hit it.
Compile and save. Once you are in a game, summon your new Automag, bind a key to the command "Button Bextra3" and hit it.
[[Category:Scripting]]

Latest revision as of 18:42, 10 September 2011

Manually reloading the Automag

It's actually really simple, and only requires a small block of code to be added to the end of the Automag script. Start by opening UnrealED and subclassing Automag. Package and class name doesn't matter. Copy and paste the following into your new Automag:

state Idle
{
Begin:
	bPointing=False;
	if ( (AmmoType != None) && (AmmoType.AmmoAmount<=0) )
		Pawn(Owner).SwitchToBestWeapon();  //Goto Weapon that has Ammo
	Disable('AnimEnd');
	LoopAnim('Sway1',0.02, 0.1);
	SetTimer(1.5,True);
	if ( Pawn(Owner).bFire!=0 ) Global.Fire(0.0);
	if ( Pawn(Owner).bAltFire!=0 ) Global.AltFire(0.0);
	if( PlayerPawn(Owner)!=None )
	{
		while( Pawn(Owner).bExtra3==0 )
			Sleep(0.05);
	}
	else Sleep(3.f); // If AI does not fire within 3 seconds, make em reload.
	GotoState('NewClip');
}

Compile and save. Once you are in a game, summon your new Automag, bind a key to the command "Button Bextra3" and hit it.