PDA

View Full Version : Projectiles should ignore fences


DustyPorViva
12-11-2009, 11:05 PM
Projectiles that are shot like classic arrows(flat and horizontal) should also ignore fences like default arrows.

cbk1994
12-12-2009, 02:02 AM
It's possible to script by designating a certain tile type as a wall using a custom movement system (since then projectiles will still think it's not a wall), though I guess that's not a lot of help.

Crow
12-12-2009, 11:14 AM
It's possible to script by designating a certain tile type as a wall using a custom movement system (since then projectiles will still think it's not a wall)

:p

Tigairius
12-12-2009, 12:04 PM
This is a crazy work-around, and I'm not sure if there is a better way, but you could probably do something like this:
//#CLIENTSIDE
function onCreated() {
onTimeout();
}

function onTimeout() {
for (temp.p: projectiles) {
if (tiles[temp.p.x + vecx(temp.p.params[0]),
temp.p.y + vecy(temp.p.params[0])] == 3271) {
tiles[temp.p.x + vecx(temp.p.params[0]),
temp.p.y + vecy(temp.p.params[0])] = 0;
updateboard(temp.p.x, temp.p.y, 2, 2);
}

if (tiles[temp.p.x + vecx((temp.p.params[0] + 2) [PERCENT] 4),
temp.p.y + vecy((temp.p.params[0] + 2) [PERCENT] 4)] == 0) {
tiles[temp.p.x + vecx((temp.p.params[0] + 2) [PERCENT] 4),
temp.p.y + vecy((temp.p.params[0] + 2) [PERCENT] 4)] = 3271;
updateboard(temp.p.x, temp.p.y, 2, 2);
}
}
setTimer(0.05);
}

But it's probably pretty intensive, could probably be optimized.
All that's doing is finding projectiles in the level and if they are about to hit tile "3271", replace it with tile "0", and then if they just passed tile "0" replace it with "3271".

If you wanted to use this technique, of course, you'd have to apply a small flag to the projectile somehow or something to make sure you're not replacing a correctly placed tile 0 with 3271 on accident.

Note: 3271 is just a random tile. This also requires that your shootparams[0] are set to the direction the player was facing when he fired the projectile.

12171217
12-15-2009, 07:34 PM
Why don't you move the projectile up a bit on the Z axis instead of removing the fence? :0

Assuming, of course, that you can move projectiles clientside, which I see no reason why not, considering they are entirely clientside.

Crow
12-15-2009, 07:54 PM
Why don't you move the projectile up a bit on the Z axis instead of removing the fence? :0

Assuming, of course, that you can move projectiles clientside, which I see no reason why not, considering they are entirely clientside.

Because then they wouldn't crash into any other walls. I suggest doing what Chris said until there's another solution. I did it on Era with tiletypes 9 and 10 if I recall correctly. Some lava stuff. More than enough tiles for the shoot-through-tables-idea I had. I can deliver some functions to assist you if you wish.

12171217
12-16-2009, 12:32 AM
I meant move the projectiles up on the Z axis in a timeout loop when they're about to hit a wall tile-type that's excluded, then move it back down when it passes.

Alternatively, one could start the projectile with a Z value, then snap it to the floor when it hits a wall, unless that wall tile-type is excluded.

This is all assuming that you can even interact with projectiles after they're spawned. Otherwise, you could write your own projectile handler.

DustyPorViva
12-16-2009, 12:38 AM
I don't think you can really edit projectile vars.