(→Usage) |
(→Usage) |
||
Line 4: | Line 4: | ||
= Usage = | = Usage = | ||
For the examples below we will use the map 009-1 and position 25, 25. The only mandatory property is "callfunc" | For the examples below we will use the map 009-1 and position 25, 25. The only mandatory property is "callfunc" | ||
<br> | |||
== Basic npc == | == Basic npc == | ||
Object type: NPC<br> | Object type: NPC<br> | ||
Line 25: | Line 26: | ||
</pre> | </pre> | ||
That's nice but the NPC does not have a visible sprite, it defaults to 127. Let's add a sprite. | That's nice but the NPC does not have a visible sprite, it defaults to 127. Let's add a sprite. | ||
<br><br> | |||
== Adding a sprite == | == Adding a sprite == | ||
Line 50: | Line 52: | ||
</pre> | </pre> | ||
The "sprite" property is non-mandatory and defaults to 127 when not set. | The "sprite" property is non-mandatory and defaults to 127 when not set. | ||
<br><br> | |||
== Setting the direction == | == Setting the direction == | ||
Line 77: | Line 80: | ||
} | } | ||
</pre> | </pre> | ||
<br> | |||
== Setting as debug npc == | == Setting as debug npc == | ||
Line 111: | Line 115: | ||
} | } | ||
</pre> | </pre> | ||
<br> | |||
== Adding a trigger area == | == Adding a trigger area == | ||
Line 150: | Line 155: | ||
} | } | ||
</pre> | </pre> | ||
<br> | |||
== Adding custom variables == | == Adding custom variables == |
Revision as of 00:09, 18 March 2015
This proposal is to enable npc creation from Tiled. Should not be used for floating npcs (no map).
Usage
For the examples below we will use the map 009-1 and position 25, 25. The only mandatory property is "callfunc"
Basic npc
Object type: NPC
Object name: FooBar#Baz
Property | Value |
---|---|
callfunc | Qux |
Gives:
009-1,25,25,0|script|FooBar#Baz|127 { set @npcname$, "FooBar"; callfunc "Qux"; end; }
That's nice but the NPC does not have a visible sprite, it defaults to 127. Let's add a sprite.
Adding a sprite
Object type: NPC
Object name: FooBar#Baz
Property | Value |
---|---|
sprite | 161 |
callfunc | Qux |
Gives:
009-1,25,25,0|script|FooBar#Baz|161 { set @npcname$, "FooBar"; callfunc "Qux"; end; }
The "sprite" property is non-mandatory and defaults to 127 when not set.
Setting the direction
Object type: NPC
Object name: FooBar#Baz
Property | Value |
---|---|
direction | 3 |
sprite | 161 |
callfunc | Qux |
Gives:
009-1,25,25,3|script|FooBar#Baz|161 { set @npcname$, "FooBar"; callfunc "Qux"; end; }
Setting as debug npc
Object type: NPC
Object name: FooBar#Baz
Property | Value |
---|---|
debug | true |
direction | 3 |
sprite | 161 |
callfunc | Qux |
Gives:
009-1,25,25,3|script|FooBar#Baz|161 { set @npcname$, "FooBar"; callfunc "Qux"; end; OnInit: if(DEBUG) end; disablenpc "FooBar#Baz"; end; }
Adding a trigger area
Object type: NPC
Object name: FooBar#Baz
Property | Value |
---|---|
trigger | 2,4 |
debug | true |
direction | 3 |
sprite | 161 |
callfunc | Qux |
Gives:
009-1,25,25,3|script|FooBar#Baz|161,2,4 { end; OnTouch: set @npcname$, "FooBar"; callfunc "Qux"; end; OnInit: if(DEBUG) end; disablenpc "FooBar#Baz"; end; }
Adding custom variables
Object type: NPC
Object name: FooBar#Baz
Property | Value |
---|---|
@foo | 19 |
@bar$ | baz |
trigger | 2,4 |
debug | true |
direction | 3 |
sprite | 161 |
callfunc | Qux |
Gives:
009-1,25,25,3|script|FooBar#Baz|161,2,4 { end; OnTouch: set @foo, 19; set @bar$, "baz"; set @npcname$, "FooBar"; callfunc "Qux"; end; OnInit: if(DEBUG) end; disablenpc "FooBar#Baz"; end; }
Any property starting with @ is treated as a custom variable. Only temporary variables (@) can be set through NPC objects. To set global variables, please manually add a floating NPC.