• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

My first trigger, HELP

Status
Not open for further replies.
Level 2
Joined
Jan 17, 2013
Messages
21
Hey guys,

So i have never really made triggers before now and i would like to create custom spell for my map which will effectively turn the spirit link spell into a spirit link and +5 armor spell.

I have received some advice but it was not instructive enough so i am currently stuck.

This is that advice:
Its been a long time since ive even had wc3 installed but a trigger something along the lines of

Event -

*Spell is cast*

Condition -

Spell == *Spellname*

Action -

Select all units affected by the buff of the casted spell.
- For each unit
--Remove Buff created by spell - Stops re-running on units if the spell is cast twice while under the effect.
--Add +5 armour buff.
--Wait *30 Seconds* (or whatever)
--Remove +5 Armour buff.

--------------------------------------------------------------
Id suggest using a dummy buff - and probably a secondary one as well since your trying a spirit link style thing.

The first two bits i got ok, but selecting the units im not sure i've done right. i have "selection select target of ability being cast". I assume that this will only select the actual target and not the bounce affected units?

I found an option to remove the buff, but not add a new one?

Any help is much appreciated. I realise i may be throwing myself in deeper than is wise for a nub but i am editing a specific map and i want to do things which work within that map! :)

Thanks!
 

Kusanagi Kuro

Hosted Project: SC
Level 10
Joined
Mar 11, 2012
Messages
708
U are right that Target of ability being cast will only be the first target. Therefore, u must create a triggered bouncing ability. Instead of using wait, add and remove ability, try to create a custom spell that is based on Inner Fire and has 30s duration and give it to the dummy then order the dummy to cast the spell on every units that are affected by ur spell. I cant type the trigger since my WE is crashed and I need to re-install wc3.
 
Level 23
Joined
Oct 20, 2012
Messages
3,075
I dunno if I can be of much help here coz I'm still a newbie myself and I kinda don't get your spell.. but your trigger could be like this:

  • Spell Trigger
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to [B]*Name of Your Spell*[/B]
    • Actions
      • Set unitgroup = (Units in (Playable map area) matching (((Picked unit) has buff [B]*your first spell buff here*[/B]) Equal to True))
      • Unit Group - Pick every unit in unitgroup and do (Actions)
        • Loop - Actions
          • Unit - Remove [B]*your first spell buff here*[/B] buff from (Picked unit)
          • Unit - Create 1 [B]*Dummy unit that casts the spell that adds armor buff*[/B] for (Owner of (Triggering unit)) at point facing Default building facing degrees
          • Unit - Order (Last created unit) to [B]*armor adding spell*[/B] (Picked unit)
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation(udg_point)
      • Unit Group - Pick every unit in unitgroup and do (Actions)
    • Loop - Actions
      • Unit Group - Remove (Picked unit) from unitgroup
pick every unit is what he/she means by select all..
and the second pick every unit could be like this
  • Custom script: call DestroyGroup(udg_unitgroup)
but this will only be used if your unit group will only be used one time the entire game so it's not really useful here
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
Units only leak about 40 bytes, so I woudn't worry about that too much.
It is nothing to do with the memory leaked, it is to do with the engine resources leaked.

A process that allocates 4 GB of memory (maximum 32 bit process allocation) will still perform as fast as a process that allocates 4 MB of memory if the active set is the same 4 MB.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
erm how exactly do you only use one dummy or recycle??

A dummy having all these field settings can cast the spell instantaneously without you having multiple of dummy casting per unit;
Art - Animation - Cast Backswing: 0.00
Art - Animation - Cast Point: 0.00
Movement - Speed Base: 0

Here's a test map, showing you that only single dummy is needed to cast Banish spell to all units in that test map.
Press ESC to begin.

WARNING: Only spells that have instant effect would work. Spells such as Summoning/Channeling/Delay won't work.
 

Attachments

  • Dummy Caster.w3x
    12.9 KB · Views: 60

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
You use "green coding" techniques on the dummies. This is usally a pool of dummies that you re-use. When you need a dummy you call a function to fetch it from the pool (or it creates on if pool is empty). When you need to get rid of the dummy you call a function that adds it to the pool (or removes it if the pool is too large). This works since dummies needed for most spells require the same functionality (no art, instant casting).

In most cases you may find that 2-3 dummies in the pool will suffice for 90% of the time. Spike dummy loads may pull this number considerably larger and occur infrequently.
 
Level 2
Joined
Jan 17, 2013
Messages
21
This is a one off custom spell.. i don't need a dummy for anything else currently. So will this work?

  • Earthlink
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to [B]Earthlink[/B]
    • Actions
      • Set unitgroup = (Units in (Playable map area) matching (((Picked unit) has buff [B]Earthlink[/B]) Equal to True))
      • Unit - Create 1 [B]EarlinkDummy[/B] for (Owner of (Triggering unit)) at point facing Default building facing degrees
      • Unit Group - Pick every unit in unitgroup and do (Actions)
      • Loop - Actions
        • Unit - Order (Last created unit) to [B]EarthlinkArmorComp[/B] (Picked unit)
        • Custom script: call RemoveLocation(udg_point)
        • Unit - Remove (last created unit) from the game
        • Unit Group - Pick every unit in unitgroup and do (Actions)
        • Loop - Actions
        • Unit Group - Remove (Picked unit) from unitgroup

I'm very new to triggers and really have a very bad understanding of how they work functionally. But i was aiming to use the same dummy by creating it first and them removing it after?

Also i cannot currently create the trigger from this model as the editor will only let me set
  • Unit - order last created unit to cast ***** on picked unit
as a preset ability rather than my custom ability. I can set it to Priest - inner fire.. but that doesnt really help because then the units also get the +10% attack...

Thanks for all the help so far... this is one of the last things i have to complete to release my map and i have been putting it off because its been so difficult :(
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
This is a one off custom spell.. i don't need a dummy for anything else currently. So will this work?

  • Earthlink
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to [B]Earthlink[/B]
    • Actions
      • Set unitgroup = (Units in (Playable map area) matching (((Picked unit) has buff [B]Earthlink[/B]) Equal to True))
      • Unit - Create 1 [B]EarlinkDummy[/B] for (Owner of (Triggering unit)) at point facing Default building facing degrees
      • Unit Group - Pick every unit in unitgroup and do (Actions)
      • Loop - Actions
        • Unit - Order (Last created unit) to [B]EarthlinkArmorComp[/B] (Picked unit)
        • Custom script: call RemoveLocation(udg_point)
        • Unit - Remove (last created unit) from the game
        • Unit Group - Pick every unit in unitgroup and do (Actions)
        • Loop - Actions
        • Unit Group - Remove (Picked unit) from unitgroup

I'm very new to triggers and really have a very bad understanding of how they work functionally. But i was aiming to use the same dummy by creating it first and them removing it after?

Also i cannot currently create the trigger from this model as the editor will only let me set
  • Unit - order last created unit to cast ***** on picked unit
as a preset ability rather than my custom ability. I can set it to Priest - inner fire.. but that doesnt really help because then the units also get the +10% attack...

Thanks for all the help so far... this is one of the last things i have to complete to release my map and i have been putting it off because its been so difficult :(

Actually the "Priest - Inner Fire" is not a specific ability in this case. It is any ability with "innerfire" as order string.
 
Level 2
Joined
Jan 17, 2013
Messages
21
ahhh thanks!

So will it work? and does it use the same dummy?



(sorry so clueless)
 
Status
Not open for further replies.
Top