EDIT: Solved -
The solution was simply adding a condition that checks if the player storage value is equal to 1 or 5 (because those do not have outfits in the transformation) and setting the outfit parameters inside those conditions. If you don't do this, the value for un_table.look will glitch since storage values 1 and 5 have 'nil' on their looktype value. This caused the glitch I think. Anways, add the condition and then simply use a getCreatureOutfit and set the outfit param to the same outfit the creature was wearing.
I created this script by myself and everything works properly according to the storage value of the player. Except the outfit part. Sometimes it works, sometimes it does not. The first time the player uses the spell the outfit changes and reverts normally, but after that it turns out it becomes random!
P.S - I am currently using the /storage command to change the storage values, and I was wondering if this command doesn't "change" a storage value, but adds an additional one? Probably not lol
So to sum it up, player uses spell and transforms to something based on a storage value. All stats he receives are based on this storage, and he receives everything perfectly except for the outfit part which seems to be random.
Anyways, the script is posted down here, so please help me!
Fixed script
Old script
The solution was simply adding a condition that checks if the player storage value is equal to 1 or 5 (because those do not have outfits in the transformation) and setting the outfit parameters inside those conditions. If you don't do this, the value for un_table.look will glitch since storage values 1 and 5 have 'nil' on their looktype value. This caused the glitch I think. Anways, add the condition and then simply use a getCreatureOutfit and set the outfit param to the same outfit the creature was wearing.
I created this script by myself and everything works properly according to the storage value of the player. Except the outfit part. Sometimes it works, sometimes it does not. The first time the player uses the spell the outfit changes and reverts normally, but after that it turns out it becomes random!
P.S - I am currently using the /storage command to change the storage values, and I was wondering if this command doesn't "change" a storage value, but adds an additional one? Probably not lol
So to sum it up, player uses spell and transforms to something based on a storage value. All stats he receives are based on this storage, and he receives everything perfectly except for the outfit part which seems to be random.
Anyways, the script is posted down here, so please help me!
Fixed script
Lua:-- general configurations of the transformation local config = { duration = 10 * 1000, ex_id = 9919, ex_cd = 10, bloodtype_id = 9920, } -- creating combat and condition objects local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0) local regen = createConditionObject(CONDITION_REGENERATION) local haste = createConditionObject(CONDITION_HASTE) local condition = createConditionObject(CONDITION_ATTRIBUTES) function onCastSpell(cid, var) if getCreatureStorage(cid, config.bloodtype_id) > 0 then if exhaustion.get(cid, config.ex_id) then local remaining = exhaustion.get(cid, config.ex_id) doPlayerSendCancel(cid, 'You have to wait ' .. remaining .. ' more seconds to unleash your power again.') return true else exhaustion.set(cid, config.ex_id, config.ex_cd) end for i = 1, #un_table do if getCreatureStorage(cid, config.bloodtype_id) == un_table[i].stg_value then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, un_table[i].msg) addEvent(function() doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You returned to your base form.") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_DRAWBLOOD) doCreatureSetStorage(cid, 9921, -1) end, config.duration) --Attributes of the transformation doCreatureSetStorage(cid, 9921, 1) -- storage used to check if the player is transformed setConditionParam(condition, CONDITION_PARAM_TICKS, config.duration) setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, un_table[i].ml) setConditionParam(condition, CONDITION_PARAM_SKILL_SWORD, un_table[i].skills) setConditionParam(condition, CONDITION_PARAM_SKILL_AXE, un_table[i].skills) setConditionParam(condition, CONDITION_PARAM_SKILL_CLUB, un_table[i].skills) setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCE, un_table[i].skills) setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, un_table[i].shield) setConditionParam(condition, CONDITION_PARAM_STAT_MAXHEALTHPERCENT, un_table[i].hpmax) setConditionParam(condition, CONDITION_PARAM_STAT_MAXMANAPERCENT, un_table[i].mpmax) setCombatCondition(combat, condition) setConditionParam(haste, CONDITION_PARAM_TICKS, config.duration) setConditionParam(haste, CONDITION_PARAM_SPEED, un_table[i].speed) setConditionParam(haste, CONDITION_PARAM_BUFF, TRUE) setCombatCondition(combat, haste) setConditionParam(regen, CONDITION_PARAM_TICKS, config.duration) setConditionParam(regen, CONDITION_PARAM_SUBID, 1) setConditionParam(regen, CONDITION_PARAM_BUFF, TRUE) setConditionParam(regen, CONDITION_PARAM_HEALTHGAIN, un_table[i].hpregen) setConditionParam(regen, CONDITION_PARAM_HEALTHTICKS, 1000) setConditionParam(regen, CONDITION_PARAM_MANAGAIN, un_table[i].mpregen) setConditionParam(regen, CONDITION_PARAM_MANATICKS, 1000) setCombatCondition(combat, regen) if (getPlayerSex(cid) == 0 and getCreatureStorage(cid, config.bloodtype_id) ~= 1 and getCreatureStorage(cid, config.bloodtype_id) ~= 5) then local outfit = createConditionObject(CONDITION_OUTFIT) setConditionParam(outfit, CONDITION_PARAM_TICKS, config.duration) addOutfitCondition(outfit, {lookType = un_table[i].lookf}) setCombatCondition(combat, outfit) elseif (getPlayerSex(cid) == 1 and getCreatureStorage(cid, config.bloodtype_id) ~= 1 and getCreatureStorage(cid, config.bloodtype_id) ~= 5) then local outfit = createConditionObject(CONDITION_OUTFIT) setConditionParam(outfit, CONDITION_PARAM_TICKS, config.duration) addOutfitCondition(outfit, {lookType = un_table[i].lookm}) setCombatCondition(combat, outfit) end if (getCreatureStorage(cid, config.bloodtype_id) == 1 or getCreatureStorage(cid, config.bloodtype_id) == 5) then local outfit = createConditionObject(CONDITION_OUTFIT) setConditionParam(outfit, CONDITION_PARAM_TICKS, config.duration) addOutfitCondition(outfit, getCreatureOutfit(cid)) setCombatCondition(combat, outfit) end return doCombat(cid, combat, var) end end else doPlayerSendCancel(cid, "You don't have a bloodtype yet.") end return true end return true
Old script
Lua:-- general configurations of the transformation local config = { duration = 10 * 1000, ex_id = 9919, ex_cd = 10, bloodtype_id = 9920, } -- creating combat and condition objects local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0) local outfit = createConditionObject(CONDITION_OUTFIT) local regen = createConditionObject(CONDITION_REGENERATION) local haste = createConditionObject(CONDITION_HASTE) local condition = createConditionObject(CONDITION_ATTRIBUTES) function onCastSpell(cid, var) if getCreatureStorage(cid, config.bloodtype_id) > 0 then if exhaustion.get(cid, config.ex_id) then local remaining = exhaustion.get(cid, config.ex_id) doPlayerSendCancel(cid, 'You have to wait ' .. remaining .. ' more seconds to unleash your power again.') return true else exhaustion.set(cid, config.ex_id, config.ex_cd) end for i = 1, #un_table do if getCreatureStorage(cid, config.bloodtype_id) == un_table[i].stg_value then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, un_table[i].msg) addEvent(function() doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You returned to your base form.") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_DRAWBLOOD) doCreatureSetStorage(cid, 9921, -1) end, config.duration) --Attributes of the transformation doCreatureSetStorage(cid, 9921, 1) -- storage used to check if the player is transformed setConditionParam(condition, CONDITION_PARAM_TICKS, config.duration) setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, un_table[i].ml) setConditionParam(condition, CONDITION_PARAM_SKILL_SWORD, un_table[i].skills) setConditionParam(condition, CONDITION_PARAM_SKILL_AXE, un_table[i].skills) setConditionParam(condition, CONDITION_PARAM_SKILL_CLUB, un_table[i].skills) setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCE, un_table[i].skills) setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, un_table[i].shield) setConditionParam(condition, CONDITION_PARAM_STAT_MAXHEALTHPERCENT, un_table[i].hpmax) setConditionParam(condition, CONDITION_PARAM_STAT_MAXMANAPERCENT, un_table[i].mpmax) setCombatCondition(combat, condition) setConditionParam(haste, CONDITION_PARAM_TICKS, config.duration) setConditionParam(haste, CONDITION_PARAM_SPEED, un_table[i].speed) setConditionParam(haste, CONDITION_PARAM_BUFF, TRUE) setCombatCondition(combat, haste) setConditionParam(regen, CONDITION_PARAM_TICKS, config.duration) setConditionParam(regen, CONDITION_PARAM_SUBID, 1) setConditionParam(regen, CONDITION_PARAM_BUFF, TRUE) setConditionParam(regen, CONDITION_PARAM_HEALTHGAIN, un_table[i].hpregen) setConditionParam(regen, CONDITION_PARAM_HEALTHTICKS, 1000) setConditionParam(regen, CONDITION_PARAM_MANAGAIN, un_table[i].mpregen) setConditionParam(regen, CONDITION_PARAM_MANATICKS, 1000) setCombatCondition(combat, regen) setConditionParam(outfit, CONDITION_PARAM_TICKS, config.duration) if (getPlayerSex(cid) == 0 and getCreatureStorage(cid, config.bloodtype_id) ~= 1 and getCreatureStorage(cid, config.bloodtype_id) ~= 5) then addOutfitCondition(outfit, {lookType = un_table[i].lookf}) elseif (getPlayerSex(cid) == 1 and getCreatureStorage(cid, config.bloodtype_id) ~= 1 and getCreatureStorage(cid, config.bloodtype_id) ~= 5) then addOutfitCondition(outfit, {lookType = un_table[i].lookm}) end setCombatCondition(combat, outfit) return doCombat(cid, combat, var) end end else doPlayerSendCancel(cid, "You don't have a bloodtype yet.") end return true end return true
Last edited: