| Home Page | Recent Changes

ArrowSpawner

Actor >> Effects (UT) >> ArrowSpawner

This subclass of the ArrowSpawner enables you to use a trigger to set it off. The original ArrowSpawner could be set off using a trigger but it would go on forever, the following script (scripted by Tarquin) gives you the ability to tell the ArrowSpawner how many arrows to shoot before it turns off. To use the CountingArrowSpawner, go in the actor class / Effects / ArrowSpawner and choose CountingArrowSpawner. Put it in your map at the desired location, then set up a Trigger so that the CountingArrowSpawner is activated when triggered. Then, right-click the CountingArrowSpawner, then click CountingArrowSpawner Properties, now, click the '+' beside CountingArrowSpawner and finally, input the number of arrows desired to be shot before deactivation, that's it.

Extending

For an arrow spawner which fires a set number of arrows then stops, use this script. See Create A Subclass for instructions.

The ArrowSpawner still goes on forever when activated with a trigger.

Will look into it tomorrow. —Tarquin

Fixed and tested. —Tarquin

//=============================================================================
// CountingArrowSpawner.
//=============================================================================
class CountingArrowSpawner extends ArrowSpawner;

var() int ArrowCount ;
var int ArrowsToFire ;

state Active
{
    Ignores Trigger, UnTrigger ;
    function Timer()
    {
        local Arrow a;
        //Instigator.ClientMessage( "ArrowCount =" @ ArrowsToFire );

        if ( ArrowsToFire > 0) {
            if ( ArrowsToFire == 1) {
                SetTimer(0.0, False);
                
                GoToState('');
            }
            a = Spawn(class'Arrow',, '', Location+Vector(Rotation)*20);         
            a.Speed = ArrowSpeed;
            ArrowsToFire--;
            SetTimer(RepeatDelay, True);
        }
        else {
            a = Spawn(class'Arrow',,, Location+Vector(Rotation)*20);
            a.Speed = ArrowSpeed;
            SetTimer(RepeatDelay, True);
        }
    }

Begin:
    ArrowsToFire = ArrowCount ;
    SetTimer(TriggerDelay, True);
}

Notes

The property ArrowsToShootAfterDeactivated no longer has any effect. Some jiggery-pokery with a PreBeginPlay would fix this; add it to ArrowCount, for example – but not terribly logical.

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

FAQs

Help Desk

Mapping Topics

Mapping Lessons

UnrealEd Interface

UnrealScript Topics

UnrealScript Lessons

Making Mods

Class Tree

Modeling Topics

Chongqing Page

Log In