Page 2 of 6
Re: Way to tell if party is underwater?
Posted: Fri Nov 14, 2014 3:34 am
by sps999
GoldenShadowGS wrote:1. How do you define a new potion of water breathing?
2. how do you define the recipe to craft it?
Code: Select all
defineRecipe {
name = "potion_water_breathing_recipe",
level = 3,
ingredients = 224, -- Leechweed, Leechweed, Falconskrye
potion = "potion_water_breathing",
}
defineObject{
name = "potion_water_breathing",
baseObject = "base_item",
components = {
{
class = "Model",
model = "assets/models/items/flask.fbx",
},
{
class = "Item",
uiName = "Potion of Water Breathing",
gfxIndex = 144,
description = "A potion that gives you the ability to breathe underwater.",
weight = 0.3,
stackable = true,
},
{
class = "UsableItem",
sound = "consume_potion",
onUseItem = function(self,champion)
champion:setCondition("water_breathing", 30)
end,
}
},
}
Needed this too, just made it.
Re: Way to tell if party is underwater?
Posted: Fri Nov 14, 2014 7:14 am
by Eleven Warrior
Hi there. Curious what are theses numbers (224) for and (96325)
gesture = 96325, -- Bottom Right > Top Right > Top Middle > Middle
ingredients = 224, -- Leechweed, Leechweed, Falconskrye
Thxs
Re: Way to tell if party is underwater?
Posted: Fri Nov 14, 2014 7:18 am
by sps999
224-
Each number represents and ingredient, as a list. So in 224: the 2 represents Etherweed, the second 2 represents another Etherweed, and the 4 represents Falconskyre.
The Scripting Reference wrote:The available herbs are: 1 = Blooddrop Cap, 2 = Etherweed, 3 = Mudwort, 4 = Falconskyre, 5 = Blackmoss, 6 = Crystal Flower.
It looks like the herbs are hardcoded into the game as these six herbs. I chose 2 Etherweed and 1 Falconskyre because Etherweed gives the player energy and energy is what drains while underwater. While Falconskyre makes shock bombs (with shock being a branch of Air magic).
96325-
These numbers represent the runes on the spell casting panel. 1 is the top left, 2 is top middle, 3 is top right, 4 is middle left, etc. The spell 96325 then follows the rune panel from the bottom right -> middle right -> top right -> top middle -> middle. Each rune has a flavor meaning as listed here:
The Scripting Reference wrote:The available runes are: 1 = Fire, 2 = Life, 3 = Air, 4 = Spirituality, 5 = Balance, 6 = Physicality, 7 = Earth, 8 = Death, 9 = Water.
So when making the water breathing spell, I considered that the spell would take the Water rune, Physicality rune, Air rune, Life rune, and Balance rune because I believe all of these have to so with breathing underwater, especially considering my two choices from the starting Water rune were Physicality and Death.
Edit: For reference here is the Spell grid with the numbers. Follow the string of numbers to draw the spell:
Re: Way to tell if party is underwater?
Posted: Fri Nov 14, 2014 7:40 am
by Eleven Warrior
Hi thxs for that do you also know how to define recipies for the Motar? Is it the same as LOG 1? thxs again
EDIT: err is this the way:
defineRecipe {
name = "potion_water_breathing_recipe",
level = 3,
ingredients = 224, -- Leechweed, Leechweed, Falconskrye
---
}
If it is I feel err.....lol
EIDT 2: So with the recipe define can I use peasant_cap for a ingredient?
Re: Way to tell if party is underwater?
Posted: Fri Nov 14, 2014 8:13 am
by sps999
Currently I do not think there is a way to set the peasant_cap as an ingredient. There are however a few people working with GUI things so they might be making a custom mortar or other way to craft items, but this is outside of my scope.
Edit: And make sure any item you make from recipes is stackable. Unstackable items will crash the editor.
Re: [Solved/Item/Spell] Way to tell if party is underwater?
Posted: Fri Nov 14, 2014 1:21 pm
by Grimfan
Quick post.
Editor icon 155 is an unused potion icon in the game. It makes a nice substitute for the water flask.
Re: Way to tell if party is underwater?
Posted: Fri Nov 14, 2014 6:55 pm
by Drakkan
Prozail wrote:heres how to make a diving helmet. Just make sure you don't have two items, equippable in different slots give water breathing, cuz you'll run into trouble if someone equips both, then removes one.
Code: Select all
defineObject {
name = "diving_helmet",
baseObject = "full_helmet",
components = {
{
class="Item",
weight = 3.0,
uiName = "Diving Helmet",
gfxIndex = 93,
traits = { "helmet" },
onEquipItem=function(self,champion,slot)
if slot==3 then
champion:setCondition("water_breathing")
end
end,
onUnequipItem=function(self,champion,slot)
if slot==3 then
champion:removeCondition("water_breathing")
end
end
},
}
}
impressive. thanks, I love that water icon.
Re: [Solved/Item/Spell] Way to tell if party is underwater?
Posted: Sat Nov 15, 2014 12:18 am
by GoldenShadowGS
Couldn't you fix it with some like this:
Code: Select all
onUnequipItem=function(self,champion,slot)
if slot==3 and
for i = 1,5 -- change these to whatever slots you need to check for this other item. I have no idea
champion:getItem(i) ~= "Other_water_breathing_thing" end then
champion:removeCondition("water_breathing")
end
end
I don't even know if that syntax is valid. Can you put a for loop inside an if statement before then? I have not tried this, just making ideas.
Re: Way to tell if party is underwater?
Posted: Sat Nov 15, 2014 3:46 am
by akroma222
sps999 wrote:I've conjured up a simple spell to breath underwater based on Prozail's helmet:
Note: requirements commented out for testing.
Edit: Refined to code to include icons and expiration timer.
Code: Select all
defineSpell{
name = "water_breathing",
uiName = "Water Breathing",
skill = "water_magic",
--requirements = {"water_magic", 4, "air_magic", 3,},
gesture = 96325, -- Bottom Right > Top Right > Top Middle > Middle
manaCost = 30,
icon = 28, --7 14 28
spellIcon = 13, --13 19
description = "Gives the body the ability to breathe water.",
onCast = function(champion, x, y, direction, elevation, skillLevel)
playSound("generic_spell")
for i = 1, 4, 1 do
if party.party:getChampion(i):isAlive() then
party.party:getChampion(i):setCondition("water_breathing", skillLevel*10)
end
end
end,
}
It might not be hard to notice that spell this does not expire. I have no idea how I would make it expire based on a delay. delayedCall() seems like the go to method for lots of people but I would like to keep all the coding in the defineSpell{} and I do not know how to do sort of a delayedCall() inside the onCast hook.
Any ideas? Surely this has been done before and I am just some sort of rookie.
Edit: I had a vague idea of how this might be done with getting the game time and comparing it to the game time at the moment of casting the spell, but I don't know how I would call this code to check without a timer.
Have found a way for a party timer to control timing issues for enchantment spells like water breathing
viewtopic.php?f=22&t=7872&p=84589#p84589
Re: Way to tell if party is underwater?
Posted: Wed Dec 03, 2014 10:11 pm
by bongobeat
Prozail wrote:heres how to make a diving helmet. Just make sure you don't have two items, equippable in different slots give water breathing, cuz you'll run into trouble if someone equips both, then removes one.
Code: Select all
defineObject {
name = "diving_helmet",
baseObject = "full_helmet",
components = {
{
class="Item",
weight = 3.0,
uiName = "Diving Helmet",
gfxIndex = 93,
traits = { "helmet" },
onEquipItem=function(self,champion,slot)
if slot==3 then
champion:setCondition("water_breathing")
end
end,
onUnequipItem=function(self,champion,slot)
if slot==3 then
champion:removeCondition("water_breathing")
end
end
},
}
}
Hello,
awesome! thank you for the code!
is there any way to make this item disappear after a certain time? Or remove the water breathing effect after the time is expired.
I think of some oxygen indicator, (like the bossfight health status bar), decreasing after 1 min.
But the time can be raised by using item, like air bottle.