Ygor Castro
New Member
- Joined
- Feb 22, 2016
- Messages
- 6
- Reaction score
- 0
Module
name: game_mymodule
description: My creepy duck with hp and mana bars
author: gesior
website: www.skalski.pro
sandboxed: true
scripts: [ mymodule ]
@onLoad: init()
@onUnload: terminate()
HealthBar < ProgressBar
id: healthBar
background-color: #ff4444
anchors.bottom: parent.bottom
anchors.right: parent.right
margin-bottom: 45
ManaBar < ProgressBar
id: manaBar
background-color: #4444ff
anchors.top: prev.bottom
anchors.right: parent.right
margin: 1
margin-top: 5
Panel
id: mymodule
image-source: /images/duck
image-smooth: true
image-fixed-ratio: true
anchors.left: parent.left
anchors.bottom: parent.bottom
margin-top: 1
focusable: false
HealthBar
ManaBar
-- private variables
local mymodule
local healthBar = nil
local manaBar = nil
-- public functions
function init()
mymodule = g_ui.loadUI('mymodule', modules.game_interface.getMapPanel())
healthBar = mymodule:recursiveGetChildById('healthBar')
manaBar = mymodule:recursiveGetChildById('manaBar')
connect(LocalPlayer, { onHealthChange = onHealthChange,
onManaChange = onManaChange })
connect(g_game, { onGameStart = show,
onGameEnd = hide })
end
function terminate()
disconnect(LocalPlayer, { onHealthChange = onHealthChange,
onManaChange = onManaChange })
disconnect(g_game, { onGameStart = show,
onGameEnd = hide })
mymodule:destroy()
mymodule = nil
end
function onHealthChange(localPlayer, health, maxHealth)
healthBar:setValue(health, 0, maxHealth)
end
function onManaChange(localPlayer, mana, maxMana)
manaBar:setValue(mana, 0, maxMana)
end
function hide()
mymodule:hide()
end
function show()
mymodule:show()
end
- game_mymodule
...
- game_modaldialog
- game_unjustifiedpoints
- game_mymodule
@onLoad: init()
...
I was a little bored and made some crap like this
PNG with duck + health/mana bar.
Image and bars are 'clickable' like normal game screen - player run to position with autowalk.
otclient\modules\game_mymodule\mymodule.otmod:
otclient\modules\game_mymodule\mymodule.otuiPHP:Module name: game_mymodule description: My creepy duck with hp and mana bars author: gesior website: www.skalski.pro sandboxed: true scripts: [ mymodule ] @onLoad: init() @onUnload: terminate()
otclient\modules\game_mymodule\mymodule.luaPHP:HealthBar < ProgressBar id: healthBar background-color: #ff4444 anchors.bottom: parent.bottom anchors.right: parent.right margin-bottom: 45 ManaBar < ProgressBar id: manaBar background-color: #4444ff anchors.top: prev.bottom anchors.right: parent.right margin: 1 margin-top: 5 Panel id: mymodule image-source: /images/duck image-smooth: true image-fixed-ratio: true anchors.left: parent.left anchors.bottom: parent.bottom margin-top: 1 focusable: false HealthBar ManaBar
and in otclient\modules\game_interface\interface.otmod add at end of list:PHP:-- private variables local mymodule local healthBar = nil local manaBar = nil -- public functions function init() mymodule = g_ui.loadUI('mymodule', modules.game_interface.getMapPanel()) healthBar = mymodule:recursiveGetChildById('healthBar') manaBar = mymodule:recursiveGetChildById('manaBar') connect(LocalPlayer, { onHealthChange = onHealthChange, onManaChange = onManaChange }) connect(g_game, { onGameStart = show, onGameEnd = hide }) end function terminate() disconnect(LocalPlayer, { onHealthChange = onHealthChange, onManaChange = onManaChange }) disconnect(g_game, { onGameStart = show, onGameEnd = hide }) mymodule:destroy() mymodule = nil end function onHealthChange(localPlayer, health, maxHealth) healthBar:setValue(health, 0, maxHealth) end function onManaChange(localPlayer, mana, maxMana) manaBar:setValue(mana, 0, maxMana) end function hide() mymodule:hide() end function show() mymodule:show() end
so it will look like this:PHP:- game_mymodule
PHP:... - game_modaldialog - game_unjustifiedpoints - game_mymodule @onLoad: init() ...
and then place duck.png in folder otclient/data/images/
Feeew more hours and it will look like on screenshot (nice), but I don't have time to do this.
Do not message me with offers, because I don't have time to make any script.
Any other message in console? Try to run .exe by console (cmd), it should show then better descrption of error.It sends me a error when i try to open the Client.exe: Unable to load 'game_interface' module
I fixed this, but now it won't show nothing. help meAny other message in console? Try to run .exe by console (cmd), it should show then better descrption of error.
Probably you did too many spaces/not enough spaces in interface.otmod or added new line (ENTER) by mistake.