This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials
-- These three lines should get me info from the character values tab, yes?
-- If AppleStamina is set at 2, then astamina in this script is now also 2.
astamina = getObject("Values[AppleStamina]")
areflex = getObject("Values[AppleReflexes]")
afat = getObject("Values[AppleFatigue]")
-- some extra number for the sake of example. this could be all manner of complex math...
random_number = math.random(1,10)
-- adding all of my various numbers together just doing some basic math
sum = random_number + astamina + areflex - afat
-- I need to be able to send the new value of AppleToHitChance back to the game.
-- Basically it needs to replace the value that was set in the character's Values tab.
-- This number will grow as the character gains experience.
-- Also, the above three values (AppleStamina, etc.) will grow as well and will need to change.
-- AppleToHitChance = sum
-- This is the part I really can't figure out... maybe too early in the morning & need more coffee.
-- are any of these close? do I need the character's name somewhere?
sum:setValue("Values[AppleToHitChance]")
sum:setValue(vAppleToHitChance)
sum:setValue(VAppleToHitChance)
AppleToHitChance:setValue(VValueInt, sum)
-- set as definition script
local hero = game:getLink(VGameCurrentCharacter) -- get current character
local hSpd = hero:getObject(".CharacterValues[speed]") -- get value speed of current character
local hLvl = hero:getObject(".CharacterValues[level]") -- get value level of current character
local hHit = hero:getObject(".CharacterValues[hit]") -- get value hit of current character
local t = {}
t["_temporary_"] = ""
function hit_chance(e)
t["enemy"] = getObject("Characters[" .. e .. "]") -- store linked enemy
t["spd"] = t["enemy"]:getObject(".CharacterConditions[speed]"):getInt(VValueInt)
t["lvl"] = t["enemy"]:getObject(".CharacterValues[level]"):getInt(VValueInt)
t["evasion"] = t["enemy"]:getObject(".CharacterValues[evasion]"):getInt(VValueInt)
-- * --
t["hTotal"] = hLvl + hSpd + math.random(hHit, 100) -- level + speed + random hit value (current character)
t["eTotal"] = t["lvl"] + t["spd"] + math.random(t["evasion"], 100) -- level + speed + random evasion value (linked enemy)
-- * --
if t["hTotal"] >= t["eTotal"] then return true else return false end
end
-- execute a script
hit_chance("add enemy name here") -- case sensitive
getObject("Values[value_name]"):setValue(VValueInt, variable or number)
var = getObject("Values[value_name]")
var:setValue(VValueInt, variable or number)
This thread is closed because nobody has replied for more than a year. Feel free to ask your question in a new thread.
New thread