logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Creature OnBlocked Hook

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows development
View previous topic :: View next topic  
Author Message
Zunath



Joined: 06 Jul 2006
Posts: 183

PostPosted: Thu Jan 13, 2011 19:21    Post subject: Creature OnBlocked Hook Reply with quote

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
View user's profile Send private message
Ravine



Joined: 26 Jul 2006
Posts: 105

PostPosted: Thu Jan 13, 2011 20:08    Post subject: Reply with quote

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 Sad
Just for curiosity, are you using the default AI?
Back to top
View user's profile Send private message
Zunath



Joined: 06 Jul 2006
Posts: 183

PostPosted: Thu Jan 13, 2011 20:39    Post subject: Reply with quote

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. Smile

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 Very Happy)

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
View user's profile Send private message
Ravine



Joined: 26 Jul 2006
Posts: 105

PostPosted: Thu Jan 13, 2011 21:17    Post subject: Reply with quote

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
View user's profile Send private message
Ravine



Joined: 26 Jul 2006
Posts: 105

PostPosted: Thu Jan 13, 2011 23:10    Post subject: Reply with quote

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
View user's profile Send private message
Zunath



Joined: 06 Jul 2006
Posts: 183

PostPosted: Thu Jan 13, 2011 23:46    Post subject: Reply with quote

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
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Fri Jan 14, 2011 11:49    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows development All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group