1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  4. Dismiss Notice
  5. The Highway to Hell has been laid open. Come along and participate in the 5th Special Effect Contest.
    Dismiss Notice
  6. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Trigger] buying abilities and spells

Discussion in 'Triggers & Scripts' started by Nodrek, Feb 29, 2008.

  1. Nodrek

    Nodrek

    Joined:
    Feb 4, 2008
    Messages:
    82
    Resources:
    0
    Resources:
    0
    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
     
  2. watermelon_1234

    watermelon_1234

    Joined:
    Nov 18, 2007
    Messages:
    1,066
    Resources:
    10
    Spells:
    9
    JASS:
    1
    Resources:
    10
    • (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...
     
  3. Nodrek

    Nodrek

    Joined:
    Feb 4, 2008
    Messages:
    82
    Resources:
    0
    Resources:
    0
    Gonna try that, thank you very much for the help :D
     
  4. Global_idiot

    Global_idiot

    Joined:
    Aug 16, 2007
    Messages:
    212
    Resources:
    0
    Resources:
    0
    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)
     
  5. Nodrek

    Nodrek

    Joined:
    Feb 4, 2008
    Messages:
    82
    Resources:
    0
    Resources:
    0
    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?
     
  6. Nodrek

    Nodrek

    Joined:
    Feb 4, 2008
    Messages:
    82
    Resources:
    0
    Resources:
    0
    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 ?
     
  7. Global_idiot

    Global_idiot

    Joined:
    Aug 16, 2007
    Messages:
    212
    Resources:
    0
    Resources:
    0
    try to replace "unit begins casting an ability" to "unit starts the effect of an ability", remove "do nothing" action and the variable summonunit=0 doesnt seem to be right
     
  8. Hairybeavet

    Hairybeavet

    Joined:
    Dec 8, 2005
    Messages:
    319
    Resources:
    0
    Resources:
    0
    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.
     
  9. Nodrek

    Nodrek

    Joined:
    Feb 4, 2008
    Messages:
    82
    Resources:
    0
    Resources:
    0
    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
     
  10. mongoose41

    mongoose41

    Joined:
    Feb 28, 2008
    Messages:
    31
    Resources:
    0
    Resources:
    0
    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.
     
  11. Nodrek

    Nodrek

    Joined:
    Feb 4, 2008
    Messages:
    82
    Resources:
    0
    Resources:
    0
    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 ?