Throwing

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
User avatar
ahn
Posts: 6
Joined: Thu May 03, 2012 10:07 pm

Throwing

Post by ahn »

Trying to implement some puzzles where you throw stuff around. Encountering a couple of issues...

1) Is there an onThrow hook?
From the scripting reference I couldn't find a hook that's triggered when the player throws an item. Is there such hook? Or is there some other nice way to get called when an item is thrown. I'd like to for example get the position where the throwing occurred.

2) Throws are random?
One thing I noticed with some (long) throws is that the objects don't always end up in the same place for the same throw. In the screenshots below I throw blue gems to a hole that's 7 tiles forward and 2 tiles down, some gems go in and some hit the top of the hole and fall to the ground, apparently randomly. Wonder if it's a bug or intentional behavior...

Image
Image

Does anybody know anything that could help?
MrChoke
Posts: 324
Joined: Sat Oct 25, 2014 7:20 pm

Re: Throwing

Post by MrChoke »

Take a look at the ThrowAttackComponent. I haven't used this yet but maybe "onPostAttack()" is like onThrow()
User avatar
sps999
Posts: 44
Joined: Sun Oct 26, 2014 11:16 pm

Re: Throwing

Post by sps999 »

There might be a slight difference in throwing length based on where on the screen you click. I recommend you try some tests where you throw all the gems from the middle of the screen, then all the gems from the top of the screen. I'm not sure if it works like this but it is worth testing out.
User avatar
ahn
Posts: 6
Joined: Thu May 03, 2012 10:07 pm

Re: Throwing

Post by ahn »

sps999 wrote:There might be a slight difference in throwing length based on where on the screen you click. I recommend you try some tests where you throw all the gems from the middle of the screen, then all the gems from the top of the screen. I'm not sure if it works like this but it is worth testing out.
That's what I suspected too, but based on little testing the clicking position doesn't seem to affect the throw.
Post Reply