Hello my fellow builders, I've got a question today that might be really obvious, or might be impossible to do in the toolset... the only thing that's certain is, I have no idea how to do it.
I have a series of battles in my module in which the player fights creatures until they're low on health, and then the creatures flee the battlefield. The player can roam the whole area freely during the battle, so to avoid the possibility that a player would see the fleeing creatures suddenly dissapear into thin air, I don't want to delete them as objects until they've run through a gate and around the corner of a wall, out of sight. My question is, is there any way to make the gate walkable for the fleeing creatures but not for the player? I can't do it with a cutscene, because the player could still be fighting some of the creatures while others are running away...
Is the most elegant solution to create a trigger that teleports the player back (seems messy...)
or maybe one that activates a placeable when they're near the gate, blocking anyone from moving through? That could screw up the fleeing
creature's pathing too, though.
It's possible this should end up in the scripting forum, but as I said, I don't even know where to start at this point.
Thanks for reading,
Alex
Making a gate/small area walkable by npcs but not by the player
Débuté par
Talisander
, août 04 2010 12:12
#1
Posté 04 août 2010 - 12:12
#2
Posté 04 août 2010 - 01:41
That's a good question.
Whether something has collision or not is determined by the pathfinding points in the level, and I don't think its possible to have a different set of pathfinding for the player and for the NPCs.
Whether something has collision or not is determined by the pathfinding points in the level, and I don't think its possible to have a different set of pathfinding for the player and for the NPCs.
#3
Posté 04 août 2010 - 02:04
you can bypass walkmesh through cutscenes and scripting. just disable snap to walkmesh on the NPCs and go from there.
SetPhysicsController()
SetPhysicsController()
#4
Posté 04 août 2010 - 09:34
This is done when defending the city gates in the main campaign, and also when fighting zombies in Redcliffe at night; I chased the former for a while but couldn't figure it out, maybe you'll have better luck looking into it though.
#5
Posté 04 août 2010 - 10:27
If you would allow a non-modder to suggest something, have you considered a non-cutscene teleportation of the enemies?
Is one of the creatures a spellcaster? If the answer is yes, make him/her/it work a teleportation spell. Check out this mod for inspiration: http://www.dragonage...ile.php?id=1369
I admit, however, that the enemies fleeing on foot to where the player can't follow does sound better than a "magical" solution.
Anyway, good luck with that. Hope you come up with a solution you are satisfied with.
Is one of the creatures a spellcaster? If the answer is yes, make him/her/it work a teleportation spell. Check out this mod for inspiration: http://www.dragonage...ile.php?id=1369
I admit, however, that the enemies fleeing on foot to where the player can't follow does sound better than a "magical" solution.
Anyway, good luck with that. Hope you come up with a solution you are satisfied with.
#6
Posté 04 août 2010 - 10:50
CID-78 wrote...
you can bypass walkmesh through cutscenes and scripting. just disable snap to walkmesh on the NPCs and go from there.
SetPhysicsController()
Wouldn't that create sort of weird results if they lose collision entirely (outside of cinematics)? Maybe if the terrain is completely flat they wouldn't clip through it...
Modifié par Kilrogg_, 04 août 2010 - 10:50 .
#7
Posté 05 août 2010 - 05:56
Unfortunately, the magic suggestion won't work in the context of the story... But thanks for the creative thought -- I may use that later on 
Actually, the physics could work for my purposes! The ground is flat enough there. The question is... can I get it to work? I'll post my solution once I've played with the SetPhysicsController() function. Thanks, guys!
Alex
Actually, the physics could work for my purposes! The ground is flat enough there. The question is... can I get it to work? I'll post my solution once I've played with the SetPhysicsController() function. Thanks, guys!
Alex
#8
Posté 05 août 2010 - 08:49
Are we sure that SetPhysicsController disables snap to walkmesh? I've been testing it on a creature and trying to send it running through various things with UT_QuickMoveObject(), and it doesn't seem to do so... it acts just as if the creature were obeying all normal collision as far as I can tell.
Unless snap to walkmesh is a different property I have to change in addition to disabling physics?
Unless snap to walkmesh is a different property I have to change in addition to disabling physics?
Modifié par Talisander, 05 août 2010 - 09:01 .
#9
Posté 05 août 2010 - 11:30
I don't know anything about PhysicsController, but you can try using SetLocalInt to set the creature's PHYSICS_DISABLED variable to 1. This lets you put npcs in mid air and such. Not sure how it'll handle this sort of situation.
#10
Posté 05 août 2010 - 03:50
well you only need to move them past a small barrier without walkmesh and then snap them back.
#11
Posté 05 août 2010 - 09:50
CID, by "without walkmesh" do you mean move them outside of the walkable part of the exportable area altogether? Or do you mean have them jump (CommandJumpToLocation) a tiny amount past a barrier, like an invisible wall placeable, and then continue to move? I'm not quite understanding what you say (I'm not much of a scripter).
I've tried both SetPhysicsController(oCreature, FALSE) and just setting the PHYSICS_DISABLED variable to 1, and the creature still won't move through unwalkable parts of the walkmesh -- I've tried both collision baked in by the level editor and non-interactive placeables. They just walk up to like they're trying to get through and then stop.
I'll post exactly what I'm doing so you guys can get an idea.
I have to boot up another OS to get to my scripts -- give me a moment.
I've tried both SetPhysicsController(oCreature, FALSE) and just setting the PHYSICS_DISABLED variable to 1, and the creature still won't move through unwalkable parts of the walkmesh -- I've tried both collision baked in by the level editor and non-interactive placeables. They just walk up to like they're trying to get through and then stop.
I'll post exactly what I'm doing so you guys can get an idea.
I have to boot up another OS to get to my scripts -- give me a moment.
Modifié par Talisander, 05 août 2010 - 09:53 .
#12
Posté 06 août 2010 - 03:22
Ok, sorry it took me so long... got distracted by life.
Here's what I'm doing.
I've got the creature running away to a waypoint which is right next to a gate which is blocked by a red part of the walkmesh. Around that waypoint is a trigger, which has the following case in its trigger event script:
case EVENT_TYPE_ENTER:
{
object oCreature = GetEventCreator(ev);
if (GetGroupId(oCreature) == GROUP_NEUTRAL)
{
SetPhysicsController(oCreature, FALSE);
UT_QuickMoveObject(oCreature, "wp_npcexitgate", TRUE, FALSE, TRUE, FALSE);
}
break;
}
So basically, that trigger turns physics off on any neutral npc who moves into the trigger, and then sends them running to a waypoint through the gate, through the unwalkable part of the gateway which keeps the player in.
So far, I haven't been able to get turning physics off to change the creature's behavior in the situation at all. Now, I hope it's not too obvious, but what am I doing wrong?
Thanks,
Alex
Here's what I'm doing.
I've got the creature running away to a waypoint which is right next to a gate which is blocked by a red part of the walkmesh. Around that waypoint is a trigger, which has the following case in its trigger event script:
case EVENT_TYPE_ENTER:
{
object oCreature = GetEventCreator(ev);
if (GetGroupId(oCreature) == GROUP_NEUTRAL)
{
SetPhysicsController(oCreature, FALSE);
UT_QuickMoveObject(oCreature, "wp_npcexitgate", TRUE, FALSE, TRUE, FALSE);
}
break;
}
So basically, that trigger turns physics off on any neutral npc who moves into the trigger, and then sends them running to a waypoint through the gate, through the unwalkable part of the gateway which keeps the player in.
So far, I haven't been able to get turning physics off to change the creature's behavior in the situation at all. Now, I hope it's not too obvious, but what am I doing wrong?
Thanks,
Alex
Modifié par Talisander, 06 août 2010 - 03:23 .
#13
Posté 06 août 2010 - 08:14
Maybe you don't need to worry about the physics if you just jump the NPC a very short distance from the trigger, beyond an invisible collision wall in the level? I believe SetLocation will do that.
I suspect you need to generate a walkmesh on the other side of the collision wall, which you can do by placing a second walkmesh start point there in the level editor.
I suspect you need to generate a walkmesh on the other side of the collision wall, which you can do by placing a second walkmesh start point there in the level editor.
Modifié par Proleric1, 06 août 2010 - 08:16 .
#14
Posté 06 août 2010 - 08:42
wow, I didn't even know I could do that in the level editor -- that's awesome.
I've been using an invisible area transition placeable to block the gateway off. If I don't want it to be a transition, I set it to non-interactive. Which gets around the no walkmesh on the other side problem. But I may be able to get an even thinner barrier by using two start points in the level editor.
I wish there were a way to do it without teleportation, though. I've been thinking about making a placeable inactive for a moment while the creature runs through, but that would be too error prone, I think.
I've been using an invisible area transition placeable to block the gateway off. If I don't want it to be a transition, I set it to non-interactive. Which gets around the no walkmesh on the other side problem. But I may be able to get an even thinner barrier by using two start points in the level editor.
I wish there were a way to do it without teleportation, though. I've been thinking about making a placeable inactive for a moment while the creature runs through, but that would be too error prone, I think.
Modifié par Talisander, 06 août 2010 - 09:18 .





Retour en haut






