• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Item Range Bonus

Status
Not open for further replies.
Level 10
Joined
May 20, 2008
Messages
433
I've done multiple searches (in the editor and on the site) on items that give range bonus' and how to trigger them. Both were complete failures. If I did miss an item that gives a range bonus, alert me, becuase I have not found it.
I need a trigger for an item to do the following:
If the unit picks up a scope, give the unit +100 range
If the unit picks up additional scopes, don't give an extra 100 range
If the unit drops the scope (and has none left), take the bonus 100 range away

I have an idea of how 1 and 3 would work (I've completed 1), but I can't find a way to check if the unit has additional scopes. I'm trying to avoid using 9 separate triggers for each player, and even if I did have a trigger for each player, I'm not sure how it would work. Help?
 
Level 4
Joined
Feb 2, 2009
Messages
71
Here's the triggers. It won't work, because I simply can't find any way to change the units attackrange. But it does all you want except adding/reducing the range. :)

  • Scope Acquire
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Scope
    • Actions
      • Set i = 0
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Scope
            • Then - Actions
              • Set i = (i + 1)
            • Else - Actions
              • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • i Equal to 1
        • Then - Actions
          • Game - Display to (All players) the text: + 100 range
        • Else - Actions
          • Do nothing
      • Set i = 0
In case you wonder what's going on here... first I loop through the hero's inventory and count every Scope I find. Then add the bonus, but only if I did only find one Scope.

  • Scope Drop
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Scope
    • Actions
      • Wait 0.01 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) has an item of type Scope) Equal to False
        • Then - Actions
          • Game - Display to (All players) the text: - 100 range
        • Else - Actions
          • Do nothing
In case you wonder about this one too... I realized the hero hadn't dropped the item yet when the IfThenElse ran, so I had to wait a little for the hero to drop the item (0.01 sec).
It's funny that heroes pick things up faster then dropping them, teh, cheap bastards.
 
Level 10
Joined
May 20, 2008
Messages
433
  • Unit - Set (Triggering unit) acquisition range to ((Current acquisition range of (Triggering unit)) + 100.00)
Best I could do with coming up with range. Thanks for the help, but how would you connect an upgrade with an ability (then again, I don't know that much about triggering)?
 
Level 4
Joined
Feb 2, 2009
Messages
71
Acquisition range is the range of which you can pick up items and stuff. You don't wanna mess around with that.
Wait for neavea to finnish his trigger and you'll see it it turns out fine. I think you know enough to rip if off. Hehe :p
 
Level 5
Joined
Oct 17, 2006
Messages
151
  • Scope Aquire
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has (Item carried by (Picked unit) of type Claws of Attack +15)) Equal to True
              • ((Picked unit) is in Scope_Group) Equal to False
            • Then - Actions
              • Player - Set the max research level of Improved Bows to 1 for (Owner of (Picked unit))
              • Unit Group - Add (Picked unit) to Scope_Group
            • Else - Actions
      • -------- put destroy unit group script here --------
Notes:
  • the item "Claws of Attack +15" should be replaced with your actual item and you can also change the "scope_group" to whichever group you want (make sure to add it as a variable)
  • You will have to add the marksmanship upgrade to the unit(s) in the object editor and change the range bonus to 100 in the "upgrades" section in the object editor.
  • about the "put destroy unit group script here", as my siggy says I do not do jass however lately I have been fixing my triggers so that they are mui and dont leak. I was searching around for the destroy temp unit group but couldn't find it so I will let you guys post it so that I and maybe others can learn... :grin:
 
Level 4
Joined
Feb 2, 2009
Messages
71
Faster hah? Looks clean too.
But it does run every 0.02 second even when it's not used.
If you are planning to add several items using the same method, use mine (but add the upgrade, like neavea has discribed). ;)
 
Level 5
Joined
Oct 17, 2006
Messages
151
well I could have made the pick up unit thing but I would have to remove the leak of the unit and I forgot the script for that to... :grin:

and it solves your part 2 and three because of these:

Because the unit already picked up a scope its in a group and because the condition prevents guys in the group, the unit wont get the range bonus any more.
If the unit drops it... nothing happens! The unit already has the 100+ range and its in the unit group to prevent any doubling...
 
Level 4
Joined
Feb 2, 2009
Messages
71
Yup, found an error though:
  • ((Picked unit) has (Item carried by (Picked unit) of type Claws of Attack +15)) Equal to True
I belive you mean this:
  • ((Picked unit) has an item of type Claws of Attack +15) Equal to True
Oh, found another one, you probably ment this:
  • Player - Set the current research level of Improved Bows to 1 for (Owner of (Picked Unit))
Changing the max research level won't change any stats will it?

You should be ashamed! :D
 
Level 5
Joined
Oct 17, 2006
Messages
151
i apologize! i did not see the "give away" part I thought you ment leave it at that

make a separate trigger where if a unit drops an item and the condition is (((Picked unit) has an item of type Claws of Attack +15) Equal to false) and then set the research lvl to 0 (this will remove range bonus)

also livirus i should not be ashamed because I was in a hurry... i wanted to make em quick :p
 
Level 4
Joined
Feb 2, 2009
Messages
71
Here's my final version, all I did was replacing my textmessage with the upgradethingy neavea came up with.
Use Neavea's if you like though. (mine's better :p)
  • Scope Acquire
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Claws of Attack +15
    • Actions
      • Set i = 0
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Claws of Attack +15
            • Then - Actions
              • Set i = (i + 1)
            • Else - Actions
              • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • i Equal to 1
        • Then - Actions
          • Player - Set the current research level of Improved Bows to 1 for (Owner of (Triggering unit))
        • Else - Actions
          • Do nothing
      • Set i = 0
  • Scope Drop
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Claws of Attack +15
    • Actions
      • Wait 0.01 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked unit) has an item of type Claws of Attack +15) Equal to True
          • ((Triggering unit) has an item of type Claws of Attack +15) Equal to True
        • Then - Actions
          • Do nothing
        • Else - Actions
          • Player - Set the current research level of Improved Bows to 0 for (Owner of (Triggering unit))
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,255
Blind leading blind syndrome...

If you have absolutly no idea on how to do something, it would probably be more constructive to not post rather than telling other people to do stuff that does not work.

Livirusm incorrect, aquisition range is the range at which a unit will engauge a hostile targetable unit automatically. It has nothing to do with item pickup at all.

Faster hah? Looks clean too.
Yes, about as fast as the first steam engines and twice as pollutant.
It leaks and is hideously inefficent, which would appear quite the opposite of what you said. It also only works once, meaning the unit can drop the item and still hold the 100 range bonous, which is not what he was after.

Livirus, your method is about as helpful, detecting and handeling items is not the problem, adding range is as you probably have noticed.

and it solves your part 2 and three because of these:

Because the unit already picked up a scope its in a group and because the condition prevents guys in the group, the unit wont get the range bonus any more.
If the unit drops it... nothing happens! The unit already has the 100+ range and its in the unit group to prevent any doubling...
Some how I fail to see that matching
If the unit picks up a scope, give the unit +100 range
If the unit picks up additional scopes, don't give an extra 100 range
If the unit drops the scope (and has none left), take the bonus 100 range away
If the unit drops the item, the upgrade persists as you can not unresearch a technology, as you already know, nor do you even attempt to. Secondly, if one unit pick it up, all units affected by the upgrade are affected by it. Thirdly is that action not the one to set how far a tech can be researched and not what level it actually is?

Honeslty I do not see how that is meant to do 2/3 things on his list.

Anyway, the actual answer is that there is no real way to upgrade range. The best you can do is to replace the unit with another unit type with identical stats but more range or other such object / spells which influence range.

Upgrades do not work as they have limated uses and so in the end are exploitable as well as add large load times to your map. They also affect all units so will not really work that well.
Aquisition range does not work, since althou it is the limating factor of range in the object editor, modifying it via triggers does not affect the range (for some stupid reason).

UPDATE (all above was in responce to 3+ messages ago when I started typing) -
Livirus, neavea. . . Technologies can not be unresearched via triggers or otherwise. Thus how exactly is your thing meant to work?
 
Level 5
Joined
Oct 17, 2006
Messages
151
this fails because in your second trigger you repeat the conditions except the first one refers to a nonexistant "picked unit" :grin::thumbs_down:

plus instead of putting it in the else, set the boolean to FALSE and put it in the then section removing the do nothing crap... :p

EDIT:

dang super good.... You tore my post up when all i made was a mistake i nreading... hehehe

but hay at least you updated your post and acknowledged my edits... :]

I felt a little queezy abut saying the unresearch thing cuz i wasnt sure about it but i said it anyways... lol
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,255
No, what I am saying is you can not unresearch technologies, which means your trigger idea does not work as the upgrade is applied permantly once the item was picked up once. Basicly the whole method you were trying to use will not work.

Remember, only in SC2 will you be able to unresearch a researched technology. WC3 does not support that.
 
Level 4
Joined
Feb 2, 2009
Messages
71
Dr Super Good
And your post was as helpful as... it's 90% bashing (or what they call it) 9% constructive critique and 1% helpful facts.

As he stated in his first post he said he had already finished step one.
That's why I thought he'd already figured out how to add the range.
If all he was wondering about was the range, then he probably would have asked only about the range, don't you think?
All this mumbojumbo about what will happen when he drops/picks up the item was just crome?

Appearently he had mistaken the Attack Range for the Acquisition Range though.
Yeah, I was probably wrong about Acquisition Range. All I knew was it wasn't attackrange, and I assumed it had to do with acquire (acquisition?).

I was being sarcastic when I said "Faster huh? Looks clean too."

Dr Super Good is right though.
For some weird reasong this won't work:
  • Player - Set the current research level of Improved Bows to 0 for (Owner of (Triggering unit))
It seem like you can't remove upgrades, only add them.
 
Level 4
Joined
Feb 2, 2009
Messages
71
I'm not competing. I'm just saying the trigger shouldn't run when not used.

Imagine 15 items similar to this, and every one of them updating every 0.02 sec.
And on top on that, picking every unit on the map.
It's just waste of CPU.

Try 'shorter' next time you refer to the time it takes to create the trigger to avoid situations like this. :)
There seem to be a lot of people competing in efficiency and speed on this forum hehe.
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
That last trigger wont work since:
If a unit drops the item, it doesnt have it anymore (the triggering unit)
Solution: Set it to false,,
And there is no picked unit!?
Solution: Remove the whole condition, since the other condition covers it all,,


EDIT: Whoops damn, was reading first page, and we're already at page 2! xD
Srry,
 
Status
Not open for further replies.
Top