casting only out of battle

  • Thread starter Thread starter polymorph
  • Start date Start date
P

polymorph

Guest
does anyone know how to make it so that you can only use an ability when you're not in combat

thanks~

POLYMORPH ROCKSSSS SHEEP
 
how do you want to detect it? you can check for enemy units around you, or if youve taken damage recently...
 
Enemy units in the area would probably work best. In which case the trigger would be something like:

Code:
NonCombat Ability
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to (Your Ability)
        (Number of units in (Units within (Your Distance) of (Position of (Casting unit)) matching (((Owner of (Matching unit)) is an enemy of (Owner of (Casting unit))) Equal to True))) Equal to 0
    Actions
        Unit - Order (Casting unit) to Stop

Edit: I finished writing this and you had just posted. Never mind.
 
Code:
        (Number of units in (Units within (Your Distance) of (Position of (Casting unit)) matching (((Matching player) is an enemy of (Owner of (Casting unit))) Equal to True))) Equal to 0

i got a question i looked through the functions and the closest one i found for that code was the integer comparison. but it doesn't have the matching player part of the code below

(((Matching player) is an enemy of (Owner of (Casting unit))) Equal to True))) Equal to 0
 
The way you get to that is:

Number of Units in (Unit Group) Equal to 0

Then Unit Group is:

All units in Range matching Condition. Range is the blank, Condition is a boolean comparison. That boolean comparison looks like:

(Player is an Enemy of Player) is True

The first Player is (Owner of (Matching Unit)), the second is (Owner of (Casting Unit).

In the original I had Matching Player, it shoulde be (Owner of (Matching Unit)).

Hope that helps you find it.
 
i did exactly that and it didn't work i have no idea why it dind't work

Code:
out of combat

events
unit - a unit begins casting an ability

conditions
(ability being cast) equal to stealth
number of units in (units within 500.00 of (position of (casting unit)) matching (((matching player) is an enemy of owner of (casting unit))) equal to true ))) equal to 0

actions
unit - order (casting unit) to stop

i was just testing if it worked but it didn't so if anyone could help or it would be better if you helped with the other trigger instead the one where how long has it been since you last took dmg
 
Your condition is backwards. The way you have it, you can only cast it if people are around. Change the "equal to" to "not equal to".
 
hmm...i did that and it didn't work also i think the problem is even if i do it manually when i try to cast a spell with casting time i click the stop button yet it still casts :O

edit: nevermind!! i pressed S and it was both skill and stop hotkeys were at S but yea i tried stoping and it worked but the trigger still doesn't work! :banghead:
 
try instead of stopping the unit and stunning it for a short time, like it tried to stealth but it didin't fool the enemies so they attackked him anyway. would also probably work better than order - stop.
 
i just tried that too and it still didn't work
can anyone test out the map out and see whats wrong?

thanks

polymorph
 

Attachments

Hmm... I think I know the problem, but I don't know how to fix it. The problem is that the command Stop doesn't cancel Wind Walk. It applies only to movement. If there is a way to cancel the ability, it should work with this trigger, and you could then refund mana if you wanted to. But I don't know what would cancel it.

Wait! You could probably use Remove Specific Buff for this. I'll try it.

Code:
out of combat
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Wind Walk
        (Number of units in (Units within 500.00 of (Position of (Casting unit)) matching (((Owner of (Matching unit)) is an enemy of (Owner of (Casting unit))) Equal to True))) Not equal to 0
    Actions
        Wait 0.60 seconds
        Unit - Remove Wind Walk buff from (Casting unit)

This trigger works. You can add an additional action to refund mana if you want. That wait 0.60 seconds is important. That is the transition time from normal to Wind Walk according to the ability editor. After 0.60 seconds the Buff is added to the unit, and then it is removed by the trigger.
 
how do you add mana to your current mana pool

theres a function that could set the mana but not add but i think it has something to do with arithmetic but i don't know how to do

current mana+75
 
Why not make the ability controled by an upgrade? If the upgrade isn't available, the ability can't be casted.
 
-_-;; >< how do you do that? i really wish i know how to do this stuff
 
I don't think you have to. I believe this solution is far simpler. To refund the mana, simply add the action:

Unit - Set mana of (Casting unit) to ((Mana of (Casting unit)) + 75.00)

Simple. And now you can't cast Wind Walk if there are any enemies within 500 units of your Hero.
 
Duwenbasden said:
Why not make the ability controled by an upgrade? If the upgrade isn't available, the ability can't be casted.
You can't "un-upgrade" upgrades, that's why.
 
You can remove the ability from the unit when is under attack.
Then add the ability again after a while.
Something like
Code:
Events
    A unit is attacked
Conditions
    (Level of (Your ability) from (Event response - Attacked unit)) greater than 0
Actions
    Custom script - (local unit udg_Caster)
    Custom script - (local integer udg_Level)
    Set (Caster) = (Event response - Attacked unit)
    Set (Level) = (Level of (Your ability) from (Caster))
    Remove (Your ability) from (Caster)
    Wait <Whatever> playing time
    Add (Your ability) to (Caster)
    Set level of (Your ability) from (Caster) to (Level)
You need two dummy vars.
A unit var called Caster and a integer one called Level.

Hope this helps
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    Wow - the change in the stats are major. I kind of knew it was all bots but wow, to see the effect. Why the social media sites cant do something like this I have no idea.
  • Ghan Ghan:
    Probably inflates their numbers so they look better to advertisers.
  • The Helper The Helper:
    Yeah google does not filter those bots. I remember when Apex was doing Google ads I saw the same IPs in there as I was seeing here - google is totally tracking all those bots as traffic and most google traffic, at least ours, was all bots
  • The Helper The Helper:
    oh wow, i bet i can post x links now and do the webp pics now giggity
  • The Helper The Helper:
    ahh anubis blocks anyone that has javascript turned off
  • The Helper The Helper:
    Robot: HTTP client library - i love the new robot :)
  • The Helper The Helper:
    New Science News Forum and it starts out with 420 threads :)
  • The Helper The Helper:
    Technical Support forum name changed To Technology News, there is now a Tech, sci/tech and science forums now :)
  • The Helper The Helper:
    Happy Saturday! Hope everyone has a fantastic weekend!
  • Ghan Ghan:
    We are now on Ubuntu 24.04. Had some issues with the style after the OS/PHP upgrade but now resolved.
    +1
  • Ghan Ghan:
    PHP 8.3 now live
    +1
  • The Helper The Helper:
    Weekend went by too fast. Next weekend I am going to try to do a nature thing - buddy of mine lives by the Colorado river and has some kayaks and invited me to do some kayaking from a place he knows to get on the river.
  • Ghan Ghan:
    That sounds like an adventure.
  • The Helper The Helper:
    400 users all online all looking at latest content
  • The Helper The Helper:
    I wonder how all these bots that sit on the lastest content page get passed anubis or maybe they did not but they are just registering on whos online
  • The Helper The Helper:
    showing up on whos online not registration
  • Ghan Ghan:
    The first gate is stopping all the bots that don't execute javascript.
  • Ghan Ghan:
    That's the main thing with Anubis - no Javascript, no site. Typically you can still get the site to load without Javascript.
  • The Helper The Helper:
    I remember the whole javascript thing, question - how many real people disable that?
  • The Helper The Helper:
    Hell I guess I could go back on the stats to know that - we probably capture that and we know the before and after
  • Ghan Ghan:
    Real users can't really disable Javascript anymore these days.
  • Ghan Ghan:
    The internet is broken without it.
  • Ghan Ghan:
    Bot readable, not human usable.
  • The Helper The Helper:
    got it
  • The Helper The Helper:
    Happy Thursday!

The Helper Discord

Staff online

Members online

Affiliates

Hive Workshop NUON Dome World Editor Tutorials
Back
Top