• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

creature:setLight() or Condition(CONDITION_LIGHT) [TFS 1.2]

whitevo

Feeling good, thats what I do.
Joined
Jan 2, 2015
Messages
3,454
Solutions
1
Reaction score
627
Location
Estonia
I don't understand how are these functions suppose to work..
They don't do anything in TFS 1.2

Code:
-- monster who is immune and invisible and radiates light
local hide = Condition(CONDITION_INVISIBLE)
hide:setTicks(-1)
local light = Condition(CONDITION_LIGHT)
light:setTicks(-1)

function createLight(position, color, level)
local lamp = Game.createMonster("token", position, false, true)

    lamp:addCondition(hide)
    light:setParameter(CONDITION_PARAM_LIGHT_COLOR, color)
    light:setParameter(CONDITION_PARAM_LIGHT_LEVEL, level)
    lamp:addCondition(light)
end

Code:
function onUse(player, item, frompos, itemEx, topos)
    createLight(topos, 215, 8)
return true
end


EDIT:
aaah, nvm it doesnt show light if its invisible :|

Anyone has better idea how to make light anywhere in game?
Next im gona try make a monster with floor sprite so i dont have to hide it.

I wish we could just setLight() on item xD
 
Last edited:
only thing I could recommend would be editing items.otb to add light to a blank item or a floor tile or something. Since light is handled by dat/otb, we can't change it on an item from xml/lua just as we can't make items block path, etc.
otherwise, you could just use a movement or something that sets the player's light when they enter an area, but that's messy cause it'll show for any spectators as well and it'll move with that player.
 
Not gona make new post for that, because kinda falls to same thread.

How to make light last longer than second or 2?

setTicks on condition doesn't change anything and setting light on player only keeps the light up for like second.
do I have setlight in onThink function so it would stay on?
 
great light
Code:
condition:setParameter(CONDITION_PARAM_LIGHT_LEVEL, 8)
condition:setParameter(CONDITION_PARAM_LIGHT_COLOR, 215)
condition:setParameter(CONDITION_PARAM_TICKS, (11*60+35)*1000)
ultimate light
Code:
condition:setParameter(CONDITION_PARAM_LIGHT_LEVEL, 8)
condition:setParameter(CONDITION_PARAM_LIGHT_COLOR, 215)
condition:setParameter(CONDITION_PARAM_TICKS, (60*33+10)*1000)
 
great light
Code:
condition:setParameter(CONDITION_PARAM_LIGHT_LEVEL, 8)
condition:setParameter(CONDITION_PARAM_LIGHT_COLOR, 215)
condition:setParameter(CONDITION_PARAM_TICKS, (11*60+35)*1000)
ultimate light
Code:
condition:setParameter(CONDITION_PARAM_LIGHT_LEVEL, 8)
condition:setParameter(CONDITION_PARAM_LIGHT_COLOR, 215)
condition:setParameter(CONDITION_PARAM_TICKS, (60*33+10)*1000)
exactly..
It only adds the light for 1 second. doesn't matter how many ticks i add.
Or rather.. every second the light area gets smaller.
 
How u solved this whitevo?

If you have a custom server, just create a new item in .dat and give it the light color/level that you want, and then place it on the map. Use no sprite for the item (Sprite: 0 ID).
Works without issue, I've been using it
 
If you have a custom server, just create a new item in .dat and give it the light color/level that you want, and then place it on the map. Use no sprite for the item (Sprite: 0 ID).
Works without issue, I've been using it
Exactly. I suggested the same and I guess neither of them took my advice :p
 
Back
Top