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

Boss teleport random player

Status
Not open for further replies.

Lightning Blade

BETA Tester
How would i make a boss target a random player and teleport the player to my desired location :s ?


Would there be any way to active a object after a x amount of time, after the player have been teleported ?.

btw 1 last thing, he says " You are kidding... Maybe! " in phase 2 but he doesn't execute any of the spells. http://pastebin.com/mQ3mF1mm
 
Last edited:

Tommy

Founder
How would i make a boss target a random player and teleport the player to my desired location :s ?


Would there be any way to active a object after a x amount of time, after the player have been teleported ?.

Well, you should use: http://wiki.emudevs.com/doku.php?id=eluna_unit_class_getaitarget

To get a random target, Id is 0. How do you want the boss to target? Randomly every X seconds or OnEnterCombat? Meh, I'll just make something.

Teleporting random player:

Code:
function OnEnterCombat(event, creature, target)
    creature:RegisterEvent(TeleportPlayer, 10000, 0)
end

function TeleportPlayer(event, delay, pCall, creature)
    local target = creature:GetAITarget(0, true)
    target:Teleport(0, 3000, 3000, 3000, 1) -- MapId, X, Y, Z, O
    creature:RemoveEventById(event)
end

RegisterCreatureEvent(30000, 1, OnEnterCombat)

I don't get what you want to activate. Is it near the creature or the player? And do you mean GameObject or WorldObject (creature, gameobject, etc)?
 

Tommy

Founder
Would there be any way to active a object after a x amount of time, after the player have been teleported ?.

btw 1 last thing, he says " You are kidding... Maybe! " in phase 2 but he doesn't execute any of the spells. http://pastebin.com/mQ3mF1mm

It might be because you're removing his events in "function OnCheckHealth1(event, delay, pCall, creature)". What I added is in lime and I removed "creature:RemoveEvents()" on top:

Code:
function OnCheckHealth1(event, delay, pCall, creature)
        local target = creature:GetAITarget(3, true)
    if (creature:GetHealthPct() <= 25) then
        [COLOR="#00FF00"]creature:RemoveEventsById(event)[/COLOR]
        creature:CastSpell(target, 40000)
    end
end


waow Thanks,. Gameobject.

Is it near the creature though? If so, then it would be quite easy to activate a gameobject. However, if it is near the player, it would be somewhat of a process to go though unless you activated it as soon as you ported the player.

Code:
function OnEnterCombat(event, creature, target)
    creature:RegisterEvent(TeleportPlayerActivateObject, 10000, 0)
end

function TeleportPlayerActivateObject(event, delay, pCall, creature)
    creature:RemoveEventById(event)
    local target = creature:GetAITarget(0, true)
    if (target ~= nil) then
        target:Teleport(0, 3000, 3000, 3000, 1) -- MapId, X, Y, Z, O
        local go = target:GetNearestGameObject(10000, 15) -- GameObject Entry, Radius
        if (go ~= nil) then
            go:SetGoState(0)
        end
    end
end

RegisterCreatureEvent(30000, 1, OnEnterCombat)

Anyway, that's the way it is done, if it is near the player.
 

Tommy

Founder
To make the gameobject change it's state back, you could just make the gameobject register an event:

Code:
function OnEnterCombat(event, creature, target)
    creature:RegisterEvent(TeleportPlayerActivateObject, 10000, 0)
end

function TeleportPlayerActivateObject(event, delay, pCall, creature)
    creature:RemoveEventById(event)
    local target = creature:GetAITarget(0, true)
    if (target ~= nil) then
        target:Teleport(0, 3000, 3000, 3000, 1) -- MapId, X, Y, Z, O
        local go = target:GetNearestGameObject(10000, 15) -- GameObject Entry, Radius
        if (go ~= nil) then
            go:SetGoState(0)
            [COLOR="#00FF00"]go:RegisterEvent(OnChangeState, 5000, 1) -- Only calls once[/COLOR]
        end
    end
end

[COLOR="#00FF00"]function OnChangeState(event, delay, pCall, gameobject)
    gameobject:SetGoState(1)
end[/COLOR]

RegisterCreatureEvent(30000, 1, OnEnterCombat)
 
Status
Not open for further replies.
Top