Life and Mana drain/give wont work, please help.

Discussion in 'World Editor Help' started by Naruto[Leaf], May 8, 2006.

  1. Naruto[Leaf]

    Naruto[Leaf] Guest

    I've created a life drain that can suck life and mana from enemy units and give to user, at the same time, if targeted an ally, it should do the opposite. Here's my code. It looks like it would work but, it wont. Please help. Move is called Soul Transfer, based off of channel. Thx

    Here's the initializer
    Code:
    Soul Transfer
        Events
            Unit - A unit Begins channeling an ability
        Conditions
            (Ability being cast) Equal to Soul Transfer 
        Actions
            Set SoulBearer = (Triggering unit)
            Set SoulLocation = (Position of SoulBearer)
            Set SoulTarget = (Target unit of ability being cast)
            Unit - Create 1 caster for (Owner of SoulBearer) at (Position of SoulBearer) facing Default building facing (270.0) degrees
            Set Buffaddon = (Last created unit)
            Unit - Order Buffaddon to Human Sorceress - Slow SoulTarget
            Unit - Remove Buffaddon from the game
            If ((Level of Soul Transfer  for (Triggering unit)) Equal to 1) then do (Set UnitLife = 25.00) else do (Do nothing)
            If ((Level of Soul Transfer  for (Triggering unit)) Equal to 2) then do (Set UnitLife = 50.00) else do (Do nothing)
            If ((Level of Soul Transfer  for (Triggering unit)) Equal to 3) then do (Set UnitLife = 75.00) else do (Do nothing)
            If ((Level of Soul Transfer  for (Triggering unit)) Equal to 4) then do (Set UnitLife = 100.00) else do (Do nothing)
            Trigger - Turn on Health and Mana <gen>
            Trigger - Turn on Cancel <gen>
    
    Here's the Triggers that cause the leech and cancel.
    Code:
    Health and Mana
        Events
            Time - Elapsed game time is 1.00 seconds
        Conditions
        Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                If - Conditions
                    (SoulTarget belongs to an ally of (Owner of SoulBearer)) Equal to True
                Then - Actions
                    Unit - Set life of SoulTarget to ((Life of SoulTarget) + UnitLife)
                    Unit - Set mana of SoulTarget to ((Life of SoulTarget) + UnitLife)
                    Unit - Order SoulBearer to damage SoulBearer for UnitLife using attack type Normal and damage type Normal.
                    Unit - Set mana of SoulBearer to ((Life of SoulTarget) - UnitLife)
                Else - Actions
                    Unit - Set life of SoulBearer to ((Life of SoulTarget) + UnitLife)
                    Unit - Order SoulBearer to damage SoulTarget for UnitLife using attack type Normal and damage type Normal.
                    Unit - Set mana of SoulTarget to ((Life of SoulTarget) + UnitLife)
    
    Code:
    Cancel
        Events
            Time - Every 0.50 seconds of game time
        Conditions
        Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                If - Conditions
                    ((SoulTarget has buff Soul Transfer ) Equal to False) or ((Is SoulBearer near SoulLocation and within a range of 5.00) Equal to False)
                Then - Actions
                    Unit - Remove Soul Transfer  buff from SoulTarget
                    Trigger - Turn off Health and Mana <gen>
                Else - Actions
    
    Hope you can fix this, thx in advance.

    Oops, caught one problem, elapsed game time, should be Periodic, that still doesnt solve the buff casting tho :/
  2. Sim

    Sim Forum Administrator Staff Member

    > Time - Elapsed game time is 1.00 seconds

    That will not work. Wrong event. (Second Trigger)

    > Unit - A unit Begins channeling an ability

    You'd prefer using "Starts the Effect of an Ability" or "Begins Casting an Ability"

    > Unit - Order Buffaddon to Human Sorceress - Slow SoulTarget
    > Unit - Remove Buffaddon from the game

    Add an expiration Timer of 2 seconds instead because at this state the unit doesn't even have time to cast the spell that it is removed.

    > Set life of SoulBearer to ((Life of SoulTarget) + UnitLife)

    that will be messed up. if your unit has 700 hp and the enemy has 300, you will have 300 + UnitLife (What is UnitLife BTW ?)

    > Then - Actions
    > Unit - Set life of SoulTarget to ((Life of SoulTarget) + UnitLife)
    > Unit - Set mana of SoulTarget to ((Life of SoulTarget) + UnitLife)
    > Unit - Order SoulBearer to damage SoulBearer for UnitLife using attack type Normal and damage type Normal.
    > Unit - Set mana of SoulBearer to ((Life of SoulTarget) - UnitLife)
    > Else - Actions
    > Unit - Set life of SoulBearer to ((Life of SoulTarget) + UnitLife)
    > Unit - Order SoulBearer to damage SoulTarget for UnitLife using attack type Normal and damage type Normal.
    > Unit - Set mana of SoulTarget to ((Life of SoulTarget) + UnitLife)


    Don't you think the Else Actions and Then Actions are the same ?

    > If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    > If - Conditions
    > ((SoulTarget has buff Soul Transfer ) Equal to False) or ((Is SoulBearer near SoulLocation and within a range of 5.00) Equal to False)
    > Then - Actions
    > Unit - Remove Soul Transfer buff from SoulTarget
    > Trigger - Turn off Health and Mana <gen>
    > Else - Actions

    Okay.. that's all messed up.

    First : "Is SoulBearer near SoulLocation" ... Well translated it means : "Is (triggering unit) near (Position of (Triggering Unit))" ... That will certainly be True. It can't be false. Every unit is near its own position.

    Second :If the unit *DOESN'T* have the buff, then you *REMOVE* it ?? stupid, it already doesn't have it !

    Third : Add Do Nothing in the Else Actions.

    There may be more mistakes but I need to know what is UnitLife (the variable)
  3. Duwenbasden

    Duwenbasden Ver 6 CREATE energy AS SELECT * FROM u.energy

    Doesn't Siphon Mana already do this...
  4. Sim

    Sim Forum Administrator Staff Member

    That's what I'm trying to tell everybody. Use the Drain Life ability and somewhere in the Data Fields you will see : Data - Life Transfered. Use THIS
  5. Zakyath

    Zakyath Member

    Set SoulBearer = (Triggering unit)

    There is no triggering unit. Casting.
  6. danhel

    danhel Guest

    Triggering unit refers to the object that causes the trigger.
  7. Sim

    Sim Forum Administrator Staff Member

    > Set SoulBearer = (Triggering unit)
    >
    > There is no triggering unit. Casting.

    (Triggering Unit) is not always the right unit or sometimes is not even the unit triggering the Actions, but in the (Casting Unit) case it is supposed to work. I never use Casting Unit and my spells work just fine ^^
  8. Defi4nc3

    Defi4nc3 Developer of DORPG

    I don't really see the use for 3 triggers when you can simply put it into One?
  9. Naruto[Leaf]

    Naruto[Leaf] Guest

    Meh, I heard siphon doesn't let u target allies lol so i didn't bother, btw, thx malto anyway, i corrected all the stuff i messed up on lol, my internet was down and i wasn't able to post that i fixed it, u pwn tho.

    Btw malto read the thing bout , if unit is near its position, that/s the position that was set on first trigger, so if it moves away from that point, it will null the effect, and if the buff isn't already removed, be removed.
  10. Sim

    Sim Forum Administrator Staff Member

    Oh yea forgot that Drain Life you weren't supposed to move :p

    Don't bother with this correction.

    I'm Glad that it works !! :D

Share This Page