Wikia

Touhou Wiki

Touhou Danmakufu: Enemy Script Functions

7,297pages on
this wiki
Talk0

Functions for enemy scripts.


Enemy Control Functions

Functions to control the enemies.

SetLife

Sets the life of the enemy. The enemy is defeated when the life reaches 0 (more precisely, any value smaller than 1) In particular, if the life is set to 0 initially, the enemy will be defeated the moment it appears. The argument of the first instance of SetLife in each enemy script (even if it is in comments) is used in plural-scripts to determine the relative lengths of the health bars.

1 Parameter
    1) enemy's lives (default is 0)

AddLife

Add to the enemy lives. The lives is not recovered beyond the initial lives. When the argument is negative, some damages can be given to the enemy.

1 Parameter
    1) enemy's lives

SetTimer

Set the limit time of the boss attack. If not configured, the limit time is infinite.

1 Parameter
    1) limit time (in second)

SetInvincibility

Make the enemy invincible for the frames.

1 Parameter
    1) frames

SetDamageRate

Set the damage rates in percent. This rate is multiplied to the damage.

2 Parameters
    1) damage rate against shot (default is 100)
    2) damage rate against bomb (default is 100)

SetDamageRateEx

Set the damage rates in percent. The rates of the damage to the parent enemy can be set.

4 Parameters
    1) damage rate against shot (default is 100)
    2) damage rate against bomb (default is 100)
    3) rate of the damage to the parent enemy against shot (default is 0)
    4) rate of the damage to the parent enemy against bomb (default is 0)

SetDurableSpellCard

Make it an endurance spell card. The spell card bonus is given even if the time is up.

SetCollisionA

Set the collision detection circle between the enemy and the shot. Some collision detection circles can be registered.

3 Parameters
    1) x-coordinate of the center
    2) y-coordinate of the center
    3) radius

SetCollisionB

Set the collision detection circle between the enemy and the player's character. Some collision detection circles can be registered.

3 Parameters
    1) x-coordinate of the center
    2) y-coordinate of the center
    3) radius

SetScore

Set the score of the enemy. Or, set the spell card bonus, when the enemy is using a spell card.

1 Parameter
    1) score or spell card bonus

CreateEnemyFromScript

Create a child enemy which behavior is defined in the script.

6 Parameters
    1) child enemy script's name (string)
    2) x-coordinate
    3) y-coordinate
    4) velocity
    5) direction
    6) user-defined argument

CreateEnemyFromFile

Create a child enemy which behavior is defined in the file. Plural-script files can not be passed.

6 Parameters
    1) path of the enemy script (string)
    2) x-coordinate
    3) y-coordinate
    4) velocity
    5) direction
    6) user-defined argument

VanishEnemy

Vanish the enemy with no effects. The score is lost.

SetEnemyMarker

Set whether the enemy marker is displayed or not.

1 Parameter
    1) enemy marker state
        true : displayed
        false: hidden

LastSpell

Make it a last spell as Imperishable Night. Bombing is forbidden, and missing is canceled but the enemy's life becomes 0 and the spell card bonus is lost.


Effect and Miscellaneous Functions

Functions for graphic effects and miscellaneous functions.

Concentration01

Show the effect like concentrating the magic power for the frames. The color is one indicated by SetColor.

1 Parameter
    1) frames

Concentration02

Show the effect like concentrating the icy magic power for the frames.

1 Parameter
    1) frames

Explosion01

Show the effect like an explosion for the frames.

5 Parameters
    1) x-coordinate
    2) y-coordinate
    3) variation of the alpha value per frame
    4) spread velocity
    5) frames

MotionBlur

Do pseudo motion blur for the frames, i.e. leave the afterimage of the graphics. The render type is forced to be changed to additive blend.

3 Parameters
    1) objects
        ALL : bullets and characters
        SHOT: bullets only
    2) frames
    3) intensity (0 ~ 255)

MotionBlurEx

Do pseudo motion blur for the frames, i.e. leave the afterimage of the graphics.

4 Parameters 
    1) objects 
        ALL : bullets and characters 
        SHOT: bullets only 
    2) frames 
    3) intensity (0 ~ 255) 
    4) render type 
        ALPHA: alpha blend 
        ADD  : additive blend

Slow

Slow down the motion. Slow(0); cancels.

1 Parameter
    1) intensity
        0: normal
        1: 1/2
        2: 1/3
           :
           :
        n: 1/(n+1)

TimeStop

Stop the time for the frames. Stopped bullets have no collision detection, but stopped player's character has collision detection.

4 Parameters
    1) frames
    2) player's character
        0: not stopped
        1: stopped
    3) bullets
        0: not stopped
        1: stopped
    4) background
        0: not stopped
        1: stopped

CutIn

Show the cut-in. SetText needn't to be called.

7 Parameters
    1) type
        KOUMA: like  Touhou Koumakyou ~ Embodiment of Scarlet Devil
        YOUMU: like  Touhou Youyoumu ~ Perfect Cherry Blossom
    2) spell card name
    3) path of the graphic (string)
    4) left
    5) top
    6) right
    7) bottom

SetText

Show the spell card's name. It can change the name in the middle. SetText(""); vanishes the name.

1 Parameter
    1) spell card name (string)

MagicCircle

Set whether the magic circle is shown or not. The magic circle is diminished in synchronization with the timer.

1 Parameter
    1) state
        true : shown
        false: hidden

SetEffectForZeroLife

Configure the effects around the time to defeat the enemy.

3 Parameters
    1) frames till the enemy is disappeared
    2) intensity of motion blur (0 ~ 255)
    3) intensity of slowdown
        0: normal
        1: 1/2
        2: 1/3
           :
           :
        n: 1/(n+1)

CreateEventFromScript

Start the talk event. Event is equivalent.

1 Parameter
    1) name of the event script (string)

CreateItem

Create an item. This function is mostly used on the finalization.

3 Parameters
    1) type
        ITEM_1UP  : 1up
        ITEM_BOMB : bomb
        ITEM_SCORE: point
    2) x-coordinate
    3) y-coordinate

Expert

Disable continue and the debug keys.


Information Functions

Functions to get information of the enemy.

GetSpeedX

Get the x-velocity.

Return value
    x-velocity

GetSpeedY

Get the y-velocity.

Return value
    y-velocity

GetLife

Get the left lives of the enemy.

Return value
    lives

GetHitCount

Get the hit count (not lost lives) in the last frame.

Return value
    hit count

GetTimeOfInvincibility

Get the left frames of invincibility.

Return value
    frames

BeVanished

Get whether vanished by VanishEnemy or not.

Return value
    true : vanished
    false: defeated or alive

BeParentVanished

Get whether the parent enemy is vanished by VanishEnemy or not.

Return value
    true : vanished
    false: defeated or alive

IsMaster

Gets whether this is the master enemy, or a subordinate enemy.

Return value
    true : master enemy
    false: subordinate enemy

IsTimeOut

Gets whether the enemy is beaten by a time-up.

Return value
    true : a time-up occurred
    false: a time-up has not occurred

GetSpellCardBonusScore

Get the current score of the spell card bonus.

Return value
    spell card bonus

GotSpellCardBonus

Get whether the spell card bonus was gotten or not.

Return value 
    true : gotten 
    false: failed

OnEvent

Get whether on talk event or not.

Return value
    true : on talk event
    false: not on talk event

GetEventStep

Get the event step, which is the number set by SetStep in the talk event.

Return value
    event step (user-defined value)

GetArgument

Get the user-defined argument.

Return value
    user-defined argument

GetArgumentDefault

Get the user-defined argument. When there is no argument, 1) is returned.

1 Parameter
    1) value
Return value
    user-defined argument or 1)

Around Wikia's network

Random Wiki