Jump to content

Wes's balloons


Recommended Posts

You could start with something like this:

function ACTIONS.MAKEBALLOON:fn(act)    if act.doer and act.invobject and act.invobject.components.balloonmaker then        local x,y,z = act.doer.Transform:GetWorldPosition()        local angle = TheCamera.headingtarget + math.random()*10*DEGREES-5*DEGREES        x = x + .5*math.cos(angle)        z = z + .5*math.sin(angle)        act.invobject.components.balloonmaker:MakeBalloon(x,y,z)    end    return trueend
I haven't tried it so I don't know for sure if it works, but this should get you started.
Link to comment
Share on other sites

I don't think plaidman understood your question. You mean popping damage, right? Or sanity damage?

 

In order to make Wes invincible to his own balloons, the easiest solution would be to edit the balloon file and make an exception. This method is incompatible with anything that also edits the balloon file.

You could possibly give Wes health back when he got hit by a balloon (eventhough a million balloons would still kill him most likely, and use up armor), or making him invincible shortly.

I can't really think of any good code at the moment, maybe someone else can.

 

If you meant sanity damage, just use what plaidman gave you. It overrides the original action with the same action, just without the sanity loss.

Link to comment
Share on other sites

You might be right Mobbstar. I read "reason" and thought it meant sanity, i.e. ability to reason.

I whipped up some code that will remove the health damage from popping balloons. Right now this damage avoidance only applies to Wes. In DST, if another character creates the balloon, that balloon will still damage the character who created it, and no balloons will ever damage Wes. It's a simple exercise to make it so the damage avoidance will apply to the character who created the balloon.

AddPrefabPostInit("balloon", function(inst)    local combat = inst.components.combat    local oldIsValidTarget = combat.IsValidTarget    function combat:IsValidTarget(target)        if target.prefab == "wes" then            return false        end        return oldIsValidTarget(combat, target)    endend)
I also ran the code in my first response, and of course it crashed. Here's the code that actually works. When DST comes out, this code will apply the sanity change to any character who creates the ballon, not just Wes. Again, it's a simple exercise if you wish to make this apply only to Wes. Look at data/scripts/actions.lua for the original code.

AddSimPostInit(function()    local degrees = GLOBAL.DEGREES    GLOBAL.ACTIONS.MAKEBALLOON.fn = function(act)        if act.doer and act.invobject and act.invobject.components.balloonmaker then            local x,y,z = act.doer.Transform:GetWorldPosition()            local angle = GLOBAL.TheCamera.headingtarget + math.random()*10*degrees-5*degrees            x = x + .5*math.cos(angle)            z = z + .5*math.sin(angle)            act.invobject.components.balloonmaker:MakeBalloon(x,y,z)        end        return true    endend)
Link to comment
Share on other sites

Возможно, вы правы Mobbstar. Я читал "причину" и думал, что это означало, здравомыслие, то есть способность рассуждать. Я на скорую руку некоторый код, который снимет вреда здоровью от появляются воздушные шары. Сейчас этот избегание ущерба относится только к Wes. В DST, если другой персонаж создает воздушный шар, что шар будет еще испортить характер, который создал его, и никакие воздушные шары никогда не повредить Уэса. Это простое упражнение, чтобы сделать так, избегание ущерба будет применяться к символу, который создал воздушный шар.

 

AddPrefabPostInit ("воздушный шар", функция (инст)    местный боевой = inst.components.combat    местный oldIsValidTarget = combat.IsValidTarget    Функция боевой: IsValidTarget (цель)        если target.prefab == "Wes" тогда            вернуться ложным        конец        вернуться oldIsValidTarget (боевой, целевой)    конецконец)
Я тоже побежал код в моем первом ответе, и, конечно, он разбился. Вот код, который на самом деле работает. Когда DST выходит, этот код будет применить изменения здравомыслие в отношении любого символа, который создает воздушный шар, а не только Уэса. Опять же, это простое упражнение, если вы хотите сделать это применяется только к Wes. Посмотрите на данных / скрипты / actions.lua для первоначального кода.

AddSimPostInit (функция ()    местные градусов = GLOBAL.DEGREES    GLOBAL.ACTIONS.MAKEBALLOON.fn = функция (акт)        если act.doer и act.invobject и act.invobject.components.balloonmaker затем            местные х, у, г = act.doer.Transform: GetWorldPosition ()            локальный угол = GLOBAL.TheCamera.headingtarget + Math.random () * 10 * градусов-5 * градусов            х = х + 0,5 * Math.cos (угол)            г = г + 0,5 * Math.sin (угол)            act.invobject.components.balloonmaker: MakeBalloon (х, у, г)        конец        возвращение истинного    конецконец)

Господи !!! Они работают !!! СПАСИБО !!!

Link to comment
Share on other sites

You might be right Mobbstar. I read "reason" and thought it meant sanity, i.e. ability to reason.

I whipped up some code that will remove the health damage from popping balloons. Right now this damage avoidance only applies to Wes. In DST, if another character creates the balloon, that balloon will still damage the character who created it, and no balloons will ever damage Wes. It's a simple exercise to make it so the damage avoidance will apply to the character who created the balloon.

AddPrefabPostInit("balloon", function(inst)    local combat = inst.components.combat    local oldIsValidTarget = combat.IsValidTarget    function combat:IsValidTarget(target)        if target.prefab == "wes" then            return false        end        return oldIsValidTarget(combat, target)    endend)
I also ran the code in my first response, and of course it crashed. Here's the code that actually works. When DST comes out, this code will apply the sanity change to any character who creates the ballon, not just Wes. Again, it's a simple exercise if you wish to make this apply only to Wes. Look at data/scripts/actions.lua for the original code.

AddSimPostInit(function()    local degrees = GLOBAL.DEGREES    GLOBAL.ACTIONS.MAKEBALLOON.fn = function(act)        if act.doer and act.invobject and act.invobject.components.balloonmaker then            local x,y,z = act.doer.Transform:GetWorldPosition()            local angle = GLOBAL.TheCamera.headingtarget + math.random()*10*degrees-5*degrees            x = x + .5*math.cos(angle)            z = z + .5*math.sin(angle)            act.invobject.components.balloonmaker:MakeBalloon(x,y,z)        end        return true    endend)

OMG!!!They are working!!! THANK YOU!!!!

Link to comment
Share on other sites

You might be right Mobbstar. I read "reason" and thought it meant sanity, i.e. ability to reason.

I whipped up some code that will remove the health damage from popping balloons. Right now this damage avoidance only applies to Wes. In DST, if another character creates the balloon, that balloon will still damage the character who created it, and no balloons will ever damage Wes. It's a simple exercise to make it so the damage avoidance will apply to the character who created the balloon.

AddPrefabPostInit("balloon", function(inst)    local combat = inst.components.combat    local oldIsValidTarget = combat.IsValidTarget    function combat:IsValidTarget(target)        if target.prefab == "wes" then            return false        end        return oldIsValidTarget(combat, target)    endend)
I also ran the code in my first response, and of course it crashed. Here's the code that actually works. When DST comes out, this code will apply the sanity change to any character who creates the ballon, not just Wes. Again, it's a simple exercise if you wish to make this apply only to Wes. Look at data/scripts/actions.lua for the original code.

AddSimPostInit(function()    local degrees = GLOBAL.DEGREES    GLOBAL.ACTIONS.MAKEBALLOON.fn = function(act)        if act.doer and act.invobject and act.invobject.components.balloonmaker then            local x,y,z = act.doer.Transform:GetWorldPosition()            local angle = GLOBAL.TheCamera.headingtarget + math.random()*10*degrees-5*degrees            x = x + .5*math.cos(angle)            z = z + .5*math.sin(angle)            act.invobject.components.balloonmaker:MakeBalloon(x,y,z)        end        return true    endend)

I have a little problem. If I turn on those modes which you wrote to me and RPG HUD, RPG HUD is not working

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...