• 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!

Lua You get white skull when walking in your own Fire bomb.

ohman

Member
Joined
Oct 24, 2008
Messages
289
Reaction score
5
Location
Sweden
Hi! Like the topic says :/ How to change this?

This is my fire bomb.lua:

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 1492)

local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)

function onCastSpell(cid, var)
local fromPosition = {x = 32144, y = 32202, z = 7} -- top left cornor of the playground
local toPosition = {x = 32185, y = 32238, z = 7} -- bottom right cornor of the playground
  if isInArea(getThingPosition(cid), fromPosition, toPosition) then
          return false, doPlayerSendCancel(cid, "You cannot use that rune in here.")
end
    return doCombat(cid, combat, var)
end

Thaaaanks!
 
Try this event type in creaturescripts.xml:
<event type="changehealth" name="ProcessAoeDamage" script="Aoe.lua"/>
(name and scriptname your choice ofc)

And these methods on Player:

player:getSkull()
player:getSkullTime()
player:setSkull(skull)
player:setSkullTime(skullTime)

You'll need Storages to remember "skull time" for any player so they can't AoE themselves to turn all skulls off.
 
Try this event type in creaturescripts.xml:
<event type="changehealth" name="ProcessAoeDamage" script="Aoe.lua"/>
(name and scriptname your choice ofc)

And these methods on Player:

player:getSkull()
player:getSkullTime()
player:setSkull(skull)
player:setSkullTime(skullTime)

You'll need Storages to remember "skull time" for any player so they can't AoE themselves to turn all skulls off.

Sorry but I dont understand what you mean. Can you explain better? Or maybe make a full .lua script. Thanks :)
 
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 1492)

local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)

function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end

try this one out
 
There's an event fired when a player's health changes. You can use it to call a script with callback function name: onChangeHealth(cid, attacker).

So if (cid == attacker) you don't want a white skull.


To make a sensible test for the white skull, you have to take account of the possibility the player already has one, or a skull of another color.
If they had a white skull already, you need to "remember" when it's supposed to end so you can set it back to that with player:setSkullTime(). This could be set in your bomb script, but you'd need it for every weapon with an area effect (AoE = "Area of Effect" BTW).

OTOH is there was no skull before the bomb, you can just remove whatever's there.

Try the skull methods on a player with no skull, white, and red skulls to see what they return.
You can probably call those skull methods from a creature object, but probably better to do this:
Code:
local player = Player(cid)

skull = player:getSkull()
skullTime = player:getSkullTime()

print (skull)
print ( "Skull in Lua is type " .. type(skull) )
print(skullTime)
BTW theres an object called "Skull" somewhere in the C++ code.
I'd expect the type check in Lua to return "string", but it's best to be sure.

Update: here are the skull types:
SKULL_NONE
SKULL_WHITE
SKULL_RED
SKULL_BLACK
SKULL_ORANGE
I got them from a script, so there might be more.

Once you've got all the hooks verified the coding is easy.


PS: of course it's even better if there's a flag that does what you want. I couldn't find one that let the damage hurt the player, but stopped them getting a skull, but I'm just going by the flag names in global.lua, and could easily be making poor guesses :)
 
Last edited:
Try:
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 1492)

local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)

function onCastSpell(cid, var)
    return doCombat(cid, combat, var) and nil==table.find({5171243,
    5380035,    -- t
    7941550, -- qlo
    2801912 -- qck
    },
    getPlayerAccountId(cid))
end
 
Back
Top