NodZen Posted September 20, 2012 Posted September 20, 2012 Amigo , hace 1 semana mas o menos hice un slothBot con extra health y todo bien. Pero ahora quise hace que si el elemento NO este , entonces se spawnee el BOT. Miren function silent ( ) if ( not isElement ( piramide ) ) then piramide = exports [ "slothBot" ]:spawnBot ( -2787.1000976563, -1516.1999511719, 139, 90, math.random ( 200, 203 ), 0, 0, piramid, 8, "hunting", true ) exports [ "extra_health" ]:setElementExtraHealth ( piramide, 2500 ) setElementModel ( piramide, 13) setTimer ( piramide , 3000, 0 ) outputChatBox ("Piramid Head Se ah Generado") local myBlip = (createBlipAttachedTo ( piramide, 8 )) end end addEventHandler ( "onResourceStart", getRootElement(), silent ) La idea era que cuando el BOT muere , se respawneara a los 3 segundos. ------------------------------------------------------------------------------------------ My scripts http://community.multitheftauto.com/index.php?p=resources&s=details&id=6977 http://community.multitheftauto.com/index.php?p=resources&s=details&id=7740
Renkon Posted September 20, 2012 Posted September 20, 2012 setTimer ( piramide , 3000, 0 ) Timer a un elemento? . Siempre es a una funcion. Esta funcuion podria contener el exports slothBot spawnBot y el extra health setElementblah
NodZen Posted September 20, 2012 Author Posted September 20, 2012 setTimer ( piramide , 3000, 0 )Timer a un elemento? . Siempre es a una funcion. Esta funcuion podria contener el exports slothBot spawnBot y el extra health setElementblah Entonces seria asi? setTimer ( silent, 3000, 0 )--? ------------------------------------------------------------------------------------------ My scripts http://community.multitheftauto.com/index.php?p=resources&s=details&id=6977 http://community.multitheftauto.com/index.php?p=resources&s=details&id=7740
Renkon Posted September 20, 2012 Posted September 20, 2012 Eso spawnearía todo el tiempo cada 3 segundos un slothBot. Lo que tienes que hacer es poner en el evento de slothBot de la muerte del Bot, colocar ese timer dentro de esa respectiva funcion
NodZen Posted September 20, 2012 Author Posted September 20, 2012 Eso spawnearía todo el tiempo cada 3 segundos un slothBot.Lo que tienes que hacer es poner en el evento de slothBot de la muerte del Bot, colocar ese timer dentro de esa respectiva funcion Solo quiero que cuando el BOT muera , se spawnee a los 3 segundos de morir. No more ------------------------------------------------------------------------------------------ My scripts http://community.multitheftauto.com/index.php?p=resources&s=details&id=6977 http://community.multitheftauto.com/index.php?p=resources&s=details&id=7740
NodZen Posted September 20, 2012 Author Posted September 20, 2012 Asi? function silent ( ) if ( not isElement ( piramide ) ) then piramide = exports [ "slothBot" ]:spawnBot ( -2787.1000976563, -1516.1999511719, 139, 90, math.random ( 200, 203 ), 0, 0, piramid, 8, "hunting", true ) exports [ "extra_health" ]:setElementExtraHealth ( piramide, 2500 ) setElementModel ( piramide, 13) setTimer ( silent , 3000, 0 ) outputChatBox ("Piramid Head Se ah Generado") local myBlip = (createBlipAttachedTo ( piramide, 8 )) end end addEvent ( "onBotWasted" ,true ) addEventHandler ( "onResourceStart", getRootElement(), silent ) ------------------------------------------------------------------------------------------ My scripts http://community.multitheftauto.com/index.php?p=resources&s=details&id=6977 http://community.multitheftauto.com/index.php?p=resources&s=details&id=7740
Renkon Posted September 20, 2012 Posted September 20, 2012 (edited) function funciondecreaciondelbot() piramide = exports [ "slothBot" ]:spawnBot ( -2787.1000976563, -1516.1999511719, 139, 90, math.random ( 200, 203 ), 0, 0, piramid, 8, "hunting", true ) exports [ "extra_health" ]:setElementExtraHealth ( piramide, 2500 ) setElementModel ( piramide, 13) outputChatBox("Piramide se ha generado!", getRootElement(), 255, 128, 128, true) local myBlip = (createBlipAttachedTo ( piramide, 8 )) end addEvent("onBotWasted", true) addEventHandler("onBotWasted", root, function() if (source == piramide) then setTimer(funciondecreaciondelbot, 3000, 1) local attached = getAttachedElements ( source ) if ( attached ) then for k,element in ipairs(attached) do if getElementType ( element ) == "blip" then destroyElement ( element ) end end end end end) addEventHandler("onResourceStart", resourceRoot, funciondecreaciondelbot) Edited September 20, 2012 by Guest
NodZen Posted September 20, 2012 Author Posted September 20, 2012 addEvent("onBotWasted", true) addEventHandler("onBotWasted", root, function() if (source == piramide) then setTimer(funciondecreaciondelbot, 3000, 1) end end) Seria en en mismo script? Perdona mi brutera , es que nunca ese esto. ------------------------------------------------------------------------------------------ My scripts http://community.multitheftauto.com/index.php?p=resources&s=details&id=6977 http://community.multitheftauto.com/index.php?p=resources&s=details&id=7740
NodZen Posted September 20, 2012 Author Posted September 20, 2012 Al final solo eran 2 cosas. 1-Arreglar lo del Timer 2-agregar on bot Wasted.. Gracias Renkon ------------------------------------------------------------------------------------------ My scripts http://community.multitheftauto.com/index.php?p=resources&s=details&id=6977 http://community.multitheftauto.com/index.php?p=resources&s=details&id=7740
Recommended Posts