-
-
Notifications
You must be signed in to change notification settings - Fork 648
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improvement: cobras spawn and removal of invalid script
ops.. Update cobra_flask.lua Lua code format - (Stylua)
- Loading branch information
1 parent
1c4bea7
commit 833824b
Showing
6 changed files
with
32 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
data-otservbr-global/scripts/actions/other/cobra_flask.lua
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,5 +25,6 @@ Global = { | |
Storage = { | ||
FamiliarSummonEvent10 = 30054, | ||
FamiliarSummonEvent60 = 30055, | ||
CobraFlask = 30055, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
local applyCobraFlaskEffectOnMonsterSpawn = EventCallback() | ||
|
||
applyCobraFlaskEffectOnMonsterSpawn.monsterOnSpawn = function(monster, position) | ||
if table.contains({ "cobra scout", "cobra vizier", "cobra assassin" }, monster:getName():lower()) then | ||
if Game.getStorageValue(Global.Storage.CobraFlask) >= os.time() then | ||
monster:setHealth(monster:getMaxHealth() * 0.75) | ||
monster:getPosition():sendMagicEffect(CONST_ME_GREEN_RINGS) | ||
else | ||
Game.setStorageValue(Global.Storage.CobraFlask, -1) | ||
end | ||
end | ||
return true | ||
end | ||
|
||
applyCobraFlaskEffectOnMonsterSpawn:register() | ||
|
||
local cobraFlask = Action() | ||
|
||
function cobraFlask.onUse(player, item, fromPosition, target, toPosition, isHotkey) | ||
if table.contains({ 31284, 31285, 31286, 31287 }, target:getId()) then | ||
target:getPosition():sendMagicEffect(CONST_ME_GREENSMOKE) | ||
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You carefully pour just a tiny, little, finely dosed... and there goes the whole content of the bottle. Stand back!") | ||
item:transform(31297) | ||
Game.setStorageValue(Global.Storage.CobraFlask, os.time() + 30 * 60) | ||
end | ||
return true | ||
end | ||
|
||
cobraFlask:id(31296) | ||
cobraFlask:register() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters