Ask a simple question, get a simple answer
Re: Ask a simple question, get a simple answer
could I ask somebody to write script which will do following --
I have table called food_table
when I place object coin_gold (its stackable item) on the table, it destroy one coin and spawn gold_food object on the table. In case more gold_coins inserted it should return back the remaining money. And also - this process could be done only once (means only one gold_food could be bought).
Thanks for any help
I have table called food_table
when I place object coin_gold (its stackable item) on the table, it destroy one coin and spawn gold_food object on the table. In case more gold_coins inserted it should return back the remaining money. And also - this process could be done only once (means only one gold_food could be bought).
Thanks for any help
Re: Ask a simple question, get a simple answer
Try this one.AndakRainor wrote:The offset of the clickable component is the same, but not its size. I will try different sizes tonight and see if I get a better result.
Code: Select all
defineObject{
name = "dungeon_click_secret_door",
baseObject = "base_secret_door",
components = {
{
class = "Model",
model = "assets/models/env/dungeon_secret_door.fbx",
staticShadow = true,
},
{
class = "Door",
openVelocity = 0.5,
closeVelocity = -0.5,
secretDoor = true,
openSound = "wall_sliding",
closeSound = "wall_sliding",
lockSound = "wall_sliding_lock",
onOpen = function(self)
self.go.clickable:setOffset(vec(0,2.8,0))
end,
onClose = function(self)
self.go.clickable:setOffset(vec(0,1.5,0))
end,
},
{
class = "Clickable",
offset = vec(0, 1.5, 0),
size = vec(1.2, 0.8, 0.2),
frontFacing = true,
--debugDraw = true,
onClick = function(self, ...) if getMouseItem() and self.go.door:isOpen() then
return false
else self.go.door:toggle()
end
end,
},
},
}
Re: Ask a simple question, get a simple answer
You should be able to do this yourself, but here. Connect the surface's onInsertItem action to this function.Drakkan wrote:could I ask somebody to write script which will do following --
I have table called food_table
when I place object coin_gold (its stackable item) on the table, it destroy one coin and spawn gold_food object on the table. In case more gold_coins inserted it should return back the remaining money. And also - this process could be done only once (means only one gold_food could be bought).
Thanks for any help
Code: Select all
done = false
function itemInserted(surface)
if not done then
for _,i in surface:contents() do
if i.go.name == "coin_gold" then
if i:getStackSize() == 1 then
i.go:destroy()
else
i:setStackSize(i:getStackSize()-1)
end
done = true
surface:addItem(spawn("gold_food").item)
break
end
end
end
end
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: Ask a simple question, get a simple answer
How can i change monster attack and defence parameters?
Re: Ask a simple question, get a simple answer
Do you mean control how they act during a fight?
Or do you mean alter things like damage and protection?
Or do you mean alter things like damage and protection?
Re: Ask a simple question, get a simple answer
2.Isaac wrote:Do you mean control how they act during a fight?
Or do you mean alter things like damage and protection?
And why map of my dungeon is blank?
Re: Ask a simple question, get a simple answer
In the mod_assets folder you can find a file called items.lua. You can add there a definition for a weapon.
It has to look like that:
How to change behaviour should be obvious, I think.
What do you mean by "my map is blank"?
It has to look like that:
Code: Select all
defineObject{
name = "machete",
baseObject = "base_item",
components = {
{
class = "Model",
model = "assets/models/items/machete.fbx",
},
{
class = "Item",
uiName = "Machete",
gfxIndex = 23,
impactSound = "impact_blade",
weight = 2.2,
traits = { "light_weapon", "sword" },
},
{
class = "MeleeAttack",
attackPower = 12,
accuracy = 0,
cooldown = 4.5,
swipe = "horizontal",
},
},
tags = { "weapon" },
}
What do you mean by "my map is blank"?
Re: Ask a simple question, get a simple answer
First, click the arrow in the circle on the automap. Is it still blank after that?RedNova wrote:why map of my dungeon is blank?
______
To change monster parameters, one usually defines the monster in monsters.lua, with the desired changes.
*However it is also possible to change those parameters during the game via script. The components to affect these parameters are the
monster and monsterAttack.
For instance, if the monster id is my_ogre_1, then to make my_ogre_1 hit really hard, and be very evasive, include this in a script:
Code: Select all
my_ogre_1.monster:setEvasion(45)
my_ogre_1.basicAttack:setAttackPower(150)
my_ogre_1.turnAttack:setAttackPower(150)
my_ogre_1.charge:setAttackPower(150)
Re: Ask a simple question, get a simple answer
Oh - sh***!
I havn't read carefully what you have asked, RedNova.
For sure, Isaac is right. He explained how to create a new monster / change behaviour of existing ones.
I did the same - but for Items like weappons...
I havn't read carefully what you have asked, RedNova.
For sure, Isaac is right. He explained how to create a new monster / change behaviour of existing ones.
I did the same - but for Items like weappons...