Jump to content

Problema con Boss Nemesis


Recommended Posts

Hola a todos, tengo un pequeño problema en este resource, estuve viendo varios post sobre adaptar el boss en la gamemode DayZ, el detalle es que al morir no se crea el cuerpo para recoger el premio que tiene en el cuerpo, y no da la experiencia para el quien lo mata

espero que me puedan ayudar, se los agradeceria mucho

:D:D:D

SERVER

--local hillRadar = createRadarArea ( 93, 1800, 200, 200, 181, 0, 0, 200 ) 
  
function BossDayZ ( ) 
    nemesi = exports [ "slothBot" ]:spawnBot ( 206.19999694824, 1860.4000244141, 20.60000038147, 90, 33, 0, 0, Nemesis, 38, "hunting", true ) 
    setElementData( nemesi, "blood", 10000000 ) 
    outputChatBox ("#9E0000Nemesis Respawned!",getRootElement(), 255, 255, 255, true ) 
    outputChatBox ("#9E0000Nemesis: #9E0000 Grrr Grrr!",getRootElement(), 255, 255, 255, true ) 
    local sound = playSound3D("data/nemesis.mp3",x,y,z,false) 
end 
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), BossDayZ )    
         
         
function onPedAttack ( attacker ) 
    if ( isElement ( attacker ) == true ) then       
        if ( getElementModel ( attacker ) == 33)  then 
            setElementData ( source, getElementData(source, "blood") - 400) 
            setElementData ( ptarget, source, "blood" - 200) 
        end 
    end 
end 
addEventHandler( "onPlayerDamage", getRootElement ( ), OnPedAttack )  
  
addEvent ( "getBloodBoss", true ) 
function getBloodBoss( nemesi ) 
    if ( isElement ( nemesi ) ) then 
        killPed ( nemesi ) 
        destroyElement ( nemesi ) 
    end 
end 
addEventHandler ( "getBloodBoss", getRootElement(), getBloodBoss ) 
        
function destroyDeadBoss (boss,bossCol) 
    destroyElement(boss) 
    destroyElement(bossCol) 
end 
  
function killBoss(killer,headshot) --Aqui inicia el problema 
    if killer then 
    setElementData(killer,"experience",getElementData(killer,"experience")+15000) 
    end     
    local skin = getElementModel(source) 
    local x,y,z = getElementPosition(source) 
    local boss = createPed(skin,x,y,z) 
    local bossCol = createColSphere(x,y,z,1.5) 
    killPed(boss) 
    setTimer(destroyDeadBoss,360000 ,1,bossCol,boss) 
    attachElements (bossCol,boss,0,0,0) 
    setElementData(bossCol,"parent",boss) 
    setElementData(bossCol,"playername","Nemesis") 
    setElementData(bossCol,"deadman",true) 
    setElementData(boss,"deadzombie",true) 
    setElementData(bossCol,"deadman",true) 
    setElementData(bossCol,"MAX_Slots",12) 
    setElementData(bossCol,"Medic Kit", 10) 
    setElementData(bossCol,"Antibiotics", 10) 
    setElementData(bossCol,"Blood Bag", 10) 
    setElementData(bossCol,"Transfusion Kit", 10) 
    local hours,minutes = getTime() 
    local loot_table = "" 
    setElementData(bossCol,"deadreason","Someone murderer, but how?. Estimated time of death: "..hours..":"..minutes) 
    for i, id in ipairs(ZombieLoot) do 
        if skin == id[1] then 
            loot_table = tostring(id[2]) 
        end 
    end 
    for i, item in ipairs(zombieLootType[loot_table]) do 
        local value = math.percentChance(item[2],math.random(0,1)) 
        setElementData(bossCol,item[1],value) 
        local ammoData,weapID = getWeaponAmmoFromName (item[1],true) 
        if ammoData and value > 0 then 
            setElementData(bossCol,ammoData,math.random(0,1)) 
        end 
    end 
end 
addEvent("onBotWasted",true) 
addEventHandler("onBotWasted",root,killBoss) 
  
  
function RespawnBoss() 
    setTimer(BossDayZ,360000 ,1) 
end 
addEvent("onBotWasted",true) 
addEventHandler("onBotWasted",getRootElement,RespawnBoss) 

CLIENTE

function Skinemesis1() 
  txd = engineLoadTXD("data/107.txd", 2 ) 
  engineImportTXD(txd, 2) 
  dff = engineLoadDFF("data/107.dff", 2 ) 
  engineReplaceModel(dff, 2) 
end 
addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), Skinemesis1) 
  
function getBloodBoss ( attacker, weapon, bodypart ) 
    if ( isElement ( attacker ) ) then       
        if ( getElementModel ( source == 33 ) ) then         
            setElementData ( source, getElementData(source, "blood") - 600) 
            if ( getElementData( source, "blood") < 1 ) then     
                triggerServerEvent ( "getBloodBoss", root ) 
            end 
        end 
    end 
end 
addEventHandler ( "onClientPedDamage", root, getBloodBoss ) 

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...