Hammerwatch Forum
Custom mapping and Mods => Editor Discussion => Topic started by: Amran on January 31, 2014, 05:21:40 PM
-
Currently working on a custom level, and was wondering if there is a method or trick to creating a shape area which triggers a script when a player uses their attack/activate key within it.
If there's nothing built in that does this, maybe something similar can be accomplished using a collision polygon? Can these be made to detect hits, while not impeding player and projectile collision?
-
You can have a doodad being hit trigger scripts. This should be enough to get anything you need done, unless you're trying to have something activate-able in the figurative middle of nowhere, since most things you would want to activate are doodads. Alternatively, I see no reason why you couldnt make a square doodad that is completely transparent, able to be walked through, and has no shadow that would then trigger on being hit.
*Caveat: I do not know if objects that can be walked through can register hits, but I assume they can*
-
Hm, you can try making a doodad with a physics shape that the player can walk through and set a ObjectEventTrigger to Hit, and see if it works. I'm not sure if it will work, but it might.
Set collision-response to false for a collision shape, like this:
<collision collision-response="false">
<circle offset="0 -2" radius="10" />
</collision>
-
Hm, you can try making a doodad with a physics shape that the player can walk through and set a ObjectEventTrigger to Hit, and see if it works. I'm not sure if it will work, but it might.
Set collision-response to false for a collision shape, like this:
<collision collision-response="false">
<circle offset="0 -2" radius="10" />
</collision>
Ah, thanks! Using this, the ObjectEventTrigger does still register the hit, while players are able to walk through it. (Although it does stop projectiles in order to register the hit, and also can't be triggered from inside the collision area.)
In this case, I'm looking to have the players press their activate key while standing on certain floor locations to trigger scripts. Maybe I can rig this up with a combination of the above, and an AreaTrigger that activates/deactivates the invisible doodads collision when a player enters or all players exit the shape. It wouldn't be prefect, but might get a similar effect in the end.
-
[Edit] Found it! It's based on the max width field found in ShowSpeechBubble scripts.
I may as well add another question while I'm at it! When using ShowSpeechBubble scripts, is there a way to add a line break to text? I noticed that entering something and using normal_speech doesn't cause it to wrap around, and instead leaves you with a very long speech bubble.
-
Yes, there is now. With \n, like below.
Hello\nHello Again
-
\n Doesn't seem to add a new line for me... I worked around it with max bubble width and adding spaces for spacing, but it's a bit tedious...