Jump to content

Automated Weapon or Item (Auto-Fire)

Overview
Creator: Timelord Updated: 06 May 2017 Tags: Global, Item Downloads: 57
Rating[?]: Rating: 4/5 (1 rating)
View Script Download Package
(888.39 KB)
Information

Description Setup Reviews Comments

Import this library (AutoFire_v2.1.z), and its dependencies:

std.zh
ItemHandling.zh (v6.7 or higher)
Timers.zh (v1.0 or higher)

Using this is relatively straightforward, assuming that you want a single item of this nature at any given time.

AutofireInitiate() sets the condition on the item to use. If using an item that produces an lweapon, specify it with AutofireInitiate(item, true) , rather than AutofireInitiate(item).

(This technically also allows you to use any item, even if it has instances on the screen, thus allowing machimne-gun type weapons, or other auto-weapons, based around a timer.)

Note: The attached ZC Custrom Quest (AutoFire.qst) has all the functions needed to produce this effect in its buffer, so that you may see them as isolated functions, and understand what's happening, and required.

Set Up the Item
The script uses an item to set an on and off repeat state. Apply the script 'repeatingWeapon' to an item, and set up the script arguments as follows:

D0: The item that will be repeatedly activated. If unset, this defaults to I_REPEAT.
D1: The timer duration between uses, including the initial activation. if unset, the default is 100.
D2: The decrement rate of the timer. If unset, this defaults to '1'.

Using the Quest

Enable the item that appears to be a longbow as the B-button item, then press B, and wait. Link will start firing arrows, on a regular basis; and you may select a different B-item, while still firing.

The automated item sue continues until you again select the bow item, and press B to turn it off, or press R to suspend it (thus, using the setRepeatOff() function).