I'm having an issue with unit-type comparisons

  • Thread starter Thread starter Kitt
  • Start date Start date
K

Kitt

Guest
I'm trying to make it so that if a certain unit casts a custom ability on a custom structure it will summon a dragon, then kill that unit.

i was having some problem with getting it to summon the dragon, but i ran some tests and found all of these lines to work perfectly:

Events
--- Unit - A unit finishes casting an ability

Conditions
--- (Ability Being cast) Equal to Summon Dragon
--- (Unit-type of (Triggering Unit)) Equal to Dragon Summoner

Actions
--- Unit - Create 1 Red Drake for (Triggering Player) at (position of (Triggering unit)) facing Default building facing degrees
--- Unit - Kill (Triggering Unit)

Summon Dragon is a dummy ability i created that does nothing but make an animation and have a delay. Dragon Summoner is just a unit that has the Summon dragon ability. If i leave the trigger as is, i can use the ability on a target and when it finishes a Red Drake is summoned and the Summoner is killed. I've tested it and this works. However i want it to ONLY work when the ability is cast on a certain custom building; However, if i add this line in under conditions, the spell ceases to do any of the actions:

Conditions
--- <above conditions>
--- (Unit type of (Target unit of ability being cast)) Equal to Dragon Portal

Dragon portal is the custom building i want the spell to work on only if it's the target. I'm not sure whats wrong... everything look peachy keen to me, but it refuses to work once i add that line in.

Anyone have any suggestion? Any questions?

Thanks in advance to anyone that offers some advice.

Meow.
 
Code:
Events
--- Unit - A unit finishes casting an ability

Conditions
--- (Ability Being cast) Equal to Summon Dragon
--- (Unit-type of [b](Triggering Unit)[/b]) Equal to Dragon Summoner

Actions
--- Unit - Create 1 Red Drake for [b](Triggering Player)[/b] at (position of [b](Triggering unit)[/b]) facing Default building facing degrees
--- Unit - Kill [b](Triggering Unit)[/b]

In this case Triggering unit should be changed to Casting unit, and Triggering player should be (Owned of (Casting Unit)). There are few cases where you use Triggering unit, as in 'Unit within range' event. Generic unit events usually require 'Casting Unit', 'Hero Manipulating Item' etc. Use Triggering Player when using a Player event, such as Player chat event, or Player property events.
 
You mean like so? I'm testing it now.

Code:
Summon Dragon
    Events
        Unit - A unit Finishes casting an ability
    Conditions
        (Ability being cast) Equal to Summon Dragon 
        (Unit-type of (Casting unit)) Equal to Dragon Summoner
        (Unit-type of (Target unit of ability being cast)) Equal to Dragon Portal (facing southwest)
    Actions
        Unit - Create 1 Red Drake for (Owner of (Casting unit)) at (Position of (Casting unit)) facing Default building facing degrees
        Unit - Kill (Casting unit)
 
Nope, still doesn't summon the dragon. The above code is EXACTLY what i ahve put it. Does anything still look off?
 
Casting Unit and Triggering Unit have no difference. Casting unit just calls the native GetTriggerUnit() anyways, so it's not as efficient. Stick with Triggering Unit.
 
I see... well either way it still doesn't work...

The problem is with this line:

(Unit-type of (Target unit of ability being cast)) Equal to Dragon Portal (facing southwest)

But i'm not sure which half of it =/
If you remove that whole line, the ability works fine, except you can cast it on anything. But, i can't see one thing wrong with that, it feels pretty solid.
 
Perhaps the problem lies in the fact that that line calls the target of the ability being cast, yet the trigger runs when the unit finishes casting the ability?
 
Just tested that, changed it to trigger when the ability starts casting, stillt he same effect.
 
Code:
Casting Unit and Triggering Unit have no difference. Casting unit just calls the native GetTriggerUnit() anyways, so it's not as efficient. Stick with Triggering Unit.

For many triggers you must call upon multiple types of 'Triggering Units'. Although in this case Triggering unit may be more efficient its better to try to use the specific name for less confusion.

Try using "Starts the effect of an ability" Instead of finishes casting, or starts casting. Oh and what base spell is the dummy spell?
 
The base spell is dispell magic. I didn't pay much attention to base spell, i jsut wanted something that targets something else and didn't have to many effects to edit out.
 
Well im not EXACTLY sure on using dispel magic, I would use something like Storm Bolt that targets a specific unit. Not exactly positive that would work but you should try, just a test so u dont even have to edit it all.
 
Well, it seems to be a problem witht he Targeted Unit function. I tryed switching it around, so that the building had an ability (the ability is based of of a fire bolt i think it was called). It shoots a little fire thingy at a selected target. the trigger now looks like this:

Code:
Summon Dragon
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to Summon Dragon 
    Actions
        Unit - Create 1 Red Drake for (Owner of (Triggering unit)) at (Position of (Targeted unit)) facing Default building facing degrees
        Unit - Kill (Targeted unit)

so what it should do is target the unit (a peasent in this case) summong a dragon at it's spot, then kill that unit. However, it does none of these. I tried re-wording it many different ways, but the common part is always the (Targeted unit) bit.
 
Doesn't Dispel magic target an area? If it does, base your spell from unit-targeted abilities, like Frozen Breath or Chaining Bolt, changing its data to be a dummy. Also give a try to Channel ability.

(Sorry for the misspellings, the names can be wrong 'cos I've got a non-english version)
 
Code:
Summon Dragon
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Firebolt (Warlock)
        (Unit-type of (Target unit of ability being cast)) Equal to Green Dragon Roost
    Actions
        Unit - Create 1 Green Dragon for (Owner of (Casting unit)) at (Position of (Casting unit)) facing Default building facing degrees
        Unit - Remove (Casting unit) from the game
I would think something like this should work fine, I still think that using Triggering Unit wouldn't work as well but i dont know JASS either. Try putting something like this in with your own spells and stuff.
 
Well i'll-be-damned, the above worked. Not sure why that is, but it worked, and i'm happy, lol. I'll tinker around with it soem more, see if i can't figure it out, it might be the opting for a remove over a kill. Well, thanks to everyone who contributed!
 
XXconanXXX said:
Casting Unit and Triggering Unit have no difference. Casting unit just calls the native GetTriggerUnit() anyways, so it's not as efficient. Stick with Triggering Unit.
(Casting unit) uses the native GetSpellAbilityUnit, actually... so it actually is better.

Dispel Magic targets an area, not a unit, so there is never a (Target unit of ability being cast) for it.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    we were down for a minute - think a log file or something got too big
    +1
  • Ghan Ghan:
    The alerts say it was down for a while unfortunately.
  • Ghan Ghan:
    Didn't know what was going on while I was at work.
  • Ghan Ghan:
    Disk filled up with logs. Fixed now.
    +1
  • The Helper The Helper:
    not a problem at all thanks for getting us back up
  • The Helper The Helper:
    I think the bots are finding a way to get through the anubis
  • The Helper The Helper:
    Happy Wednesday Everyone! Hope everyone has a Fantastic Day!
    +1
  • The Helper The Helper:
    Yeah, stats are showing big bot influx like 12k page views.
  • Wizard Wizard:
    :wave:
    +1
  • Ghan Ghan:
    TH changed his avatar again. 6 more weeks of summer.
    +3
  • Wizard Wizard:
    lol
    +1
  • The Helper The Helper:
    Guys just a heads up I am going to be shutting the site down soon. I am just waiting on the NUON people to decide whether they want to transfer forum data and keep the discord. My email is [email protected] for anyone that wants to keep in touch and I have a facebook too. I will make an official post later. Love you guys and will miss everyone!
    +1
  • V-SNES V-SNES:
    Sent a pm @The Helper
  • Stephen Stephen:
    Oh no - please don't lose the Nuon content
    +1
  • The Helper The Helper:
    Someone email AtariAge and see if they want me to transfer the forum data over to it
  • Ghan Ghan:
    Could probably keep NUON stuff around here if we wanted.
  • Ghan Ghan:
    Hmm what to do about the World Editor site though?
  • Stephen Stephen:
    I'd rather personally just own a backup of the Nuon data than see it go to AtariAge honestly. If it gets enshittified as per usual, or if some of the "regular" Jaguar folks get there, it's not gonna be fun
  • The Helper The Helper:
    There will be a github of the forum data so the NUON Forum Data I guess would be available there
  • The Helper The Helper:
    World Editor is technically Ryoko stuff not mine you guys can keep that I am not in that even
  • jonas jonas:
    :( end of an era :(
  • The Helper The Helper:
    Dont think of it as an end jonas - think of it as a beginning, because really my friend that is what it is.
  • A Andyoyo:
    Thank you for the hard work over the years. It did not go unnoticed.

The Helper Discord

Members online

No members online now.

Affiliates

Hive Workshop NUON Dome World Editor Tutorials
Back
Top