I have another question related to the map owner thing.
I'm trying to make some functionality to my house system. You make a private house location where you can cook or craft. You can, ofcourse, bring others adding them to the terminal. The thing is, I made some sad and basic "dismantling system" too.
Basically you can delete the location triggering the function by dialog. That's easy. Problem comes when anybody else can delete it too. Not only yourself. Pretty troll. And I wanted to demand being the owner of the map.
I wrote it but it didn't work. There is something I'm missing and I need to understand.
Here is the code:
void r_DeleteLoc(Critter& player, Critter@ npc)
{
Map@ map = player.GetMap();
if(!valid(map))
{
player.Say(SAY_NETMSG, "Invalid map.");
return;
}
Location@ location = map.GetLocation();
if(!valid(location))
{
player.Say(SAY_NETMSG, "Invalid location.");
return;
}
uint ownerId = GetRootMapData(map.GetLocation(), MAP_DATA_OWNER);
if(ownerId == 0)
{
player.SayMsg(SAY_NETMSG, TEXTMSG_TEXT, STR_BASE_NOTOWNER);
}
else
{
DeleteLocation(location.Id);
player.AddItem(PID_BASE1KIT, 1);
player.SayMsg(SAY_NETMSG, TEXTMSG_TEXT, STR_BASE_DISMANTLED);
return;
}
#endif
}
STR_BASE_NOTOWNER and STR_BASE_DISMANTLED are the text lines triggered when you try to delete the base.
The result of this, is I can delete the location wether I am or not the owner.