• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

A few questions

Status
Not open for further replies.

Neccta

Exalted Member
What's the difference with "function creature.phase1" and "function creature_phase1"?

What does :RemoveEventById(event) remove? If I were to put it after PerfomIngameSpawn would it have the same effect? Take this code for example:

Code:
function Narillasanz.Phase4(event, delay, pCall, creature)
    if (creature:HealthBelowPct(55)) then
        creature:RemoveEventById(event)
        creature:SendUnitYell("Let the fire rain down from heaven!", 0)
        PerformIngameSpawn(1, 32803, 615, creature:GetInstanceId(), 3235.044, 683.5206, 90.111, 4.7906, 0, 7000, 1)
	creature:RegisterEvent(Narillasanz.Phase5, 1000, 0)
	end
end

If I were doing an event with waves of creatures how would I start the next wave after all creatures have died?
One Idea I had was to use :GetCreaturesInRange because it returns a table of creatures in the given range. Then to use :IsDead(). However I would need to use different entries for each creature. Do you have another idea to do this?
 

Tommy

Founder
1. It's a table whilst the other is just an underscore named function. Example:

Table:
Code:
local Narillasanz = { }

function Narillasanz.Reset(event, creature)
end

Non-Table:

Code:
function Narillasanz_Reset(event, creature)
end

2. Removes the current registered event. Example, if you called that inside of a ticked register event function, it will remove the event. Not sure what you mean by putting it under PerformIngameSpawn since it has nothing to do with it. It is an event function.

3. You could use ':SpawnCreature(entry, x, y, z, o[, spawnType, despawnDelay])' to summon a mob and have a table that saves the npc in it.

Example:

Code:
local spawned = test:SpawnCreature(3000, 3, 3, 3, 3)
-- Insert 'spawned' into a table
 

Rochet2

Moderator / Eluna Dev
RemoveEventById does not stop the current function call.
Just prevents further timed triggers for the timed event. (stops the timed event)

@ tommy, never do that. creatures are pointers, if deleted, you have an invalid pointer.
Unless you save a guid. Then remove it from the table on creature death.

Or make a counter.
Set counter to for example 0
Spawn 10 creatures.
The creatures have a hook on death to decrease the counter and check if it is 10.
When 10 creatures die, it will reach 10 and you can then spawn more in the if check.

Another way is to just make a search with GetNearestCreature or similar on death to check if there are any others left.
Should check that it gets only alive targets though. Otherwise you need to use another function or a small workaround.
 
Last edited:

Rochet2

Moderator / Eluna Dev
You could make them on spawn increment the counter and decrease it on death to make it nicely dynamic :)
 

Tommy

Founder
RemoveEventById does not stop the current function call.
Just prevents further timed triggers for the timed event. (stops the timed event)

I pretty much implied that in different wording.

@ tommy, never do that. creatures are pointers, if deleted, you have an invalid pointer.
Unless you save a guid. Then remove it from the table on creature death.

I never said to save the pointer, it is pretty obvious to save the guid..
 

Rochet2

Moderator / Eluna Dev
I pretty much implied that in different wording.
You did not directly say it did not stop the function call so I tried clarifying, since it seemed this was what he was asking.
And who cares if I replied again with different words?

I never said to save the pointer, it is pretty obvious to save the guid..
I never said that you said to save the pointer either.
And yes you did. You gave the example as well where you said to "insert spawned to a table".
That is exactly that.

:thoughtful:
 
Status
Not open for further replies.
Top