# Common questions

# 1. How to use data in Block API

There are specific requirements for data usage. It is not recommended for developers to use. Try to use other APIs which data are all encapsulated.

# 2. How to obtain ID/data for custom blocks and items(Use in setBlock/spawnItem and etc. )

There are 2 menthods to obtain: A. Use Handheld Editor - place in map, use Handheld Editor and click on target objects B. Print ID based on relavent trigger events Example:

Callback_ClickBlock = function(event_args)
	local blockid = event_args['blockid']
	Chat:sendSystemMsg('Target block ID is'..blockid)
end
ScriptSupportEvent:registerEvent([=[Player.ClickBlock]=], Callback_ClickBlock)

# 3. More info is required when set up face in Block API

For most blocks, ther are 6 faces: East/south/west/north/up/down. However, some special block might have only 5.

When block have 6 face:

Direction Value
East FACE_DIRECTION.DIR_POS_X
South FACE_DIRECTION.DIR_NEG_Z
Weat FACE_DIRECTION.DIR_NEG_X
North FACE_DIRECTION.DIR_POS_Z
Up FACE_DIRECTION.DIR_POS_Y
Down FACE_DIRECTION.DIR_NEG_Y

# 4. More info is required when set up setBlockAllForNotify/setBlockAllForUpdate in Block API

The flag and data from setBlockAllForNotify/setBlockAllForUpdate are unavailable for developers to use, relavent descriptions had been modified in wiki.

# 5. How to obtain uuid in ObjectLib API

It cannot be obtained in current version. Please stay tuned for future updates.

# 6. More info is required when set up particleId in World:playParticalEffect API

ParticleId list had been updated to wiki, contain the same effects in trigger function in game.

# 7. More info is required when set up soundId in World:playSoundEffectOnPos API

SoundId list had been updated to wiki, contain the same sound effects in trigger function in game.

# 8. How to obtain all Actor whe using World API(not World:getActorsByBox)

Due to game mechanism and efficiency, this function is unavailable to use. However the ActorID in trigger creature library is provided.

# 9. Detailed usage and explanations for parameter explanation is required for Event API

Event refers to developer events, which mean the events triggered by the corresponding player action. For example, player clicks a block, which will trigger an event(Player.ClickBlock). Developer only needs to monitor this event(Player.ClickBlock) to excute the following action.

How to monitor event: ScriptSupportEvent:registerEvent([=[Player.ClickBlock]=], function(event_args) ... end)

The developer event in the callback will return some corresponding parameters, please check Event System for detail parameters.

# 10. More info is required for name and uiname in setGBattleUI/setShapeLine/setShapeCircle for UI API

  1. name is the enumerated value of string in setGBattleUI, can be set up as below:
name value type value describe
'left_title' string Left title(Top 1)
'right_title' string Right title(/40)
'left_desc' string Left description()(Winner Winner, Sweet dinner)
'left_little_desc' string Left brief description(Ranking)
'right_little_desc' string Right brief description(Defeat)
'battle_btn' boolean Score Navbar display
'result' boolean Game result display
'result_bkg' boolean Game result bottom display
'reopen' boolean One more game button
  1. setShapeLine and setShapeCircle is currently unavailable to use, which will be replaced when Custom UI is developed.

# 11. ore info is required for type in UI:ShowScreenEffect

This API is used to display screen effects. The value for type means: 1 = speedline 2 = powerline 3 = fog

# 12. More info is required for path in Game:addRenderGlobalEffect

path, refers to the path when setup the global effect. Currently available path is "particles/Fog.ent". Please check scripts in Map Examples for better understanding.

# 13. More info is required for id in Game:getDefString

It is not recommended to use this API, and try to use custom string

# 14. More info is required for actionattr in Player:setActionAttrState

setActionAttrState is used to set up the status for player special attributes(eg. movable, attackable and etc.). Please refer to PLAYERATTR_ENABLE for more parameters.

# 15. More info is required for teamid in Team API

The game currently support up to six teams in map, as below:

Team Team Color TeamID
Team1 Red 1
Team2 Blue 2
Team3 Green 3
Team4 Yellow 4
Team5 Orange 5
Team6 Purple 6

When using Team API, use teamid -1 to represent all teams. If there are no team setup for players and creatures, the teamid is 0, which is one of status for no team

# 16.appendSpeed API parameter

The parameters x,y, and z is to setup the moving distance, which require integers.

Example: Assuming that z is set to 5, when the API is executed, objid will move 5 blocks towards +z axis

Format: appendSpeed(objid,0,0,5)

# 17. How to use pos from getBlockPowerStatus

Assuming we want to determine whether the block with coordinates of (7, 7, 7) is energized,

Format:

    local pos = {x=7,y=7,z=7}
    Block:getBlockPowerStatus(pos)

Common mistakes:

    local pos = {7,7,7}
    Block:getBlockPowerStatus(pos)
Last Update: 4/15/2020, 6:29:50 PM