Some annoying problems with a spell

shinami

Redirect your complaints to the nearest wall
Reaction score
47
So here are the 3 triggers with a spell that are making me confused.

Code:
Illusion cast
    Events
        Unit - A unit Begins channeling an ability
    Conditions
        (Ability being cast) Equal to (==) Illusions 
    Actions
        Set TriggeringUnit = (Triggering unit)
        Set UnitPointVariable[0] = (Position of (Triggering unit))
        Set OwnedUnit = (Owner of (Triggering unit))
        Trigger - Turn on Periodic Illusion <gen>
        Wait 10.00 seconds
        Trigger - Turn off Periodic Illusion <gen>

Code:
Periodic Illusion
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        Unit - Create 1 Dummy for OwnedUnit at UnitPointVariable[0] facing UnitPointVariable[0]
        Unit - Add Item Illusions to (Last created unit)
        Unit - Set mana of TriggeringUnit to ((Mana of TriggeringUnit) - 300.00)
        Custom script:   call IssueTargetOrderById(bj_lastCreatedUnit, 852274, udg_TriggeringUnit)
         Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Mana of TriggeringUnit) Less than (<) 300.00
            Then - Actions
                Trigger - Turn off (This trigger)
                Unit - Order TriggeringUnit to Stop
            Else - Actions
        Custom script:   call RemoveLocation(udg_UnitPointVariable[0])

Code:
Stop Illusion
    Events
        Unit - A unit Stops casting an ability
    Conditions
        (Ability being cast) Equal to (==) Illusions 
    Actions
        Trigger - Turn off Periodic Illusion <gen>

So what this spell does is creates illusions every second for the cost of 300 mp. So first problem. My hero has 750 mp, and somehow he is only able to produce just one illusion, before his mp goes down to 150. How can i fix this?

Second problem.

Even if the hero has 1 mp, it will still produce an illusion, so all you have to do to abuse this is keep clicking the spell and you've got a billion of clones. My guess is i have to put on a condition somewhere that checkes if the unit has more or equal to 300, and if he doesn't cancel the effect, but i'm not sure so i want some advice.

I think thats it for the problems, i might encounter some more. +rep for help.

P.S Thanks to AceHart for the custom script that casts item illusions.
 

Exide

I am amazingly focused right now!
Reaction score
448
Add a condition to your Periodic trigger:
Code:
(Mana of TriggeringUnit) Greater than or equal to 300.00

-If the Hero has less mana, the trigger won't run, and no illusions will be spawned.
 

shinami

Redirect your complaints to the nearest wall
Reaction score
47
Add a condition to your Periodic trigger:
Code:
(Mana of TriggeringUnit) Greater than or equal to 300.00

-If the Hero has less mana, the trigger won't run, and no illusions will be spawned.

Well that was simple, thanks, +rep. Anyone has ideas about the first problem?
 

Exide

I am amazingly focused right now!
Reaction score
448
Your first problem doesn't make sense. -Since the trigger states that only 300 mana is drained per second.
Unless, somehow, your Hero is stuck in the trigger twice..

Also, this seems pretty useless:
Code:
    Set OwnedUnit = (Owner of (Triggering unit))
 

shinami

Redirect your complaints to the nearest wall
Reaction score
47
Your first problem doesn't make sense. -Since the trigger states that only 300 mana is drained per second.
Unless, somehow, your Hero is stuck in the trigger twice..

Also, this seems pretty useless:
Code:
    Set OwnedUnit = (Owner of (Triggering unit))

Yes, it was, i did it because before doing the spell, i thought of an "imaginary" problem.

Anyway. I attached the map so You, or someone else who is experienced could take a look at this strange problem. ( Requires NewGen ^_^ )
 

Attachments

  • Map of Tests.w3x
    273.1 KB · Views: 77

emootootoo

Top Banana
Reaction score
51
You are setting a point variable when you cast the spell.

Then after the first time the periodic trigger goes off, you remove it. So next time it runs, there is no point. So it is not creating the dummy where you desire it to be.
 

shinami

Redirect your complaints to the nearest wall
Reaction score
47
You are setting a point variable when you cast the spell.

Then after the first time the periodic trigger goes off, you remove it. So next time it runs, there is no point. So it is not creating the dummy where you desire it to be.

The second time it runs, the Illusion cast goes off which once again sets the variable... Well atleast i think thats how it is.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,497
> The second time it runs, the Illusion cast goes off

Why would it?
That would mean the dummy casts the very same ability as your Hero... which 1. isn't possible here, 2. would lead to much bigger problems.


> making me confused

Understandable.
You have a variable with "variable" in the name... it's an array for no good reason.
There's a variable called "OwnedUnit" that is actually a player...

> Trigger - Turn off (This trigger)

The "stop" is already doing that.
 

shinami

Redirect your complaints to the nearest wall
Reaction score
47
Not sure, maybe i said it wrong that you misunderstood it, but this is what i meant.

First time casting, runs the illusion cast trigger and setting the variable and then activates periodic trigger, removing the variable.

So in my logic, the second time i cast it the it goes into the same cycle. Illusion cast goes off, variable setted, periodic goes off , variable removed.

EDIT: There is a reason for the array.

One of your point is right, not sure why did i do the turning off. Ah yes i remember, the time i did the turn off trigger, i still haven't done the stop illusion trigger, so i did it for testing purposes, but when i did the stop trigger, i just forgot to remove it ^_^

Also the variable in the name doesn't do any harm.. Its just a name.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,497
> the second time i cast it the it goes into the same cycle

Well, yes.
Assuming you actually cast it.

Channeling, which this seems to be doing, only happens once though.
It's not continuously re-casting the spell while channeling. Otherwise this would fail miserably...
 

shinami

Redirect your complaints to the nearest wall
Reaction score
47
> the second time i cast it the it goes into the same cycle

Well, yes.
Assuming you actually cast it.

Channeling, which this seems to be doing, only happens once though.
It's not continuously re-casting the spell while channeling. Otherwise this would fail miserably...

Logical, yet the only failure so far i have here, or see here is my first problem of the spell. Also this spell is still not finished.

Also: OwnedUnit, well i know that its a player, this is not a spell for submission, OwnedUnit might not make sense to some people, but for me it does ^_^
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,497
Well, we could sit around here and argue about the weather or so, or you simply go and try to see what happens if you don't remove the point on every cast but only in the end instead.
Your going to try is presumably more productive.
 

shinami

Redirect your complaints to the nearest wall
Reaction score
47
Well, we could sit around here and argue about the weather or so, or you simply go and try to see what happens if you don't remove the point on every cast but only in the end instead.
Your going to try is presumably more productive.


The weather sucks. Anyway, that helped and the reason i didn't do it earlier because i didn't quite understand what you meant by in the end. Anyway i tried removing the variable removing and it works..

So now, by the end do you mean on the triggers Illusion Cast end?
 

emootootoo

Top Banana
Reaction score
51
You've had the answer to your problem since post #6... and then AceHart further explained it, and you still don't understand?

The reason it did not work is you were only creating the point once, when you began casting your heroe's ability.

So don't destroy the point until the ability is completely finished.

At the moment you are destroying it after the first illusion is created, and continue channeling.

(if you understood it, why would you need to ask that question?)
 

shinami

Redirect your complaints to the nearest wall
Reaction score
47
You've had the answer to your problem since post #6... and then AceHart further explained it, and you still don't understand?

The reason it did not work is you were only creating the point once, when you began casting your heroe's ability.

So don't destroy the point until the ability is completely finished.

At the moment you are destroying it after the first illusion is created, and continue channeling.

I understand it...

"At the end of illusion cast" was what i said. It was just a question to make sure, not other words to say " duuhhh i still not knows"
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top