Difference between revisions of "NPC (TeaScript)"
Jump to navigation
Jump to search
m (minor edits) |
|||
(9 intermediate revisions by 6 users not shown) | |||
Line 24: | Line 24: | ||
|R&W | |R&W | ||
|The Y coordinate of the NPC. | |The Y coordinate of the NPC. | ||
+ | |- | ||
+ | |<code>width</code> | ||
+ | |R&W | ||
+ | |The width of the NPC. The sprite's width will also be altered if AutoScale is enabled. | ||
+ | |- | ||
+ | |<code>height</code> | ||
+ | |R&W | ||
+ | |The height of the NPC. The sprite's height will also be altered if AutoScale is enabled. | ||
|- | |- | ||
|<code>prX</code> | |<code>prX</code> | ||
Line 51: | Line 59: | ||
|<code>Facing</code> | |<code>Facing</code> | ||
|R&W | |R&W | ||
− | |The direction of the NPC. | + | |The direction of the NPC. 1: Left; 0: Right. |
|- | |- | ||
|<code>ForeColor</code> | |<code>ForeColor</code> | ||
Line 62: | Line 70: | ||
<code>ivalc</code> | <code>ivalc</code> | ||
|R&W | |R&W | ||
− | | | + | |Individual variables of the NPCs. Unused for custom NPCs. |
+ | Some default NPCs uses them and altering their values will define their behavior. ([https://wohlsoft.ru/forum/viewtopic.php?f=66&t=3191 More info here.]). | ||
|- | |- | ||
− | |haswing | + | |<code>haswing</code> |
|R&W | |R&W | ||
|Determines if the NPC has the wing special type and what type of wing movement it has. | |Determines if the NPC has the wing special type and what type of wing movement it has. | ||
Line 85: | Line 94: | ||
8 = SMW Lines | 8 = SMW Lines | ||
|- | |- | ||
− | |id | + | |<code>id</code> |
|R&W | |R&W | ||
|The ID of the NPC. | |The ID of the NPC. | ||
|- | |- | ||
− | |addvx | + | |<code>addvx</code> |
|? | |? | ||
|The x-axis platform speed of the NPC. | |The x-axis platform speed of the NPC. | ||
|- | |- | ||
− | |addvy | + | |<code>addvy</code> |
|? | |? | ||
|The y-axis platform speed of the NPC. | |The y-axis platform speed of the NPC. | ||
|- | |- | ||
− | |friendly | + | |<code>friendly</code> |
|R&W | |R&W | ||
|Determines if the NPC is marked as friendly or not. | |Determines if the NPC is marked as friendly or not. | ||
|- | |- | ||
− | |nomove | + | |<code>nomove</code> |
|R&W | |R&W | ||
|Determines if the NPC's "Don't Move" flag is enabled. | |Determines if the NPC's "Don't Move" flag is enabled. | ||
|- | |- | ||
− | |curframe | + | |<code>curframe</code> |
|R&W | |R&W | ||
|The current frame of the NPC. | |The current frame of the NPC. | ||
|- | |- | ||
− | |health | + | |<code>health</code> |
|R&W | |R&W | ||
|The current health of the NPC. | |The current health of the NPC. | ||
|- | |- | ||
− | |advSet | + | |<code>advSet</code> |
|R&W | |R&W | ||
− | |Determines the advanced value of the NPC. | + | |Determines the advanced setting value of the NPC. |
|- | |- | ||
− | |permID | + | |<code>permID</code> |
− | | | + | |R |
|The permanent ID of the NPC. | |The permanent ID of the NPC. | ||
|- | |- | ||
− | |alive | + | |<code>alive</code> |
|R&W | |R&W | ||
− | |Checks for if the NPC is alive or | + | |Checks for if the NPC is alive or not. Forcing this value to 0 won't completely kill the NPC, use 'nkill' instead. |
|- | |- | ||
− | |bkupx | + | |<code>bkupx</code> |
− | | | + | |R&W |
|The backup X position of the NPC. | |The backup X position of the NPC. | ||
|- | |- | ||
− | |bkupy | + | |<code>bkupy</code> |
− | | | + | |R&W |
|The backup Y position of the NPC. | |The backup Y position of the NPC. | ||
|- | |- | ||
− | |stand | + | |<code>stand</code> |
− | |R | + | |R&W |
− | |Determines if the NPC is | + | |Determines if the NPC is landing or not. |
|- | |- | ||
− | | | + | |<code>curtimer</code> |
− | | | + | |R&W |
− | |The individual frame timer of the NPC. Counts from 1 to 8 and then resets. | + | |The individual frame timer of the NPC. Counts from 1 to 8 and then resets. Not every NPC uses the frame timer. |
|- | |- | ||
− | |scount | + | |<code>scount</code> |
|? | |? | ||
− | |This value will be set to 1 if another NPC is colliding with the current. | + | |This value will be set to 1 if another NPC is colliding with the current. '''Deprecated in 1.4.5.''' |
|- | |- | ||
− | |dtcplayer | + | |<code>dtcplayer</code> |
|R&W | |R&W | ||
|Determines if the NPC is able to detect players. (1: off, 0: on) | |Determines if the NPC is able to detect players. (1: off, 0: on) | ||
|- | |- | ||
− | |dtcliquid | + | |<code>dtcliquid</code> |
|R&W | |R&W | ||
|Determines if the NPC is able to detect liquids or not. | |Determines if the NPC is able to detect liquids or not. | ||
|- | |- | ||
− | |dtcself | + | |<code>dtcself</code> |
|R&W | |R&W | ||
|Determines if the NPC is able to detect other NPCs or not. | |Determines if the NPC is able to detect other NPCs or not. | ||
|- | |- | ||
− | |zpos | + | |<code>zpos</code> |
|R&W | |R&W | ||
|The z-position of the NPC. | |The z-position of the NPC. | ||
|- | |- | ||
− | |inwater | + | |<code>inwater</code> |
− | | | + | |R |
− | |Determines if the NPC is | + | |Determines if the NPC is underwater or not. |
|- | |- | ||
− | |extset | + | |<code>extset</code> |
|R&W | |R&W | ||
− | |External settings for the NPC. For bubbles and | + | |External settings for the NPC. For bubbles, parachutes and Lakitus, this value stands for the NPC ID they contain. |
|- | |- | ||
− | |target | + | |<code>target</code> |
|R&W | |R&W | ||
− | |Determines which player is closest. Primarily used for chasing NPCs. | + | |Determines which player is the closest. Primarily used for chasing NPCs. |
|- | |- | ||
− | |hide | + | |<code>hide</code> |
|R&W | |R&W | ||
|Hides the NPC if set to 1. | |Hides the NPC if set to 1. | ||
|- | |- | ||
− | |langle | + | |<code>langle</code> |
− | | | + | |R&W |
|Unknown effect. | |Unknown effect. | ||
|- | |- | ||
− | |stimer | + | |<code>stimer</code> |
− | | | + | |R&W |
|Unknown effect. | |Unknown effect. | ||
+ | |- | ||
+ | |<code>talkevent</code> | ||
+ | |R&W | ||
+ | |Determines the event called (as a string) when pressing up in front of a friendly NPC. | ||
+ | |- | ||
+ | |<code>deathevent</code> | ||
+ | |R&W | ||
+ | |Determines the event called (as a string) when the assigned NPC is destroyed. | ||
+ | |- | ||
+ | |<code>activeevent</code> | ||
+ | |R&W | ||
+ | |Determines the event called (as a string) when the assigned NPC first appears on screen. | ||
+ | |- | ||
+ | |<code>nextframeevent</code> | ||
+ | |R&W | ||
+ | |Determines the event called (as a string) every frame the assigned NPC is active. | ||
+ | |- | ||
+ | |<code>touchevent</code> | ||
+ | |R&W | ||
+ | |Determines the event called (as a string) when a player comes into collision with the assigned NPC. | ||
+ | |- | ||
+ | |<code>grabedevent</code> | ||
+ | |R&W | ||
+ | |Determines the event called (as a string) when a player grabs the assigned NPC. '''(NOTE: The name is not a typo.)''' | ||
+ | |- | ||
+ | |<code>layerclearedevent</code> | ||
+ | |R&W | ||
+ | |Determines the event called (as a string) when every object within the assigned layer is destroyed/cleared. | ||
+ | |- | ||
+ | |<code>forecolor_r</code> | ||
+ | |R&W | ||
+ | |The red channel of the NPC's forecolor. | ||
+ | |- | ||
+ | |<code>forecolor_g</code> | ||
+ | |R&W | ||
+ | |The green channel of the NPC's forecolor. | ||
+ | |- | ||
+ | |<code>forecolor_b</code> | ||
+ | |R&W | ||
+ | |The blue channel of the NPC's forecolor. | ||
+ | |- | ||
+ | |<code>forecolor_a</code> | ||
+ | |R&W | ||
+ | |The alpha/transparency channel of the NPC's forecolor. | ||
+ | |- | ||
|} | |} |
Revision as of 06:40, 23 September 2020
NPC is a class in TeaScript.vbs that allows you to read/write values of NPCs.
To read the value of NPC
use:
NPC(index).name
To change the value of NPC
use:
NPC(index).name = value
Name | Type | Description |
---|---|---|
X
|
R&W | The X coordinate of the NPC. |
Y
|
R&W | The Y coordinate of the NPC. |
width
|
R&W | The width of the NPC. The sprite's width will also be altered if AutoScale is enabled. |
height
|
R&W | The height of the NPC. The sprite's height will also be altered if AutoScale is enabled. |
prX
|
R&W | The X coordinate of the original position's NPC. |
prY
|
R&W | The Y coordinate of the original position's NPC. |
Xsp
|
R&W | The X speed of the NPC. |
Ysp
|
R&W | The Y speed of the NPC. |
ExtX
|
R&W | The X placement of the GFX expansion. |
ExtY
|
R&W | The Y placement of the GFX expansion. |
Facing
|
R&W | The direction of the NPC. 1: Left; 0: Right. |
ForeColor
|
R&W | The color of the NPC. |
ivala
|
R&W | Individual variables of the NPCs. Unused for custom NPCs.
Some default NPCs uses them and altering their values will define their behavior. (More info here.). |
haswing
|
R&W | Determines if the NPC has the wing special type and what type of wing movement it has.
0 = None 1 = Jump 2 = Hover Left/Right 3 = Hover Up/Down 4 = Chase 5 = Hover Forward 6 = Lakitu's AI 7 = Controlled by NPC-308 8 = SMW Lines |
id
|
R&W | The ID of the NPC. |
addvx
|
? | The x-axis platform speed of the NPC. |
addvy
|
? | The y-axis platform speed of the NPC. |
friendly
|
R&W | Determines if the NPC is marked as friendly or not. |
nomove
|
R&W | Determines if the NPC's "Don't Move" flag is enabled. |
curframe
|
R&W | The current frame of the NPC. |
health
|
R&W | The current health of the NPC. |
advSet
|
R&W | Determines the advanced setting value of the NPC. |
permID
|
R | The permanent ID of the NPC. |
alive
|
R&W | Checks for if the NPC is alive or not. Forcing this value to 0 won't completely kill the NPC, use 'nkill' instead. |
bkupx
|
R&W | The backup X position of the NPC. |
bkupy
|
R&W | The backup Y position of the NPC. |
stand
|
R&W | Determines if the NPC is landing or not. |
curtimer
|
R&W | The individual frame timer of the NPC. Counts from 1 to 8 and then resets. Not every NPC uses the frame timer. |
scount
|
? | This value will be set to 1 if another NPC is colliding with the current. Deprecated in 1.4.5. |
dtcplayer
|
R&W | Determines if the NPC is able to detect players. (1: off, 0: on) |
dtcliquid
|
R&W | Determines if the NPC is able to detect liquids or not. |
dtcself
|
R&W | Determines if the NPC is able to detect other NPCs or not. |
zpos
|
R&W | The z-position of the NPC. |
inwater
|
R | Determines if the NPC is underwater or not. |
extset
|
R&W | External settings for the NPC. For bubbles, parachutes and Lakitus, this value stands for the NPC ID they contain. |
target
|
R&W | Determines which player is the closest. Primarily used for chasing NPCs. |
hide
|
R&W | Hides the NPC if set to 1. |
langle
|
R&W | Unknown effect. |
stimer
|
R&W | Unknown effect. |
talkevent
|
R&W | Determines the event called (as a string) when pressing up in front of a friendly NPC. |
deathevent
|
R&W | Determines the event called (as a string) when the assigned NPC is destroyed. |
activeevent
|
R&W | Determines the event called (as a string) when the assigned NPC first appears on screen. |
nextframeevent
|
R&W | Determines the event called (as a string) every frame the assigned NPC is active. |
touchevent
|
R&W | Determines the event called (as a string) when a player comes into collision with the assigned NPC. |
grabedevent
|
R&W | Determines the event called (as a string) when a player grabs the assigned NPC. (NOTE: The name is not a typo.) |
layerclearedevent
|
R&W | Determines the event called (as a string) when every object within the assigned layer is destroyed/cleared. |
forecolor_r
|
R&W | The red channel of the NPC's forecolor. |
forecolor_g
|
R&W | The green channel of the NPC's forecolor. |
forecolor_b
|
R&W | The blue channel of the NPC's forecolor. |
forecolor_a
|
R&W | The alpha/transparency channel of the NPC's forecolor. |