Low wall blockers but allow projectiles?

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!
User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

Re: Low wall blockers but allow projectiles?

Post by petri »

Obstacle component always blocks the entire square. Doors block the edge between two squares. I think you're trying to implement a "door" that is partially blocking the edge, so Obstacle component is useless in this case. Not sure if it would work, but have you tried placing a door component and lowering it, say -1.5 meters below the ground? It's not done anywhere in the main campaign so it's possible that it does not work but worth a try.
User avatar
gambit37
Posts: 218
Joined: Fri Mar 02, 2012 3:40 pm

Re: Low wall blockers but allow projectiles?

Post by gambit37 »

Nice idea :). I tried it and it does work as a party blocker which I can throw things over (about -1.75 lower on the Y axis). However, monsters still see it as "closed", so are also blocked and don't attack through it. Also my own spells are blocked and bounce back on me, so that's not viable either.

Oh well, looks like this can't be done. I'll drop this idea for now, unless anyone can come up with a solution. Thanks for your help Petri :)
User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

Re: Low wall blockers but allow projectiles?

Post by petri »

Some ideas:
- disable the door component when monster is adjacent to it
- code custom ai for certain monsters so that they attack through doors (this is what we did for slimes)

Projectile spells should work because they use the same projectile code as thrown items. Maybe you mean burst spells like fireburst? One way to workaround this is to reimpement those spells.

Totally different approach would be to not use the door component and use party onMove hook to disallow party walking through the wall (same for monsters). Or dynamically enable/disable obstacles placed around the wall depending if party/monster is adjacent to it.

Not easy, but perhaps doable.
User avatar
Isaac
Posts: 3192
Joined: Fri Mar 02, 2012 10:02 pm

Re: Low wall blockers but allow projectiles?

Post by Isaac »

petri wrote:Totally different approach would be to not use the door component and use party onMove hook to disallow party walking through the wall (same for monsters). Or dynamically enable/disable obstacles placed around the wall depending if party/monster is adjacent to it.

Not easy, but perhaps doable.
This would be my preference... Is there a way to get the party wall-bump effect? Usually when the party is blocked [manually in-user-hooks], there is no reaction at all to [attempted] movement in the blocked direction; unlike when the party bumps into a standard wall.
User avatar
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

Re: Low wall blockers but allow projectiles?

Post by FeMaiden »

Azel wrote:Hell, just put a damn invisible teleporter in front of it that only applies to Items. You can probably increase the height of the teleporter so that it is floating at the halfway mark, thus only porting items in the air above the low wall.

Sloppy approach, but I bet it would work :o
lol that's probably what I would have done. I actually have a puzzle in my mod that involves invisible teleporters that only respond to items
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: Low wall blockers but allow projectiles?

Post by Drakkan »

If I am correct, urban window from Skugg´s asset is exactly the object you want - you can see through, cannot walk, but any projectile goes trough (confirmed)
I suppose there could be also some model trick included, better to check.


defineObject{
name = "urban_town_wall_window_01",
components = {
{
class = "Model",
model = "mod_assets/sx_urban_town/models/sx_house01_wall_window_01.fbx",
},
{
class = "Door",
},
{
class = "Model",
name = "lower_stones_trim",
model = "mod_assets/sx_urban_town/models/sx_house01_wall_stonestrim.fbx",
},
},
placement = "wall",
editorIcon = 132,
minimalSaveState = true,

}
Breath from the unpromising waters.
Eye of the Atlantis
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Low wall blockers but allow projectiles?

Post by minmay »

Just a note, a DoorComponent's builtin projectile collider seems to only be as tall as the gate node. So if your gate mesh's bounding box is only one meter tall (i.e. the highest vertex is only 1 meter high, bar custom bounding boxes), projectiles can be thrown over it quite easily. This is what happens with that window object. However, this isn't a complete solution because gambit37 also wants it to be a wall that monsters can still attack through, and firebursts etc. can still be cast over.

Probably the easiest way to accomplish that is to get rid of the DoorComponent, and instead have an ObstacleComponent and FloorTriggerComponent on each side of the wall. The ObstacleComponents have blockParty = true, and block[everything else] = false. Each FloorTriggerComponent has triggeredByParty = true and triggeredBy[everything else] = false. Each FloorTriggerComponent enables/disables the ObstacleComponent on the opposite side when it is stepped onto/off of. I think that would accomplish all of the conditions gambit37 asked for, but of course it requires at least two objects and would stop you from using minimalSaveState.
Of course, this assumes that blockParty = true and block[everything else] = false really will only block the party.

Dynamically enabling/disabling the DoorComponent the same way wouldn't work because the party would still hit themselves with fireburst when the door is enabled. You could certainly use the PartyComponent.onMove approach, though (I believe you can get the bumping effect easily enough by spawning an obstacle on the square in front of the party and destroying it before the end of the frame).
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.
User avatar
gambit37
Posts: 218
Joined: Fri Mar 02, 2012 3:40 pm

Re: Low wall blockers but allow projectiles?

Post by gambit37 »

Lots of good ideas here, thanks everyone. However I decided not to bother with it in the end, it's such a small detail overall it's not worth the complexity to enable it.

@Drakkan: I tested the urban window: thrown items *don't* go through it, they are blocked and fall right in front of it.
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: Low wall blockers but allow projectiles?

Post by Drakkan »

gambit37 wrote: @Drakkan: I tested the urban window: thrown items *don't* go through it, they are blocked and fall right in front of it.
I just tried, if you throw it in upper part, majority items get trough, rest of it (like weapons) fall right in front of it.
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
gambit37
Posts: 218
Joined: Fri Mar 02, 2012 3:40 pm

Re: Low wall blockers but allow projectiles?

Post by gambit37 »

Ha, well I tested a few items and none went through, so that's enough to break the concept. It would need to work for everything, otherwise it's kinda pointless.
Post Reply