-- LUA Script - precede every function and global member with lowercase name of script + '_main' -- Protoncubes must be destroyed by player. --how far infront of player to drop item local move_distance = 4000 --which direction item is facing in editor (defaults: up = 0, left = 90, down = 180, right = 270) local item_y_rotation = 90 local pressed = 0 local radiationsuit_state = {} function radiationsuit2_init(e) radiationsuit_state[e] = 0 end function radiationsuit2_main(e) if GetPlayerDistance(e) < 80 and radiationsuit_state[e] == 0 then PromptDuration("Radiation Protection suit found. Press E to put the suit on",2000) -- Put suit on if g_KeyPressE == 1 and pressed == 0 then if ypos == nil then ypos = g_Entity[e]['y'] end pressed = 1 PlaySound(e,0); SetAmbienceGreen(400); --SetFogGreen(500) SetFogBlue(0) SetFogRed(0) SetFogDistance(12345) radiationsuit_state[e] = 1 Hide(e) CollisionOff(e) GravityOff(e) PromptDuration("Take Radiation Protection suit off? Press E to remove suit",2000) end -- Put suit off elseif radiationsuit_state[e] == 1 then --if you want 2nd prompt to remain on screen uncomment line below --PromptDuration("Take Radiation Protection suit off? Press E to remove suit",2000) if g_KeyPressE == 1 and pressed == 0 then pressed = 1 PlaySound(e,0); SetAmbienceGreen(256); SetFogGreen(256) SetFogBlue(256) SetFogRed(256) SetFogDistance(50000) ResetPosition(e,g_PlayerPosX,ypos,g_PlayerPosZ) SetRotation(e,0,g_PlayerAngY,0) radiationsuit_state[e] = 2 MoveForward(e,move_distance) SetRotation(e,0,item_y_rotation,0) radiationsuit_state[e] = 0 Show(e) CollisionOn(e) GravityOn(e) end end if g_KeyPressE == 0 and pressed == 1 then pressed = 0 end end