Jump to content

[HELP] Adding GameObjects with CreatureAI


Guest blukkie

Recommended Posts

Is there any way you can add GameObjects with a CreatureAI Script?

I couldn't find any function that allows me to do this, so I tried this, but it's illegal.

float x = target->GetPositionX();
float y = target->GetPositionY();
float z = target->GetPositionZ();
Map* m = target->GetMap();

GameObject* pFire = new GameObject;
if (pFire->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), 177704, m, x, y, z, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 20000, GO_STATE_READY))
{
   target->AddGameObject(pFire);
   m->Add(pFire);
}

Thanks in advance.

Link to comment
Share on other sites

There isn't. (except you have a spell spawning the GO)

You can always try do spawn GOs in DB in despawned state (negative Spawntimer), then you can respawn them via scripts

Yes. There is only two ways to spawn GOs:

1. Use spells with effect Spawn Object or Spawn Wild Object

2. Have GO start in despawned state and respawn it in script

This is done to prevent hacks from being used instead of how it should be done.

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use