• 🏆 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!

[Solved] Help with trigger!

Status
Not open for further replies.
Level 4
Joined
Aug 31, 2011
Messages
88
Hi guys,

I have one problem with this trigger, how to make it mui?

Trigger explanation: When u research research named "Afterlife" all of triggering players "Witches" should transform into "Banshess", but now it transforms all witches on the map into banshees, not just the triggering players...

Need some help pls :(


  • Banshees
    • Events
      • Unit - A unit Finishes research
    • Conditions
      • (Researched tech-type) Equal to Afterlife
    • Actions
      • Set banshees = (Units of type Witch)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
          • Unit Group - Pick every unit in banshees and do (Actions)
            • Loop - Actions
              • Unit - Replace (Picked unit) with a Banshee (forsaken) using The new unit's default life and mana
          • Custom script: call DestroyGroup (udg_banshees)
        • Else - Actions
 
Level 3
Joined
May 12, 2015
Messages
32
  • Banshees
    • Events
      • Unit - A unit Finishes research
    • Conditions
      • (Researched tech-type) Equal to Afterlife
    • Actions
      • Set banshees = (Units owned by (Triggering player) of type Witch)
      • Unit Group - Pick every unit in banshees and do (Actions)
        • Loop - Actions
          • Unit - Replace (Picked unit) with a Banshee (forsaken) using The new unit's default life and mana
      • Custom script: call DestroyGroup (udg_banshees)
 
Level 4
Joined
Aug 31, 2011
Messages
88
Thank you for help guys!

@MyPad Isn't this "Custom Script: set bj_wantDestroyGroup = true" same as this "Custom script: call DestroyGroup (udg_banshees)" ?
 
Hm, but Rheiko's suggestion does sound good, too, maybe even more elegant. Maybe not very important for you in this specific case, but usually it might be not prefered if units are removed and re-placed with a new creation. If the unit morphs, or changes form with maybe an other ability, then references to units get not lost, and handle id does not change (maybe important for hashtable entries).
 
Level 4
Joined
Aug 31, 2011
Messages
88
Totally forgot about Berseker Upgrade until Rheiko mentioned it, but for now this trigger works properly and it will, until I try to do and insert more complicated things into my map (hashtables for example), since I am just grasping and learning the basics of triggering (best things I can do for now are arrays and very simple systems).

But thanks for your tips IcemanBo :D
 
Thank you for help guys!

@MyPad Isn't this "Custom Script: set bj_wantDestroyGroup = true" same as this "Custom script: call DestroyGroup (udg_banshees)" ?

As to how I initially interpreted it...

No, the keyword is not the same. You use the "set" keyword when assigning variables and "call" when calling functions in JASS.

Example:

Code:
// Pseudocode
// This is a variable
real someVar = 0

// This is a function
function newVar(real r)
    set someVar = r

...

function foo()
    // We're assigning the variable directly to a value
    set someVar = 2.5

    // We're calling a function, so we use the "call" keyword.
    call newVar(2.5)


When I re-read the message...

Operationally, in-game, behavior would be identical.


After reading the rest...

Tried that trick, which somehow did not really suit me. Personal Preference. Best of wishes in your journey to triggering!
 
Level 4
Joined
Aug 31, 2011
Messages
88
Funny explanation haha, but yeah I will just stick to the function calls.

Thank you m8, best wishes 2u2! :D
 
Status
Not open for further replies.
Top