Hi, please somebody help me… i need item script which can add creature into Database with using item. Only what i found is Summon Creature.
Example this GOB script
void SpawnObject(Player * player, uint32 objectId)
{
const GameObjectTemplate* objectInfo = sObjectMgr->GetGameObjectTemplate(objectId);
float x = float(player->GetPositionX());
float y = float(player->GetPositionY());
float z = float(player->GetPositionZ());
float o = float(player->GetOrientation());
Map* map = player->GetMap();
GameObject* object = new GameObject;
uint32 guidLow = sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT);
if (!object->Create(guidLow, objectInfo->entry, map, player->GetPhaseMaskForSpawn(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY))
{
delete object;
return;
}
object->SetRespawnTime(1);
object->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), player->GetPhaseMaskForSpawn());
if (!object->LoadGameObjectFromDB(guidLow, map))
{
delete object;
return;
}
sObjectMgr->AddGameobjectToGrid(guidLow, sObjectMgr->GetGOData(guidLow));
WorldDatabase.PExecute("INSERT INTO guildhouse_objects VALUES('%u', '%u')", player->GetGuildId(), guidLow);
}
uint32 getGuildAreaId(Player * player)
{
QueryResult Result = WorldDatabase.PQuery(“SELECT area FROM guildhouses WHERE guildId=‘%u’”, player->GetGuildId());
if (Result)
{
Field * pField = Result->Fetch();
return pField[0].GetUInt32();
}
return -1;
}
but i need it for npcs.
Thank for help and sorry for my bad English /emoticons/default_smile.png