11-10-2013, 11:08 PM
Which OnRightClicked() do you mean? There's only OnPlayerRightClickingEntity() and there's a reason for it to give a cPlayer - only players may right-click other entities. So what are you trying to accomplish here?
Random Chitchat 2012-2016
|
||||||
11-10-2013, 11:08 PM
Which OnRightClicked() do you mean? There's only OnPlayerRightClickingEntity() and there's a reason for it to give a cPlayer - only players may right-click other entities. So what are you trying to accomplish here?
11-10-2013, 11:22 PM
In Wolf.h I have
11-10-2013, 11:26 PM
You can. cPlayer IS a cEntity, so once you fix the indirections, it will work. SetOwner() is expecting a pointer, you're (probably) giving it a reference.
Thanks given by: NiLSPACE
11-10-2013, 11:28 PM
It was that simple.. Thanks
![]()
11-10-2013, 11:28 PM
Also, I think you should get rid of the default param for SetOwner(). It doesn't make sense that we even allow a call to SetOwner without the param; and if we want to remove ownership, we want to have it explicit: SetOwner(NULL)
Thanks given by: NiLSPACE
11-11-2013, 12:19 AM
I've commited my changes to an branch: https://github.com/mc-server/MCServer/tree/WolfUpdate
11-11-2013, 12:43 AM
Problem with this code is that once the owner disconnects from the server, the wolf will crash - it has a pointer to an object that's no longer there. And when the player reconnects, there's no way they can re-claim their wolves.
I think it'd be better to store the owner's name. That way it won't crash and it will survive a reconnect; a name can also be saved to the world file. Your best bet would be to check the NBT structure in vanilla to see how it does this.
11-11-2013, 12:56 AM
Now you mention it thats a big problem. I gues my idea to make other entities have wolves isn't going to work ;( Could you them maybe explain how to create an callback? So I can use it in cWorld::FindAndDoWithPlayer().
11-11-2013, 02:39 AM
I created an callback but I get spammed with the message
Quote:[17:34:41] Compared STR_Warrior and STR_Warrior with rating 11
11-11-2013, 03:22 AM
That's the string comparison function having some debugging output. Why are you using "FindAndDoWithPlayer()"? That one does similarity comparison, you want exact-matching, so DoWithPlayer() should be the right one.
What are you using the callback for anyway? Is that even needed? | ||||||
« Next Oldest | Next Newest »
|