Ask a simple question, get a simple answer
Re: Ask a simple question, get a simple answer
Does 'setBombPower()' not work? Like, I can do it and I do a print() on the bombPower and it has changed, but the bomb still does the same damage...
- Zo Kath Ra
- Posts: 937
- Joined: Sat Apr 21, 2012 9:57 am
- Location: Germany
Re: Ask a simple question, get a simple answer
Works for me:
Shock bomb lying on the ground.
Floor trigger calls a script sets the bomb's power to another value.
Damage done to a forest ogre is about the same as the bomb power, sometimes a bit higher, sometimes a bit lower.
edit:
What happens when you stack bombs of the same type, but with different attack powers?
Re: Ask a simple question, get a simple answer
Stacks are actually a single object. When you add an item to a stack, it's destroyed and the only thing that changes about the stack is the stack size. So you can't have a stack of bombs with different attack powers.
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
What I have is the onAttack function in the bomb, and in it I got this code:
The output in game is:
But the enemies still take around 55 damage
I do the same thing with other throwing weapons and it works
Also tried the floor trigger calling a simple script too
And it still does the same damage as before
Code: Select all
print("bomb")
local bomb = self.go.bombitem
print("before: " .. bomb:getBombPower())
bomb:setBombPower(1)
print("after: " .. bomb:getBombPower())
Code: Select all
bomb
before: 55
after: 1
I do the same thing with other throwing weapons and it works
Also tried the floor trigger calling a simple script too
Code: Select all
function fire()
fire_bomb_2.bombitem:setBombPower(1)
end
Re: Ask a simple question, get a simple answer
Are you sure you are using the same bomb that you set the bomb power of? Remember, splitting a stack, including by using a ThrowAttackComponent/RangedAttackComponent, makes a new item with almost none of the attributes of the original stack. If you set the bombPower of a stack of 2 bombs to 1, but then split the stack by using the ThrowAttackComponent, the thrown bomb will have the original 55 power.
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
It seems like the game treats bombs and other thrown weapons differentlyminmay wrote: ↑Tue Apr 16, 2019 10:55 pm Are you sure you are using the same bomb that you set the bomb power of? Remember, splitting a stack, including by using a ThrowAttackComponent/RangedAttackComponent, makes a new item with almost none of the attributes of the original stack. If you set the bombPower of a stack of 2 bombs to 1, but then split the stack by using the ThrowAttackComponent, the thrown bomb will have the original 55 power.
This is in the onAttack hook:
Code: Select all
if self.go.bombitem then
print("bomb")
local bomb = self.go.bombitem
print("before: " .. bomb:getBombPower())
bomb:setBombPower(999)
print("after: " .. bomb:getBombPower())
else
print("knife")
print("before: " .. self:getAttackPower())
self:setAttackPower(999)
print("after: " .. self:getAttackPower())
end
With a stack of 1, now the bomb damage works...
Re: Ask a simple question, get a simple answer
I couldn't have dreamed of a better explaination, thanks !
_________
Here's a tricky one :
For a puzzle, player has to put 3 items in a chest. If the item is not one of the exepected item, the item is destroyed and then the player is punished (fireburst).
If all the 3 items are in the chest party will be teleported.
I did this and it works, but here the thing : once the party is teleported the screen flickers randomly. Even with an exported dungeon. I tried many things and realised my code was not the problem.
I guess the problem occurs when one teleport a party when the camera look down at a chest. If I call my code by pushing a button evrything is ok.
I tried to find a method to close a chest but didn't find one in the scripting reference.
I tried to move the party back with a setPosition but then screen flickers.
Can I close the chest by script or can I move (not teleport) the party ?
Re: Ask a simple question, get a simple answer
Ok, found something : I call the destroy() method on the chest and recreate it after the party has been teleported. It doesn't answer the question "how do we close a chest" nor "how do we physically move the party" and it is not elegant but my problem is solved : no more flickering.
Re: Ask a simple question, get a simple answer
Code: Select all
party.party:knockback(party.facing+2%3)
I could not replicate the screen flashing, and I did have the party teleport from an open chest; with no issues.
Re: Ask a simple question, get a simple answer
Are you on mac, or windows ?
I'm stuck with XP 32 bits... Nvidia Driver 331, GPU GT1200, OpenGL Version 3.3.0, Grimrock 2.2.4
When I saw the problem was within the preview window of the editor, the full screen of the editor and with an exported dungeon I thought the problem was for everyone.
Anyway thanks for the knockbak method ! Much more clean than a destroy()
I searched http://www.grimrock.net/modding/scripti ... yComponent but my poor english made me looked for a "move" method or something like that. I thought knockback was to produce a wall effect.
I also searched at http://www.grimrock.net/modding/scripti ... tComponent ...
Sorry
With all your answers, my dungeon ows you !