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

[Trigger] buying abilities and spells

Status
Not open for further replies.
Level 4
Joined
Feb 4, 2008
Messages
82
Hello once again, i have been trying to fix most of the problems here for days but i had no luck so if anyone can help that would be appreciated:

1-
  • Add abilities
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • Unit - Add Sit's Plague (Warlock) to (Triggering unit)
      • Unit - Add Summon Hell Hound (Warlock) to (Triggering unit)
      • Wait 2.00 seconds
      • Unit - Change ownership of Warlock 0006 <gen> to Neutral Passive and Change color
      • Wait 2.00 seconds
      • Game - Display to (All players) the text: You have been given...
      • Item - Remove (Item carried by Paladin1 0015 <gen> in slot 1)
I made that trigger so that the hero will go to a certain doodad (named warlock 0006 here) buy and item (called warlock abilities) that item will give him the spells required to be a warlock and as you can see that trigger works with any item picked (single RPG so no worries about units getting items) i need to add condition to specify the item but i can't find that.

2-
  • Faith
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Faith
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Ownership-changed unit)) Equal to Player 1 (Red)
        • Then - Actions
          • Do nothing
        • Else - Actions
          • Unit - Change ownership of (Target unit of ability being cast) to Player 1 (Red) and Change color
          • Unit - Add a 120.00 second Animate Dead expiration timer to (Target unit of ability being cast)
          • Unit - Change ownership of (Target unit of ability being cast) to Neutral Hostile and Change color
This spell basically will change the allegiance of a unit to the caster to own for 2 mins and then it should return it back to it's former allegiance (the transition of ownership is easy) the problem here is that if i cast this spell i acquire a certain unit but then if i still have a unit and cast that spell again i acquire another unit, is there a way to make it undo that like if i have a unit the spell don't work?

Also is there a way to make the hero unable to summon any units while having one already ?

thank you very much
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
....as you can see that trigger works with any item picked (single RPG so no worries about units getting items) i need to add condition to specify the item but i can't find that.
  • (Item-type of (Item being manipulated)) Equal to YourItemType
Go to "Item-Type Comparison" under "Conditions" and you'll find it...hopefully

For your summoning question, you could use this...
  • Summon Only One
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SummonedUnit[(Player number of (Owner of (Triggering unit)))] Equal to No unit
        • Then - Actions
          • Set SummonedUnit[(Player number of (Owner of (Triggering unit)))] = (Summoned unit)
        • Else - Actions
          • Unit - Kill SummonedUnit[(Player number of (Owner of (Triggering unit)))]
          • Set SummonedUnit[(Player number of (Owner of (Triggering unit)))] = (Summoned unit)
  • Kill Summoned
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Triggering unit) Equal to SummonedUnit[(Player number of (Owner of (Triggering unit)))]
    • Actions
      • Set SummonedUnit[(Player number of (Owner of (Triggering unit)))] = No unit
This trigger lets only 1 summoned unit at a time for a player though...
 
Level 6
Joined
Aug 16, 2007
Messages
213
make it more simple: crate an item that auto aplies to the unit(like runes of healt mana replenishment etc.) tahan trigger:
  • Events:
  • a unit aquaiers an item
  • Conditions:
  • Hero has the item of type (your item that auto apiles to unit) equal to true
  • Actions:
  • add ability ....
  • add ability....
  • do here, what you whant to do
sry im to lame to open WE... so the trigger isnt totaly right(mby)
 
Level 4
Joined
Feb 4, 2008
Messages
82
Works enough with me :) thank you very much, helped alot, just need to know something though, how can someone make units un social (specific units) not all units?
 
Level 4
Joined
Feb 4, 2008
Messages
82
Well i did this summon unit trigger it isn't much but (i had to do it for each level because each two levels summon a different entity) it doesn't work after the summoned unit dies, the variable doesn't change back to 0 dunno why and i can't summon any other units (var = 0 summonable, var = 1 non summonable)
  • Summon creature death var
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Triggering unit) Equal to (Summoned unit)
    • Actions
      • Set Level_Summon_Unit = 0
  • Summon Hell Creature
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Summon Hell Creature (Warlock)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Summon Hell Creature (Warlock) for (Triggering unit)) Equal to 1
          • Summon_Unit Equal to 0
        • Then - Actions
          • Unit - Create 1 Fel Beast for Player 1 (Red) at (Position of (Triggering unit)) facing 0.00 degrees
          • Set Summon_Unit = 1
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Summon Hell Creature (Warlock) for (Triggering unit)) Equal to 2
              • Summon_Unit Equal to 0
            • Then - Actions
              • Unit - Create 1 Fel Beast for Player 1 (Red) at (Position of (Triggering unit)) facing 0.00 degrees
              • Set Summon_Unit = 1
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Summon Hell Creature (Warlock) for (Triggering unit)) Equal to 3
                  • Summon_Unit Equal to 0
                • Then - Actions
                  • Unit - Create 1 Fel Stalker for Player 1 (Red) at (Position of (Triggering unit)) facing 0.00 degrees
                  • Set Summon_Unit = 1
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of Summon Hell Creature (Warlock) for (Triggering unit)) Equal to 4
                      • Summon_Unit Equal to 0
                    • Then - Actions
                      • Unit - Create 1 Fel Stalker for Player 1 (Red) at (Position of (Triggering unit)) facing 0.00 degrees
                      • Set Summon_Unit = 1
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Level of Summon Hell Creature (Warlock) for (Triggering unit)) Equal to 5
                          • Summon_Unit Equal to 0
                        • Then - Actions
                          • Unit - Create 1 Fel Ravager for Player 1 (Red) at (Position of (Triggering unit)) facing 0.00 degrees
                          • Set Summon_Unit = 1
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Level of Summon Hell Creature (Warlock) for (Triggering unit)) Equal to 6
                              • Summon_Unit Equal to 0
                            • Then - Actions
                              • Unit - Create 1 Fel Ravager for Player 1 (Red) at (Position of (Triggering unit)) facing 0.00 degrees
                              • Set Summon_Unit = 1
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Level of Summon Hell Creature (Warlock) for (Triggering unit)) Equal to 7
                                  • Summon_Unit Equal to 0
                                • Then - Actions
                                  • Unit - Create 1 Fel Ravager for Player 1 (Red) at (Position of (Triggering unit)) facing 0.00 degrees
                                  • Set Summon_Unit = 1
                                • Else - Actions
                                  • Game - Display to (All players) for 10.00 seconds the text: |c00FFFF00Hint|r --...
                                  • Do nothing
can anyone tell me what i did wrong please ?
 
Level 7
Joined
Dec 8, 2005
Messages
319
dont use the level of units. use a custom value. using lvl of units is unneccary and dont think you could have a lvl 0 unit. and just a silly question. why dont use just use the ability. summon wolf? and take off the duration. seems like you are just trying to use code for a spell that is already made for you.
 
Level 4
Joined
Feb 4, 2008
Messages
82
ohhhhhhhh, i didn't realize that there existed an option in object editor that allow you summon multiple units depending on levels lol, thank you guys very much ... :D
 
Level 3
Joined
Feb 28, 2008
Messages
31
2-
  • Faith
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Faith
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Ownership-changed unit)) Equal to Player 1 (Red)
        • Then - Actions
          • Do nothing
        • Else - Actions
          • Unit - Change ownership of (Target unit of ability being cast) to Player 1 (Red) and Change color
          • Unit - Add a 120.00 second Animate Dead expiration timer to (Target unit of ability being cast)
          • Unit - Change ownership of (Target unit of ability being cast) to Neutral Hostile and Change color
This spell basically will change the allegiance of a unit to the caster to own for 2 mins and then it should return it back to it's former allegiance (the transition of ownership is easy) the problem here is that if i cast this spell i acquire a certain unit but then if i still have a unit and cast that spell again i acquire another unit, is there a way to make it undo that like if i have a unit the spell don't work?
This would Change ownership of the unit to Red, apply timed life and return ownership. That would just make the target a creep regardless of allegiance and kill it in 1 minutes.
Try this:
  • Faith
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Faith
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Ownership-changed unit)) Equal to Player 1 (Red)
        • Then - Actions
          • Do nothing
        • Else - Actions
          • Unit - Change ownership of (Target unit of ability being cast) to Player 1 (Red) and Change color
          • Unit - Add a 120.10 second Animate Dead expiration timer to (Target unit of ability being cast)
          • Wait 120.00 game-time seconds
          • Unit - Pause the expiration timer for (Target unit of ability being cast)
          • Unit - Change ownership of (Target unit of ability being cast) to Neutral Hostile and Change color
Can't change the Neutral Hostile bit without taking away the MUI.
 
Level 4
Joined
Feb 4, 2008
Messages
82
w000ty thanks alot :D that was what i am missing *dances* i encountered later another problems thought, that the cooldown i made for the spell doesn't work anymore after i made that code like you told me..

Anyway i can add a trigger to enforce a cooldown or make a spell disabled ?
 
Status
Not open for further replies.
Top