Scripts / Teacher SmallG ... A question about deployable_fire

Author
Message
warlock12
8
Years of Service
User Offline
Joined: 12th Sep 2016
Location: Argentina
Posted: 20th Dec 2016 15:56
Google Traductor says:
"I love the script cold_level.lua, but (as we know) the way to "warm up" is with "deployable_fire.lua". I tried by all means to make it work without success, I put light, I put it in dynamic, in static, I tried to cancel the lines dedicated to the light in the script ... but everything gives me error. The error that arises when I use the original script is "Runtime error 7600" ... that is that it is trta of an "illegal object" ... In what I am mistaken? From already thank you very much!!! I hope the title of teacher does not bother you, but in fact I consider that those who learn Lua in Gameguru is 80% thanks to you. A great greeting !!!"

Original:
Adoro el script cold_level.lua, pero (como sabemos) la forma de "calentarnos" es con "deployable_fire.lua". Traté por todos los medios de hacerlo funcionar sin éxito, coloqué luz, la puse en dinámica, en estática, traté de anular las lineas dedicadas a la luz en el script... pero todo me dá error. El error que surge cuando uso el script original es "Runtime error 7600"... o sea que se trta de un "objeto ilegal"... ¿En qué me equivoco? Desde ya muchas gracias!!! Espero que el título de maestro no le moleste, pero en realidad considero que los que se aprende de Lua en Gameguru es en un 80% gracias a usted. Un gran saludo!!!




fire_deployed = 1
fire_state = "out"
local height_dif = 0
c_pressed = 0

local heat_range = 400 --how far the player can move away and still get warmed by the fire
local warmth_delay = 999 --how quickly the player restores warmth when fire is lit
local use_range = 120
local light_number = 3

function deployable_fire_init(e)

end

function deployable_fire_main(e)

if fire_deployed == 1 then
if PlayerLooking(e,use_range,25) == 1 then
Panel(65,90,85,99)
TextCenterOnX(75,95,3,"Press C to pick up the fire")
height_dif = g_PlayerPosY - g_Entity[e]['y']
if g_KeyPressC == 1 and c_pressed == 0 then
fire_state = "out"
fire_deployed = 0
c_pressed = 1
StopParticleEmitter(e)
end
if fire_state == "out" then
Panel(40,90,60,99)
TextCenterOnX(50,95,3,"Light the fire? *e*")
if g_KeyPressE == 1 then
StartTimer(e)
fire_state = "lit"
StartParticleEmitter(e)
ShowLight(light_number)
end
end
end

if fire_state == "lit" then
if GetPlayerDistance(e) < heat_range then
if GetTimer(e) > warmth_delay then
StartTimer(e)
--current_cold = current_cold + 1
outside = 0
end
else
outside = 1
end
else
HideLight(light_number)
outside = 1
end

elseif fire_deployed == 0 then
new_y = math.rad(g_PlayerAngY)
fire_x = g_PlayerPosX + (math.sin(new_y) * 70)
fire_z = g_PlayerPosZ + (math.cos(new_y) * 70)
Hide(e)
CollisionOff(e)
CollisionOff(light_number)
HideLight(light_number)
SetPosition(e , fire_x, g_PlayerPosY - height_dif , fire_z)
SetPosition(light_number , fire_x, g_PlayerPosY - height_dif , fire_z)
Panel(65,90,85,99)
TextCenterOnX(75,95,3,"Press C to place a fire")
if g_KeyPressC == 1 and c_pressed == 0 then
Show(e)
CollisionOn(e)
fire_deployed = 1
fire_state = "out"
c_pressed = 1
end


end --fire_deployed


if g_KeyPressC == 0 then
c_pressed = 0
end

--Prompt(fire_deployed.." "..fire_state)

end --main

function PlayerLooking(e,dis,v)
if g_Entity[e] ~= nil then
if dis == nil then
dis = 3000
end
if v == nil then
v = 0.5
end
if GetPlayerDistance(e) <= dis then
local destx = g_Entity[e]['x'] - g_PlayerPosX
local destz = g_Entity[e]['z'] - g_PlayerPosZ
local angle = math.atan2(destx,destz)
angle = angle * (180.0 / math.pi)

if angle <= 0 then
angle = 360 + angle
elseif angle > 360 then
angle = angle - 360
end
while g_PlayerAngY < 0 or g_PlayerAngY > 360 do
if g_PlayerAngY <= 0 then
g_PlayerAngY = 360 + g_PlayerAngY
elseif g_PlayerAngY > 360 then
g_PlayerAngY = g_PlayerAngY - 360
end
end
local L = angle - v
local R = angle + v
if L <= 0 then
L = 360 + L
elseif L > 360 then
L = L - 360
end
if R <= 0 then
R = 360 + R
elseif R > 360 then
R = R - 360
end

if (L < R and math.abs(g_PlayerAngY) > L and math.abs(g_PlayerAngY) < R) then
return 1
elseif (L > R and (math.abs(g_PlayerAngY) > L or math.abs(g_PlayerAngY) < R)) then
return 1
else
return 0
end
else
return 0
end
end
end

The game is a serious thing (El juego es una cosa seria)
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 20th Dec 2016 19:46
lights can't be moved yet so it's not really working with a light, try this
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
warlock12
8
Years of Service
User Offline
Joined: 12th Sep 2016
Location: Argentina
Posted: 20th Dec 2016 23:02
Thank You SmallG!!! Quick willful !!!! Merry Christmas ... I hope I do not have to bother until next year !!!!
The game is a serious thing (El juego es una cosa seria)
warlock12
8
Years of Service
User Offline
Joined: 12th Sep 2016
Location: Argentina
Posted: 20th Dec 2016 23:10
I already tried it and it works great! Now to study what changes there were in the scripts and learn something more from the master !!!
The game is a serious thing (El juego es una cosa seria)

Login to post a reply

Server time is: 2024-12-23 03:26:56
Your offset time is: 2024-12-23 03:26:56