Kenix Posted November 12, 2010 Share Posted November 12, 2010 I have made one script and I want that it included random functions how to make it??? help please I the newcomer at a forum Link to comment
Castillo Posted November 12, 2010 Share Posted November 12, 2010 woot? i don't get what do you want, re-explain yourself please. Link to comment
Kenix Posted November 12, 2010 Author Share Posted November 12, 2010 I want to modify zday a script That the zombie random spawn With the functions the easy zombie and the heavy zombie. Here my script. ZombieLimit = get("zombies.MaxZombies")-- HOW MANY ZOMBIES SHOULD EXIST AT MAXIMUM? ZombieStreaming = get("zombies.StreamMethod") -- 1 to constantly stream zombies, 0 to only allow zombies to spawn via createZombie function, 2 to only allow spawning at set spawnpoints ZombiePedSkins = {13,22,56,68,69,70,92,97,105,107,108,127,128,152,162,167,188,206,209,212,229,230,258,264,277,280} --ALTERNATE SKIN LISTS FOR ZOMBIES (SHORTER LIST IS TEXTURED ZOMBIES ONLY) resourceRoot = getResourceRootElement() moancount =0 moanlimit = 10 --- //создаём рандомные классы зомби addEvent( "onRandomfunction" ); addEventHandler( "onRandomfunction", getRootElement(), function( killer ) local headless = math.random (0,3) if headless == 0 then setPedHeadless (zomb,true) end --IDLE BEHAVIOUR OF A ZOMBIE function Zomb_Idle (ped) if isElement(ped) then if ( getElementData ( ped, "status" ) == "idle" ) and ( isPedDead ( ped ) == false ) and (getElementData (ped, "zombie") == true) then local action = math.random( 1, 6) if action < 4 then -- walk a random direction local rdmangle = math.random( 1, 359 ) setPedRotation( ped, rdmangle ) setPedAnimation ( ped, "PED", "Player_Sneak", -1, true, true, true) setTimer ( Zomb_Idle, 7000, 1, ped ) elseif action == 4 then -- get on the ground setPedAnimation ( ped, "MEDIC", "cpr", -1, false, true, true) setTimer ( Zomb_Idle, 4000, 1, ped ) end end end end ----//создаём класс 1 тупые зомби function zomb_class1 (ped, Zx, Zy, Zz ) if isElement(ped) then if (getElementData ( ped, "status" ) == "chasing") and (getElementData (ped, "zombie") == true) then local x, y, z = getElementPosition( ped ) if (getElementData ( ped, "target" ) == nil) then local Px = getElementData ( ped, "Tx" ) local Py = getElementData ( ped, "Ty" ) local Pz = getElementData ( ped, "Tz" ) local Pdistance = (getDistanceBetweenPoints3D( Px, Py, Pz, x, y, z )) if (Pdistance < 1.5 ) then setTimer ( function (ped) if ( isElement ( ped ) ) then setElementData ( ped, "status", "idle" ) end end, 2000, 1, ped ) end end local distance = (getDistanceBetweenPoints3D( x, y, z, Zx, Zy, Zz )) if (distance < 1 ) then -- IF THE PED HASNT MOVED if (getElementData ( ped, "target" ) == nil) then local giveup = math.random( 1, 15 ) if giveup == 1 then setElementData ( ped, "status", "idle" ) else local action = math.random( 1,6 ) if action == 1 then setPedAnimation ( ped ) triggerClientEvent ( "Zomb_Punch", getRootElement(), ped ) setTimer ( function (ped) if ( isElement ( ped ) ) then setPedAnimation ( ped, "ped", "run_old", -1, true, true, true ) end end, 800, 1, ped ) setTimer ( zomb_class1, 2000, 1, ped, x, y, z ) elseif action == 2 then setPedAnimation ( ped ) triggerClientEvent ( "Zomb_Jump", getRootElement(), ped ) setTimer ( zomb_class1, 3500, 1, ped, x, y, z ) end local Ptarget = (getElementData ( ped, "target" )) if isElement(Ptarget) then local Px, Py, Pz = getElementPosition( Ptarget ) local Pdistance = (getDistanceBetweenPoints3D( Px, Py, Pz, Zx, Zy, Zz )) if (Pdistance < 1.2 ) then -- ATTACK A PLAYER IF THEY ARE CLOSE if ( isPedDead ( Ptarget ) ) then --EAT A DEAD PLAYER setPedAnimation ( ped ) setPedAnimation ( ped, "MEDIC", "cpr", -1, false, true, false) setTimer ( function (ped) if ( isElement ( ped ) ) then setElementData ( ped, "status", "idle" ) end end, 10000, 1, ped ) setTimer ( function (ped) if ( isElement ( ped ) ) then setPedRotation ( ped, getPedRotation(ped)-180) end end, 10000, 1, ped ) zmoan(ped) else local action = math.random( 1,6 ) if action == 1 then setPedAnimation ( ped) triggerClientEvent ( "Zomb_Jump", getRootElement(), ped ) setTimer ( zomb_class1, 2000, 1, ped, x, y, z ) else setPedAnimation ( ped) triggerClientEvent ( "Zomb_Punch", getRootElement(), ped ) setTimer ( function (ped) if ( isElement ( ped ) ) then setPedAnimation ( ped, "ped", "run_old", -1, true, true, true ) end end, 800, 1, ped ) setTimer ( zomb_class1, 2000, 1, ped, x, y, z ) end end else if ( isPedDead (Ptarget) ) then setTimer ( function (ped) if ( isElement ( ped ) ) then setElementData ( ped, "status", "idle" ) end end, 2000, 1, ped ) setTimer ( function (ped) if ( isElement ( ped ) ) then setPedRotation ( ped, getPedRotation(ped)-180) end end, 1800, 1, ped ) else local action = math.random( 1,6 ) if action == 1 then setPedAnimation ( ped) triggerClientEvent ( "Zomb_Punch", getRootElement(), ped ) setTimer ( function (ped) if ( isElement ( ped ) ) then setPedAnimation ( ped, "ped", "run_old", -1, true, true, true ) end end, 800, 1, ped ) setTimer ( zomb_class1, 2000, 1, ped, x, y, z ) elseif action == 2 then setPedAnimation ( ped) triggerClientEvent ( "Zomb_Jump", getRootElement(), ped ) setTimer ( zomb_class1, 2000, 1, ped, x, y, z ) end end end else setElementData ( ped, "status", "idle" ) end end else setPedAnimation ( ped, "ped", "run_old", -1, true, true, true) --KEEP WALKING setTimer ( zomb_class1, 1000, 1, ped, x, y, z ) --CHECK AGAIN end end end end end addEvent( "onZombieWasted" ); addEventHandler( "onZombieWasted", getRootElement(), function( killer ) givePlayerMoney( killer, 100 ); if (killer) and (killer ~=source) then local exp = getElementData(killer,"exp") if exp then setElementData(killer,"exp",tonumber(getElementData(killer,"exp"))+5) outputChatBox("+5 exp! всего ".. tonumber(exp)+5,killer,0,255,0) else setElementData(killer,"exp",0) end end end ) ----//создаём класс 2 простые зомби function Zomb_class2 (ped, Zx, Zy, Zz ) if isElement(ped) then if (getElementData ( ped, "status" ) == "chasing") and (getElementData (ped, "zombie") == true) then local x, y, z = getElementPosition( ped ) if (getElementData ( ped, "target" ) == nil) then local Px = getElementData ( ped, "Tx" ) local Py = getElementData ( ped, "Ty" ) local Pz = getElementData ( ped, "Tz" ) local Pdistance = (getDistanceBetweenPoints3D( Px, Py, Pz, x, y, z )) if (Pdistance < 1.5 ) then setTimer ( function (ped) if ( isElement ( ped ) ) then setElementData ( ped, "status", "idle" ) end end, 2000, 1, ped ) end end local distance = (getDistanceBetweenPoints3D( x, y, z, Zx, Zy, Zz )) if (distance < 1 ) then -- IF THE PED HASNT MOVED if (getElementData ( ped, "target" ) == nil) then local giveup = math.random( 1,6 ) if giveup == 1 then setElementData ( ped, "status", "idle" ) else local action = math.random( 1,6 ) if action == 1 then setPedAnimation ( ped ) triggerClientEvent ( "Zomb_Punch2", getRootElement(), ped ) setTimer ( function (ped) if ( isElement ( ped ) ) then setPedAnimation ( ped, "ped", "run_fatold", -1, true, true, true ) end end, 800, 1, ped ) setTimer ( Zomb_class2, 2000, 1, ped, x, y, z ) elseif action == 2 then setPedAnimation ( ped ) triggerClientEvent ( "Zomb_Jump2", getRootElement(), ped ) setTimer ( Zomb_class2, 3500, 1, ped, x, y, z ) end end else local Ptarget = (getElementData ( ped, "target" )) if isElement(Ptarget) then local Px, Py, Pz = getElementPosition( Ptarget ) local Pdistance = (getDistanceBetweenPoints3D( Px, Py, Pz, Zx, Zy, Zz )) if (Pdistance < 1.2 ) then -- ATTACK A PLAYER IF THEY ARE CLOSE if ( isPedDead ( Ptarget ) ) then --EAT A DEAD PLAYER setPedAnimation ( ped ) setPedAnimation ( ped, "MEDIC", "cpr", -1, false, true, false) setTimer ( function (ped) if ( isElement ( ped ) ) then setElementData ( ped, "status", "idle" ) end end, 10000, 1, ped ) setTimer ( function (ped) if ( isElement ( ped ) ) then setPedRotation ( ped, getPedRotation(ped)-180) end end, 10000, 1, ped ) zmoan(ped) else local action = math.random( 1,6 ) if action == 1 then setPedAnimation ( ped) triggerClientEvent ( "Zomb_Jump2", getRootElement(), ped ) setTimer ( Zomb_class2, 2000, 1, ped, x, y, z ) else end end else if ( isPedDead (Ptarget) ) then setTimer ( function (ped) if ( isElement ( ped ) ) then setElementData ( ped, "status", "idle" ) end end, 2000, 1, ped ) setTimer ( function (ped) if ( isElement ( ped ) ) then setPedRotation ( ped, getPedRotation(ped)-180) end end, 1800, 1, ped ) else local action = math.random( 1,6 ) if action == 1 then setPedAnimation ( ped) triggerClientEvent ( "Zomb_Punch2", getRootElement(), ped ) setTimer ( function (ped) if ( isElement ( ped ) ) then setPedAnimation ( ped, "ped", "run_fatold", -1, true, true, true ) end end, 800, 1, ped ) setTimer ( Zomb_class2, 2000, 1, ped, x, y, z ) elseif action == 2 then setPedAnimation ( ped) triggerClientEvent ( "Zomb_Jump2", getRootElement(), ped ) setTimer ( Zomb_class2, 2000, 1, ped, x, y, z ) end end end else setElementData ( ped, "status", "idle" ) end end else setPedAnimation ( ped, "ped", "run_fatold", -1, true, true, true) --KEEP WALKING setTimer ( Zomb_class2, 1000, 1, ped, x, y, z ) --CHECK AGAIN end end end end addEvent( "onZombieWasted2" ); addEventHandler( "onZombieWasted2", getRootElement(), function( killer ) givePlayerMoney( killer, 200 ); if (killer) and (killer ~=source) then local exp = getElementData(killer,"exp") if exp then setElementData(killer,"exp",tonumber(getElementData(killer,"exp"))+10) outputChatBox("+10 exp! всего ".. tonumber(exp)+10,killer,0,255,0) else setElementData(killer,"exp",0) end end end ) ----//создаём класс 3 сложные зомби function Zomb_class3 (ped, Zx, Zy, Zz ) if isElement(ped) then if (getElementData ( ped, "status" ) == "chasing") and (getElementData (ped, "zombie") == true) then local x, y, z = getElementPosition( ped ) if (getElementData ( ped, "target" ) == nil) then local Px = getElementData ( ped, "Tx" ) local Py = getElementData ( ped, "Ty" ) local Pz = getElementData ( ped, "Tz" ) Link to comment
dzek (varez) Posted November 12, 2010 Share Posted November 12, 2010 your post is random, your code is random. and i still dont know what you want to do Link to comment
Kenix Posted November 12, 2010 Author Share Posted November 12, 2010 I want to make that the zombie spawn on the classes. I badly write in English Link to comment
Castillo Posted November 12, 2010 Share Posted November 12, 2010 i think what he want is this, class 1 (you can kill them fast or something like that) class 2 (harder to kill etc) ,etc,etc. Link to comment
guyfromuk Posted November 12, 2010 Share Posted November 12, 2010 example: Zombie warror, Zombie elite warrior or something ? Link to comment
Kenix Posted November 12, 2010 Author Share Posted November 12, 2010 All is correct SolidShake Link to comment
Aibo Posted November 12, 2010 Share Posted November 12, 2010 i dont think you don't need a separate functions/handlers for every class. just place ped class in its elementData (on spawn or something, never got a good look on zombie resource tho), and control them accordingly. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now