Smirnoff Posted March 16, 2016 Share Posted March 16, 2016 i had a idea for a radioactive zone script like Fallout 3 or Stalker but actually i cant make this work any help? previously declared hill_Enter radx4 radn radmaxx This Line It is when the player enters the area function hill_Enter ( player, matchingDimension ) if (getElementType(player) == "player") then radx4() playSound("sounds/rad.mp3") elseif radn >= radmaxx then setElementData(player,"blood",-666) end end setTimer(hill_Enter,1000,0) addEventHandler ( "onColShapeHit", hillArea, hill_Enter ) Link to comment
KariiiM Posted March 17, 2016 Share Posted March 17, 2016 function hill_Enter ( player, matchingDimension ) if (player and getElementType(player) == "player" and matchingDimension) then setTimer( function (player) radx4() playSound("sounds/rad.mp3") if radn and radn >= radmaxx then setElementData(player,"blood",-666) end end,1000,0,player) end end addEventHandler ( "onColShapeHit", hillArea, hill_Enter) Link to comment
Smirnoff Posted March 17, 2016 Author Share Posted March 17, 2016 function hill_Enter ( player, matchingDimension ) if (player and getElementType(player) == "player" and matchingDimension) then setTimer( function (player) radx4() playSound("sounds/rad.mp3") if radn and radn >= radmaxx then setElementData(player,"blood",-666) end end,1000,0,player) end end addEventHandler ( "onColShapeHit", hillArea, hill_Enter) actually with the change nothing happend you wanna see all script? Link to comment
KariiiM Posted March 17, 2016 Share Posted March 17, 2016 Yes and please tell me what you are trying to do and tell me the errors if exists , /debugscript 3 Link to comment
Smirnoff Posted March 17, 2016 Author Share Posted March 17, 2016 well, I'm trying to create a radioactive area-zone(as in fallout 3 or Stalker game) when you enter this area, the sound of a geiger counter Start and start a count to 300 having passed the 300 the player will die or lose health any idea? local hillArea = createColRectangle ( -736.27728271484,909.60327148438, 150, 150 ) local hillRadar = createRadarArea ( -736.27728271484,909.60327148438, 100, 100, 0, 255, 0, 175 ) local radmax = 300 local player = getLocalPlayer() function radx() local radn = getElementData(player,"Radiacion") radi = guiCreateLabel(0.01, 0.31, 0.22, 0.03, "Radiacion:"..radn, true) guiSetFont(radi, "default-bold-small") guiLabelSetColor(radi, 255, 0, 0) end function radx2() local radn = getElementData(player,"Radiacion") if not radn then setElementData(player,"Radiacion",0) destroyElement(radi) setTimer(radx,500,1) else destroyElement(radi) setTimer(radx,500,1) end ---Jugador entrando al area function hill_Enter ( player, matchingDimension ) if (player and getElementType(player) == "player" and matchingDimension) then setTimer( function (player) radx4() playSound("sounds/rad.mp3") if radn and radn >= radmaxx then setElementData(player,"blood",-666) end end,1000,0,player) end end addEventHandler ( "onColShapeHit", hillArea, hill_Enter) -- Jugador saliendo del Area function hill_Exit ( player, matchingDimension ) if (getElementType(player) == "player") then radx5() end end end addEventHandler ( "onColShapeLeave", hillArea, hill_Exit ) function radx4() setElementData(player,radn + 10) end function radx5() setElementData(player,radn - 10) end Link to comment
KariiiM Posted March 17, 2016 Share Posted March 17, 2016 Your current code is messy and not clear enough, if you want tomorrow I can make this code working for you, now I have to sleep Link to comment
Smirnoff Posted March 17, 2016 Author Share Posted March 17, 2016 Your current code is messy and not clear enough, if you want tomorrow I can make this code working for you, now I have to sleep Thank you! i will still working on this Anyway I can wait for your code Really thank you Link to comment
KariiiM Posted March 17, 2016 Share Posted March 17, 2016 I will be glad to help, Btw, What do you mean by 'blood'? to make the player's health down when the timer become less than or equal to 0 ? Link to comment
Captain Cody Posted March 17, 2016 Share Posted March 17, 2016 Yes he does mean health, he said previously that he wanted to lower health, or kill the player. Any ways issues I see just from scanning : radn is not defined as a global variable, you will have to redefine in it in each of the segmentsenter timer is never cancelled so even when he leaves he will still gain radioactive stufffunction radx2 is missing an endfunction hill_Exit has 1 to many endsAny thing appearing in debugscript 3? Link to comment
Smirnoff Posted March 17, 2016 Author Share Posted March 17, 2016 I will be glad to help,Btw, What do you mean by 'blood'? to make the player's health down when the timer become less than or equal to 0 ? i want this script work with a "Dayz gamemode" and in this mode the health equal to blood example a player had 20000 blood if he get a shot he lost a 356 from this 20000 when the number gets negative or 0 automatically the player dies will be great if become down reaching the 300 maximum rads units Link to comment
Smirnoff Posted March 17, 2016 Author Share Posted March 17, 2016 Yes he does mean health, he said previously that he wanted to lower health, or kill the player.Any ways issues I see just from scanning : radn is not defined as a global variable, you will have to redefine in it in each of the segmentsenter timer is never cancelled so even when he leaves he will still gain radioactive stufffunction radx2 is missing an endfunction hill_Exit has 1 to many endsAny thing appearing in debugscript 3? is there any log for debugscript 3? Link to comment
Captain Cody Posted March 17, 2016 Share Posted March 17, 2016 Not sure, but if you see any major errors just post them here. Link to comment
Smirnoff Posted March 17, 2016 Author Share Posted March 17, 2016 Not sure, but if you see any major errors just post them here. actually y get this Link to comment
Captain Cody Posted March 17, 2016 Share Posted March 17, 2016 Clear your debug with /cleardebugscript, then launch the script and post the whole debug here. Link to comment
Smirnoff Posted March 17, 2016 Author Share Posted March 17, 2016 Clear your debug with /cleardebugscript, then launch the script and post the whole debug here. just that Link to comment
Captain Cody Posted March 17, 2016 Share Posted March 17, 2016 There is something wrong with your "Hill_Exit" function, it's not finding it. Link to comment
Simple0x47 Posted March 17, 2016 Share Posted March 17, 2016 Try this: (Viva DayZ :v) local hillArea = createColRectangle ( -736.27728271484,909.60327148438, 150, 150 ) local hillRadar = createRadarArea ( -736.27728271484,909.60327148438, 100, 100, 0, 255, 0, 175 ) local radmax = 300 local player = getLocalPlayer() function radx() local radn = getElementData(player,"Radiacion") radi = guiCreateLabel(0.01, 0.31, 0.22, 0.03, "Radiacion: "..radn, true) guiSetFont(radi, "default-bold-small") guiLabelSetColor(radi, 255, 0, 0) end function radx2() local radn = getElementData(player,"Radiacion") if not radn then setElementData(player,"Radiacion",0) destroyElement(radi) setTimer(radx,500,1) else destroyElement(radi) setTimer(radx,500,1) end end ---Jugador entrando al area function hill_Enter ( player, matchingDimension ) if (player and getElementType(player) == "player" and matchingDimension) then if radx5Timer then killTimer(radx5Timer) end local radx4Timer = setTimer( function (player) radx4() playSound("sounds/rad.mp3") if radn and radn >= radmaxx then setElementData(player,"blood",-665) end end,1000,0,player) end end addEventHandler ( "onColShapeHit", hillArea, hill_Enter) -- Jugador saliendo del Area function hill_Exit ( player, matchingDimension ) if (player and getElementType(player) == "player" and matchingDimension) then if radx4Timer then killTimer(radx4Timer) end local radx5Timer = setTimer(radx5, 1000, 0, player) end end addEventHandler ( "onColShapeLeave", hillArea, hill_Exit ) function radx4() setElementData(player,radn + 10) end function radx5() setElementData(player,radn - 10) end Link to comment
Smirnoff Posted March 18, 2016 Author Share Posted March 18, 2016 Try this: (Viva DayZ :v) local hillArea = createColRectangle ( -736.27728271484,909.60327148438, 150, 150 ) local hillRadar = createRadarArea ( -736.27728271484,909.60327148438, 100, 100, 0, 255, 0, 175 ) local radmax = 300 local player = getLocalPlayer() function radx() local radn = getElementData(player,"Radiacion") radi = guiCreateLabel(0.01, 0.31, 0.22, 0.03, "Radiacion: "..radn, true) guiSetFont(radi, "default-bold-small") guiLabelSetColor(radi, 255, 0, 0) end function radx2() local radn = getElementData(player,"Radiacion") if not radn then setElementData(player,"Radiacion",0) destroyElement(radi) setTimer(radx,500,1) else destroyElement(radi) setTimer(radx,500,1) end end ---Jugador entrando al area function hill_Enter ( player, matchingDimension ) if (player and getElementType(player) == "player" and matchingDimension) then if radx5Timer then killTimer(radx5Timer) end local radx4Timer = setTimer( function (player) radx4() playSound("sounds/rad.mp3") if radn and radn >= radmaxx then setElementData(player,"blood",-665) end end,1000,0,player) end end addEventHandler ( "onColShapeHit", hillArea, hill_Enter) -- Jugador saliendo del Area function hill_Exit ( player, matchingDimension ) if (player and getElementType(player) == "player" and matchingDimension) then if radx4Timer then killTimer(radx4Timer) end local radx5Timer = setTimer(radx5, 1000, 0, player) end end addEventHandler ( "onColShapeLeave", hillArea, hill_Exit ) function radx4() setElementData(player,radn + 10) end function radx5() setElementData(player,radn - 10) end Just the same ima getting mad with this idea but i really want this script haha any idea? my knowledge is barely not much a little bit of java and the mta wiki xdd Link to comment
Captain Cody Posted March 18, 2016 Share Posted March 18, 2016 Is client.lua the code that you posted? if so there's no apparent errors at line 29, or did you not copy it correctly? Link to comment
Smirnoff Posted March 18, 2016 Author Share Posted March 18, 2016 Is client.lua the code that you posted? if so there's no apparent errors at line 29, or did you not copy it correctly? Actually this is the file with the modification of Simple01 http://www.mediafire.com/download/5057szk553n1u41/rad.zip with the error loading Line 29 yes is the client Link to comment
Captain Cody Posted March 18, 2016 Share Posted March 18, 2016 I'll take a look at it in a bit. Link to comment
Smirnoff Posted March 18, 2016 Author Share Posted March 18, 2016 I'll take a look at it in a bit. Thx ,but after a check with simple01 (he made everything jeje) i was using server side functions and after a few rechecks y get this server side code (actually i dont know what put in the client side) radcol = createColCuboid ( 95.974617004395, 1751.3895263672, 17.640625, 255, 255, 255 ) radZoneRadar = createRadarArea ( 95.974617004395, 1751.3895263672, 255, 255, 91, 127, 0, 100 ) local nonKillables = {[287]=true,[285]=true,[193]=true,[192]=true,[191]=true,[294]=true;} local radmax = 300 local player = getLocalPlayer() local radiationLabel function radx() local radn = getElementData(player,"radiacion") local radiationLabel = guiCreateLabel(0.01, 0.31, 0.22, 0.03, "Radiacion:"..radn, true) guiSetFont(radiationLabel, "default-bold-small") guiLabelSetColor(radiationLabel, 255, 255, 91) end function radx2() local radn = getElementData(player,"radiacion") if not radn then setElementData(player,"radiacion",0) guiSetVisible(radiationLabel, false) setTimer(radx,500,1) else guiSetVisible(radiationLabel, false) setTimer(radx,500,1) end end setTimer(radx2,500,0) function radx4() setElementData(player,radn + 10) end function radx5() setElementData(player,radn - 10) end addEventHandler( "onColShapeHit", radcol, function(hitPlayer,player) if getElementType(hitPlayer)=="player" then local skin = getElementModel (hitPlayer) if nonKillables[skin] then radx5() elseif not radx4() then playSound("sounds/rad.mp3") elseif radn >= radmaxx then setElementData(player,"blood",-1000) end end end) after getting server side the guilaber works and the colo on the radar too but no the main script ( get rad lvl ) 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