编辑“︁
StendhalScripting/LuaAPI
”︁(章节)
跳转到导航
跳转到搜索
警告:
您没有登录。如果您进行任何编辑,您的IP地址会公开展示。如果您
登录
或
创建账号
,您的编辑会以您的用户名署名,此外还有其他益处。
反垃圾检查。
不要
加入这个!
== entities == See also: [[StendhalAPI#Entities]] for public methods that can be performed on <code>Entity</code> objects. Methods: ; ''<span style="color:green">entities:getPlayer</span>(name)'' : Retrieves a logged in Player. : '''''name:''''' (<code>String</code>) Name of player. : ''returns:'' Logged in {{StendhalFile|master|src/games/stendhal/server/entity/player/Player.java|Player}} or <code>null</code>. ; ''<span style="color:green">entities:getNPC</span>(name)'' : Retrieves an existing SpeakerNPC. : '''''name:''''' (<code>String</code>) Name of NPC. : ''returns:'' [[StendhalScripting/LuaAPI#LuaSpeakerNPC|SpeakerNPC]] instance or <code>null</code>. ; ''<span style="color:green">entities:getItem</span>(name)'' : Retrieves a registered Item. : '''''name:''''' (<code>String</code>) Name of the item. : ''returns:'' {{StendhalFile|master|src/games/stendhal/server/entity/item/Item.java|Item}} instance or <code>null</code> if not a registered item. ; ''<span style="color:green">entities:getStackableItem</span>(name)'' : Retrieves a registered StackableItem. : '''''name:''''' (<code>String</code>) Name of the item. : ''returns:'' {{StendhalFile|master|src/games/stendhal/server/entity/item/StackableItem.java|StackableItem}} instance or <code>null</code> if not a registered stackable item. ; ''<span style="color:green">entities:createSpeakerNPC</span>(name)'' : Creates an interactive NPC. : '''''name:''''' (<code>String</code>) Name of new NPC. : ''returns:'' New [[StendhalScripting/LuaAPI#LuaSpeakerNPC|SpeakerNPC]] instance. ; ''<span style="color:green">entities:createSilentNPC</span>()'' : Creates a non-interactive NPC. : ''returns:'' New [[StendhalScripting/LuaAPI#LuaSilentNPC|SilentNPC]] instance. ; ''<span style="color:green">entities:setPath</span>(entity, table, loop)'' : '''''DEPRECATED:''' path can now be set by directly calling the NPC's <code>setPath</code> method'' : Helper method for setting an NPC's path. : '''''entity:''''' (<code>RPEntity</code>) Then entity whose path is being set. : '''''table:''''' (<code>LuaTable</code>) Table with list of coordinates representing nodes. : '''''loop:''''' (<code>boolean</code>) If <code>true</code>, the entity's path should loop. ; ''<span style="color:green">entities:setPathAndPosition</span>(entity, table, loop)'' <nowiki> : '''''DEPRECATED:''' path can now be set by directly calling the NPC's <code>setPath</code> method'' : Helper function for setting an NPC's path & starting position. : '''''entity:''''' (<code>RPEntity</code>) Then entity whose path is being set. : '''''table:''''' (<code>LuaTable</code>) Table with list of coordinates representing nodes. : '''''loop:''''' (<code>boolean</code>) If <code>true</code>, the entity's path should loop. ; ''<span style="color:green">entities:createSign</span>(visible)'' : Creates a new {{StendhalFile|master|src/games/stendhal/server/entity/sign/Sign.java|Sign}} entity. : '''''visible:''''' (<code>boolean</code>) (optional) If <code>false</code>, the sign will not have a visual representation. : ''returns:'' New <code>Sign</code> instance. ; ''<span style="color:green">entities:createShopSign</span>(name, title, caption, seller)'' : Creates a new {{StendhalFile|master|src/games/stendhal/server/entity/sign/ShopSign.java|ShopSign}} entity. : '''''name:''''' (<code>String</code>) The shop name. : '''''title:''''' (<code>String</code>) The sign title. : '''''caption:''''' (<code>String</code>) The caption above the table. : '''''seller:''''' (<code>boolean</code>) <code>true</code>, if this sign is for items sold by an NPC (defaults to <code>true</code> if <code>null</code>). : ''returns:'' New <code>ShopSign</code> instance. ; ''<span style="color:green;">entities:summonCreature</span>(table)'' : Summons a creature into the area. : '''''table:''''' Key-value table containing parameters for summoning creature. :; ''keys:'' :: ''<span style="color:blue;">name:</span>'' (<code>string</code>) Name of creature to be summoned. :: ''<span style="color:blue;">zone:</span>'' (<code>string</code>) Name of zone where creature should be summoned. :: ''<span style="color:blue;">x:</span>'' (<code>int</code>) Horizontal position of summon location. :: ''<span style="color:blue;">y:</span>'' (<code>int</code>) Vertical position of summon location. :: ''<span style="color:blue;">summoner:</span>'' (<code>string</code>) (optional) Name of entity doing the summoning (used for logging game events). :: ''<span style="color:blue;">raid:</span>'' (<code>bool</code>) (optional) Whether or not the creature should be a <code>RaidCreature</code> instance (default: true). === Lua Entity Classes === ==== LuaSpeakerNPC ==== * Inherits: [[StendhalAPI#SpeakerNPC|SpeakerNPC]] Public methods: {{PublicMethod | add | params=states, triggers, conditions, nextState, reply, actions | desc=Additional method to support passing Lua data types as parameters. | paramlist= {{MethodParam | states | desc=The conversation state(s) the entity should be in to trigger response. Can be [[StendhalAPI#ConversationStates|ConversationStates enum]] value or <code>LuaTable</code> of ConversationStates. }} {{MethodParam | triggers | desc=<code>String</code> or <code>LuaTable</code> of strings to trigger response. }} {{MethodParam | conditions | desc=Conditions to check for this response. Can be [[StendhalAPI#ChatCondition|ChatCondition instance]], a <code>LuaTable</code> of ChatCondition instances, or a function. }} {{MethodParam | nextState | type=ConversationState | desc=Conversation state to set entity to after response. }} {{MethodParam | reply | type=String | desc=The NPC's response or <code>null</code>. }} {{MethodParam | actions | desc=Actions to execute. Can be [[StendhalAPI#ChatAction|ChatAction instance]], a <code>LuaTable</code> of ChatAction instances, or a function. }} }} {{PublicMethod | setPath | params=table, loop | desc=Set a path for this entity to follow. | paramlist= {{MethodParam | table | type=table | desc=Table of coordinates to set as path. Example: <code>{{35, 79}, {35, 89}, {40, 89}}</code> }} {{MethodParam | loop | type=boolean | desc=(optional) If <code>true</code>, entity should loop around to restart path when reaching the end. }} }} {{PublicMethod | setPathAndPosition | params=table, loop | desc=Set path & starting position for entity. The starting position is the first node in the path. | paramlist= {{MethodParam | table | type=table | desc=Table of coordinates to set as path. Example: <code>{{35, 79}, {35, 89}, {40, 89}}</code> }} {{MethodParam | loop | type=boolean | desc=(optional) If <code>true</code>, entity should loop around to restart path when reaching the end. }} }} ==== LuaSilentNPC ==== * Inherits: [[StendhalAPI#SilentNPC|SilentNPC]] Public methods: {{PublicMethod | setPath | params=table, loop | desc=Set a path for this entity to follow. | paramlist= {{MethodParam | table | type=table | desc=Table of coordinates to set as path. Example: <code>{{35, 79}, {35, 89}, {40, 89}}</code> }} {{MethodParam | loop | type=boolean | desc=(optional) If <code>true</code>, entity should loop around to restart path when reaching the end. }} }} {{PublicMethod | setPathAndPosition | params=table, loop | desc=Set path & starting position for entity. The starting position is the first node in the path. | paramlist= {{MethodParam | table | type=table | desc=Table of coordinates to set as path. Example: <code>{{35, 79}, {35, 89}, {40, 89}}</code> }} {{MethodParam | loop | type=boolean | desc=(optional) If <code>true</code>, entity should loop around to restart path when reaching the end. }} }} === entities.manager === This is simply the {{StendhalFile|master|src/games/stendhal/server/core/rule/defaultruleset/DefaultEntityManager.java|entity manager}} instance. Public methods: '''''TODO'''''
摘要:
请注意,所有对gamedev的贡献均可能会被其他贡献者编辑、修改或删除。如果您不希望您的文字作品被随意编辑,请不要在此提交。
您同时也向我们承诺,您提交的内容为您自己所创作,或是复制自公共领域或类似自由来源(详情请见
Gamedev:著作权
)。
未经许可,请勿提交受著作权保护的作品!
取消
编辑帮助
(在新窗口中打开)
导航菜单
个人工具
未登录
讨论
贡献
创建账号
登录
命名空间
页面
讨论
不转换
不转换
简体
繁體
大陆简体
香港繁體
澳門繁體
大马简体
新加坡简体
臺灣正體
查看
阅读
编辑
查看历史
更多
搜索
导航
首页
最近更改
随机页面
MediaWiki帮助
工具
链入页面
相关更改
特殊页面
页面信息