|
|
(52 intermediate revisions by 9 users not shown) |
Line 1: |
Line 1: |
| + | __NOTOC__ |
| This page is for pasting code you want to show someone as an example or to get assistance with. This allows you to easily collaborate with someone to solve a problem, and allows easy comparisons of the edits. | | This page is for pasting code you want to show someone as an example or to get assistance with. This allows you to easily collaborate with someone to solve a problem, and allows easy comparisons of the edits. |
| | | |
− | You are free to remove any existing code from below, and paste your code between the <nowiki><uscript> </uscript></nowiki> tags. If the page hasn't been edited in 24 hours, you can assume it isn't needed anymore and can be removed. A full <span class="plainlinks">[{{fullurl:{{FULLPAGENAME}}|action=history}} edit history]</span> will be available, so don't worry about losing anything. | + | You are free to remove any existing code from below, and paste your code between the <nowiki><uscript> </uscript></nowiki> tags. If the page hasn't been edited in the last few hours (the last edit timestamp is {{timestamp}}), you can assume it isn't needed anymore and can be removed. A full <span class="plainlinks">[{{fullurl:{{FULLPAGENAME}}|action=history}} edit history]</span> will be available, so don't worry about losing anything you removed. |
| | | |
| + | '''Clean up after you're done!''' |
| ---- | | ---- |
| | | |
− | BattleTeamArena.BattleBotController:
| |
| <uscript> | | <uscript> |
− | state Reboot
| + | // paste your code here |
− | {
| + | |
− | ignores SeePlayer, EnemyNotVisible, HearNoise, ReceiveWarning, NotifyLanded, NotifyPhysicsVolumeChange,
| + | |
− | NotifyHeadVolumeChange, NotifyLanded, NotifyHitWall, NotifyBump, ExecuteWhatToDoNext;
| + | |
− | | + | |
− | event DelayedWarning() {}
| + | |
− | function DoRangedAttackOn(Actor A) {}
| + | |
− | function WhatToDoNext() {}
| + | |
− | function Celebrate() {}
| + | |
− | function bool SetRouteToGoal(Actor A) { return true; }
| + | |
− | function SetAttractionState() {}
| + | |
− | function EnemyChanged(bool bNewEnemyVisible) {}
| + | |
− | function WanderOrCamp() {}
| + | |
− | function Timer() {}
| + | |
− | | + | |
− | function BeginState(Name PreviousStateName)
| + | |
− | {
| + | |
− | if ((DefensePoint != None) && (UTHoldSpot(DefensePoint) == None)) FreePoint();
| + | |
− | if (NavigationPoint(MoveTarget) != None) {
| + | |
− | NavigationPoint(MoveTarget).FearCost = 2 * NavigationPoint(MoveTarget).FearCost + 600;
| + | |
− | WorldInfo.Game.bDoFearCostFallOff = true;
| + | |
− | }
| + | |
− | PendingMover = None;
| + | |
− | Enemy = None;
| + | |
− | StopFiring();
| + | |
− | bFrustrated = false;
| + | |
− | BlockedPath = None;
| + | |
− | bInitLifeMessage = false;
| + | |
− | bPlannedJump = false;
| + | |
− | bInDodgeMove = false;
| + | |
− | bReachedGatherPoint = false;
| + | |
− | bFinalStretch = false;
| + | |
− | bWasNearObjective = false;
| + | |
− | bPreparingMove = false;
| + | |
− | bPursuingFlag = false;
| + | |
− | bHasSuperWeapon = false;
| + | |
− | bHasTranslocator = false;
| + | |
− | ImpactJumpZ = 0.f;
| + | |
− | RouteGoal = None;
| + | |
− | NoVehicleGoal = None;
| + | |
− | SquadRouteGoal = None;
| + | |
− | bUsingSquadRoute = true;
| + | |
− | bUsePreviousSquadRoute = false;
| + | |
− | MoveTarget = None;
| + | |
− | ImpactVelocity = vect(0,0,0);
| + | |
− | LastSeenTime = -1000;
| + | |
− | bEnemyInfoValid = false;
| + | |
− | }
| + | |
− | | + | |
− | Begin:
| + | |
− | if ( WorldInfo.Game.bGameEnded )
| + | |
− | GotoState('RoundEnded');
| + | |
− | Sleep(0.1);
| + | |
− | TryAgain:
| + | |
− | if (UTGame(WorldInfo.Game) == None) {
| + | |
− | destroy();
| + | |
− | } else {
| + | |
− | Sleep(0.1);
| + | |
− | LastRespawnTime = WorldInfo.TimeSeconds;
| + | |
− | WorldInfo.Game.ReStartPlayer(self);
| + | |
− | Goto('TryAgain');
| + | |
− | }
| + | |
− | | + | |
− | MPStart:
| + | |
− | Sleep(0.1);
| + | |
− | WorldInfo.Game.ReStartPlayer(self);
| + | |
− | Goto('TryAgain');
| + | |
− | }
| + | |
| </uscript> | | </uscript> |
| | | |
− | ----
| + | ====Full Key==== |
− | | + | * <sup>1</sup> – {'''$Topic''' is relevant/available to/in} [[Unreal Engine 1]]. |
− | Taehl's Objective Weapons mod-in-progress:
| + | * <sup>2</sup> – {'''$Topic''' is relevant/available to/in} [[Unreal Engine 2]]. |
− | | + | * <sup>2+</sup> – {'''$Topic''' is relevant/available to/in} [[Unreal Engine 2]], from this version onwards. |
− | <uscript>
| + | * <sup>2x</sup> – {'''$Topic''' is relevant/available to/in} [[Unreal Engine 2]], starting with [[UT2004]]. |
− | //=============================================================================
| + | * <sup>3</sup> – {'''$Topic''' is relevant/available to/in} [[Unreal Engine 3]]. |
− | // OWweapon. | + | * <sup>3+</sup> – {'''$Topic''' is relevant/available to/in} [[Unreal Engine 3]], starting with [[UT3]] patch 2.0. |
− | // Parent class of all Objective Weapons.
| + | * <sup>3*</sup> – {'''$Topic''' is relevant/available to/in} [[Unreal Engine 3]], starting with [[UDK]]. |
− | // Is also a playable weapon, just for kicks (and coding practice).
| + | * (no number) – {'''$Topic''' is relevant/available to/in} all Unreal Engine generations. |
− | //=============================================================================
| + | <br> |
− | class OWweapon expands Weapon
| + | ====Enum Key==== |
− | abstract;
| + | {{classgames|Vector}}<sup>--|</sup><br> |
− | | + | {{classgames|Range}}<sup>--|'''2'''</sup><br> |
− | var() byte clip; // ammo in current clip
| + | {{classgames|Vector2D}}<sup>--|'''3'''</sup><br> |
− | var() byte clipmax; // ammo in a fresh clip
| + | {{classgames|Color}}<br> |
− | var() float acc; // how accurate a gun is. 0 is perfectly accurate.
| + | {{classgames|LinearColor}}<br> |
− | var() byte recoil; // add this much recoil per shot. 0 is no recoil.
| + | <br> |
− | var() byte damage; // how much damage the gun does.
| + | ====Class Key==== |
− | var() float rpm; // how many rounds are fired per minute.
| + | {{classgames|Actor}}<br> |
− | var() float reloadtime; // how many seconds it takes to reload.
| + | {{classgames|Rook}}<br> - TribesV? |
− | | + | {{classgames|SoundCue}}<br> |
− | ////////////////////////////////////////////////////////
| + | {{classgames|UTGreedGame}}<br> |
− | function fire( float Value ) {
| + | {{classgames|LegendObjectComponent}}<br> |
− | if (clip>0) GoToState('shoot');
| + | {{classgames|FluidSurfaceOscillator}}<br> |
− | else GoToState('reloading');
| + | {{classgames|Ammunition}}<br> |
− | }
| + | {{classgames|Util}}<br> |
− | | + | {{classgames|xUtil}} -UE2??<br> |
− | function altfire( float Value ) {
| + | {{classgames|UnrealPlayer}}<br> |
− | if (clip>0) GoToState('altshoot');
| + | {{classgames|xPlayer}} -UE2??<br> |
− | else GoToState('reloading');
| + | {{classgames|UTPlayerController}}<br> |
− | }
| + | {{classgames|WeaponFire}} |
− | | + | <br> |
− | exec function reload() {
| + | ====Keyword Key==== |
− | // local pawn p; | + | {{classgames|Expands}}<br> |
− | if (clip<clipmax) GoToState('reloading');
| + | {{classgames|Extends}}<br> |
− | } | + | {{classgames|server}}<br> |
− | | + | {{classgames|replicated}}<br> |
− | function dorecoil(float value) {
| + | {{classgames|intrinsic}}<br> |
− | local float up, side;
| + | |
− | up = ((value+(FRand()*value*10))/50);
| + | |
− | side = ((value+((FRand()-0.3)*value*10))/100); // recoil left or right, but more right
| + | |
− | PlayerPawn(Owner).alookup = up;
| + | |
− | PlayerPawn(Owner).aturn = side;
| + | |
− | }
| + | |
− | | + | |
− | function fireeffects() {
| + | |
− | local Vector realLoc, X,Y,Z;
| + | |
− | local UT_ShellCase s;
| + | |
− | realLoc = Owner.Location + CalcDrawOffset() + X*60;
| + | |
− | Spawn(class'WeaponLight',,'',realLoc,rot(0,0,0));
| + | |
− | // s = Spawn(class'UT_ShellCase',Pawn(Owner), '', realLoc + FireOffset.Y * Y + Z); | + | |
− | s = Spawn(class'UT_ShellCase',, '', realLoc + FireOffset.Y * Y + Z);
| + | |
− | // s.Eject(((FRand()*0.3+0.2)*X + (FRand()*0.2+0.2)*Y + (FRand()*0.3+1.0) * Z)*160); | + | |
− | s.Eject(((FRand()*0.3+0.4)*X + (FRand()*0.2+0.2)*Y + (FRand()*0.3+1.0) * Z)*160);
| + | |
− | }
| + | |
− | | + | |
− | function ProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vector X, Vector Y, Vector Z) {
| + | |
− | if (Other == Level)
| + | |
− | Spawn(class'UT_LightWallHitEffect',,, HitLocation+HitNormal*9, Rotator(HitNormal));
| + | |
− | else if ((Other != self) && (Other != Owner) && (Other != None) ) {
| + | |
− | if ( FRand() < 0.2 ) X *= 5;
| + | |
− | Other.TakeDamage(damage, Pawn(Owner), HitLocation, 300.0*X, 'shot');
| + | |
− | if ( !Other.IsA('Pawn') && !Other.IsA('Carcass') )
| + | |
− | spawn(class'SpriteSmokePuff',,,HitLocation+HitNormal*9);
| + | |
− | }
| + | |
− | }
| + | |
− | | + | |
− | //////////////////////////////////////////////////////// | + | |
− | state shoot {
| + | |
− | ignores fire, altfire, reload;
| + | |
− | Begin:
| + | |
− | CheckVisibility(); // no idea what this stuff does... best not to remove it?
| + | |
− | bPointing=True;
| + | |
− | Owner.MakeNoise(2*Pawn(Owner).SoundDampening);
| + | |
− | if (PlayerPawn(Owner) != None) {
| + | |
− | PlayerPawn(Owner).ClientInstantFlash(-0.4, vect(650, 450, 190));
| + | |
− | PlayerPawn(Owner).ShakeView(ShakeTime, ShakeMag, ShakeVert);
| + | |
− | }
| + | |
− | clip--; // remove a bullet from clip and shoot.
| + | |
− | TraceFire(acc);
| + | |
− | fireeffects();
| + | |
− | Owner.PlaySound(FireSound,SLOT_None,(1*Pawn(Owner).SoundDampening));
| + | |
− | PlayAnim( 'Fire', 1, 0.05);
| + | |
− | dorecoil(recoil);
| + | |
− | sleep(60/rpm);
| + | |
− | GoToState('Idle');
| + | |
− | Finish();
| + | |
− | }
| + | |
− | | + | |
− | state altshoot {
| + | |
− | ignores fire, altfire, reload;
| + | |
− | Begin:
| + | |
− | GoToState('shoot');
| + | |
− | // ProjectileFire(ProjectileClass, ProjectileSpeed, bWarnTarget);
| + | |
− | Finish();
| + | |
− | } | + | |
− | | + | |
− | state reloading {
| + | |
− | ignores fire, altfire, reload;
| + | |
− | Begin:
| + | |
− | if (AmmoType.AmmoAmount > 0) { // if player has spare ammo
| + | |
− | Owner.PlaySound(CockingSound, SLOT_None,1*Pawn(Owner).SoundDampening);
| + | |
− | PlayAnim('Down',1,0.05);
| + | |
− | Sleep(reloadtime);
| + | |
− | if (AmmoType.UseAmmo(clipmax)) clip = clipmax; // fill clip
| + | |
− | else {
| + | |
− | clip = AmmoType.AmmoAmount; // else partially fill clip
| + | |
− | AmmoType.AmmoAmount = 0; // and deplete ammo
| + | |
− | }
| + | |
− | Owner.PlaySound(SelectSound, SLOT_None,1*Pawn(Owner).SoundDampening);
| + | |
− | PlayAnim('Select',1,0.05);
| + | |
− | FinishAnim();
| + | |
− | }
| + | |
− | GoToState('Idle');
| + | |
− | Finish();
| + | |
− | } | + | |
− | </uscript> | + | |
− | | + | |
− | <uscript>
| + | |
− | //=============================================================================
| + | |
− | // OWshotgun. | + | |
− | // fully remade from an older project to work as an objective weapon. | + | |
− | //=============================================================================
| + | |
− | class OWshotgun expands OWWeapon;
| + | |
− | | + | |
− | // copied from olweapons.u - kinda fixes third person mesh
| + | |
− | #exec MESH IMPORT MESH=QuadShotthird ANIVFILE=MODELS\QuadShotPickup_a.3D DATAFILE=MODELS\QuadShotPickup_d.3D X=0 Y=0 Z=0
| + | |
− | #exec MESH ORIGIN MESH=QuadShotthird X=-164 Y=0 Z=70 YAW=64 Pitch=-7
| + | |
− | #exec MESH SEQUENCE MESH=QuadShotthird SEQ=All STARTFRAME=0 NUMFRAMES=1
| + | |
− | #exec MESHMAP SCALE MESHMAP=QuadShotthird X=0.02 Y=0.02 Z=0.04
| + | |
− | #exec MESHMAP SETTEXTURE MESHMAP=QuadShotthird NUM=4 TEXTURE=GunPick1
| + | |
− | // also copied from olweapons. fixes first-person model bugs | + | |
− | #exec MESH IMPORT MESH=QuadShotHeldr ANIVFILE=MODELS\QuadShotHeld_a.3D DATAFILE=MODELS\QuadShotHeld_d.3D
| + | |
− | #exec MESH ORIGIN MESH=QuadShotHeldr X=0 Y=0 Z=0 YAW=128
| + | |
− | #exec MESH SEQUENCE MESH=QuadShotHeldr SEQ=still STARTFRAME=29 NUMFRAMES=1
| + | |
− | #exec MESH SEQUENCE MESH=QuadShotHeldr SEQ=stillfire STARTFRAME=0 NUMFRAMES=1
| + | |
− | #exec MESH SEQUENCE MESH=QuadShotHeldr SEQ=all STARTFRAME=0 NUMFRAMES=30
| + | |
− | #exec MESH SEQUENCE MESH=QuadShotHeldr SEQ=fire STARTFRAME=0 NUMFRAMES=9
| + | |
− | #exec MESH SEQUENCE MESH=QuadShotHeldr SEQ=reload STARTFRAME=8 NUMFRAMES=21 Rate=24
| + | |
− | #exec MESH SEQUENCE MESH=QuadShotHeldr SEQ=select STARTFRAME=25 NUMFRAMES=5 Rate=8 GROUP=Select
| + | |
− | #exec MESH SEQUENCE MESH=QuadShotHeldr SEQ=down STARTFRAME=8 NUMFRAMES=6 Rate=20
| + | |
− | #exec MESHMAP SCALE MESHMAP=QuadShotHeldr X=0.01 Y=0.01 Z=0.02
| + | |
− | | + | |
− | var float clipb; // why a float? to use for volume of shoot sound.
| + | |
− | var byte shots;
| + | |
− | var byte clipstore;
| + | |
− | | + | |
− | ////////////////////////////////////////////////////////
| + | |
− | state shoot {
| + | |
− | ignores fire, altfire, reload;
| + | |
− | Begin:
| + | |
− | clipstore = clip;
| + | |
− | GoToState('altshoot');
| + | |
− | Finish();
| + | |
− | } | + | |
− | | + | |
− | state altshoot {
| + | |
− | ignores fire, altfire, reload;
| + | |
− | Begin:
| + | |
− | CheckVisibility(); // no idea what this stuff does... perhaps chop it out?
| + | |
− | bPointing=True;
| + | |
− | Owner.MakeNoise(2*Pawn(Owner).SoundDampening);
| + | |
− | if (PlayerPawn(Owner) != None) {
| + | |
− | PlayerPawn(Owner).ClientInstantFlash(-0.4, vect(650, 450, 190));
| + | |
− | PlayerPawn(Owner).ShakeView(ShakeTime, ShakeMag, ShakeVert);
| + | |
− | }
| + | |
− | if (clipstore>1) clip=1;
| + | |
− | for(clipb=0;clipb<clip;clipb+=1) {
| + | |
− | for(shots=0;shots<7;shots++) TraceFire(acc);
| + | |
− | fireeffects();
| + | |
− | }
| + | |
− | clipb = clip;
| + | |
− | Owner.PlaySound(FireSound,SLOT_None,clipb);
| + | |
− | PlayAnim( 'Fire', 1, 0.05);
| + | |
− | dorecoil((recoil*(1+(clip/2)))); // do recoil depending on barrels fired
| + | |
− | clip = clipstore-1;
| + | |
− | if (clip>clipmax) clip=0; // fix wraparound bug
| + | |
− | clipstore = 0;
| + | |
− | sleep(60/rpm);
| + | |
− | GoToState('Idle');
| + | |
− | Finish();
| + | |
− | } | + | |
− | | + | |
− | state reloading {
| + | |
− | ignores fire, altfire, reload;
| + | |
− | Begin:
| + | |
− | if (AmmoType.UseAmmo(1) && clip<clipmax) {
| + | |
− | PlayAnim( 'Reload', 1.05, 0.05);
| + | |
− | Owner.PlaySound(CockingSound,SLOT_None,1*Pawn(Owner).SoundDampening);
| + | |
− | clip++;
| + | |
− | FinishAnim();
| + | |
− | GoToState('idle');
| + | |
− | }
| + | |
− | Finish();
| + | |
− | } | + | |
− | </uscript> | + | |
This page is for pasting code you want to show someone as an example or to get assistance with. This allows you to easily collaborate with someone to solve a problem, and allows easy comparisons of the edits.
You are free to remove any existing code from below, and paste your code between the <uscript> </uscript> tags. If the page hasn't been edited in the last few hours (the last edit timestamp is 2011-10-06 07:41:16), you can assume it isn't needed anymore and can be removed. A full edit history will be available, so don't worry about losing anything you removed.