View previous topic :: View next topic |
Author |
Message |
Zunath
Joined: 06 Jul 2006 Posts: 183
|
Posted: Thu Jan 13, 2011 19:21 Post subject: Creature OnBlocked Hook |
|
|
Was wondering if there was a way to fire code whenever a creature is blocked by a placeable? The OnBlocked event apparently only fires when the creatures are blocked by doors.
As it is right now, our creatures get stuck on placeables and will just stand there while players attack with ranged/magic.
Thanks for any help. |
|
Back to top |
|
|
Ravine
Joined: 26 Jul 2006 Posts: 105
|
Posted: Thu Jan 13, 2011 20:08 Post subject: |
|
|
According to the Lexicon, onBlocked fires for doors and creatures. Jasperre's AI handles them, however the onBlocked event caused some TMI's on my side. ActionMoveToLocation is ruined when a creature is blocked
Just for curiosity, are you using the default AI? |
|
Back to top |
|
|
Zunath
Joined: 06 Jul 2006 Posts: 183
|
Posted: Thu Jan 13, 2011 20:39 Post subject: |
|
|
Ok, my understanding when I read the lexicon was that the OnBlocked event fired when a creature was blocked by a door or another creature. If that's not the case, then I guess that solves my problem.
We're using the default AI with some minor changes. (It's a zombie survival server so the zombies are a little more stupid than normal creatures )
I was looking at Jasperre's AI but I heard about the TMI errors. Someone claimed to have fixed them but I didn't want to run the risk of hitting lag from TMI. |
|
Back to top |
|
|
Ravine
Joined: 26 Jul 2006 Posts: 105
|
Posted: Thu Jan 13, 2011 21:17 Post subject: |
|
|
Err...yeah, i said that the onBlocked event fires only for:
- creature blocked by door
- creature blocked by creature
However, as i a remember, the creatures with default AI didn't stopped by placeables. As i remember, pathfinding didn't get break when
ActionMoveToObject used.
ps: my english is a bit poor. |
|
Back to top |
|
|
Ravine
Joined: 26 Jul 2006 Posts: 105
|
Posted: Thu Jan 13, 2011 23:10 Post subject: |
|
|
Hmm this is from the onDamaged code:
Code: |
if(!GetObjectSeen(oDamager)
&& GetArea(OBJECT_SELF) == GetArea(oDamager)) {
// We don't see our attacker, go find them
ActionMoveToLocation(GetLocation(oDamager), TRUE);
ActionDoCommand(DetermineCombatRound());
} else {
DetermineCombatRound();
}
|
So, if a creature is attacked by ranged, and the attacker is out of seen-range, the creature tries to move to the attacker's current location. That move can be broken by placeables, however the next damage should make him move out. If not, that's a pathfinding bug, and you can't do much with the 'placeable-blocked' event. |
|
Back to top |
|
|
Zunath
Joined: 06 Jul 2006 Posts: 183
|
Posted: Thu Jan 13, 2011 23:46 Post subject: |
|
|
Well the idea was that if the zombie was blocked by a placeable, they would eventually start bashing it. After a certain amount of time the placeable is destroyed and (in theory) the creature would be able to get past the place they're stuck.
Without going into great detail, our server's placeables are built by our players. So it's not a problem if the zombies break the placeables.
I was just looking for a hook so I could accomplish this. It's unfortunate there's no solution though.
Thanks anyhow! |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Fri Jan 14, 2011 11:49 Post subject: |
|
|
unsure - but I think there might be an internal 'bumped' event that fires when Creatures etc collide.
I am just going from memory etc, but potentially, this function, if hooked could determine the 2 objects that bumped into eachother.
This being said, I might be wrong. |
|
Back to top |
|
|
|