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

Grab items with a ability --> need help

Status
Not open for further replies.
Level 9
Joined
May 31, 2010
Messages
366
high, im just making an rpg and want my heros to pick up items until they're using a ability "pick up"
but it dont works right sometimes the hero stays there for 3 or 5 seconds and is doing nothing as playing his stand animation...
it also works if he only have to pick up only 1 item but if there are more items it leaks

trigger:
HeroRed, HeroBlue,... = are variables for heros
GrabRed, GrabBlue,... = are variables for areas around the unit (the areas will move with the unit by another trigger every 1 second)

  • Grab
    • Ereignisse
      • Einheit - A unit Startet den Effekt einer Fähigkeit
    • Bedingungen
      • (Ability being cast) Gleich Aufheben
    • Aktionen
      • Einheit - Order (Triggering unit) to Stoppen
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Bedingungen
          • (Owner of (Casting unit)) Gleich Spieler 1 (Rot)
        • 'THEN'-Aktionen
          • Einheit - Order HeroRed to Rechtsklick (Random item in GrabRED <gen>)
        • 'ELSE'-Aktionen
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Bedingungen
              • (Owner of (Casting unit)) Gleich Spieler 2 (Blau)
            • 'THEN'-Aktionen
              • Einheit - Order HeroBlue to Rechtsklick (Random item in GrabBlue <gen>)
            • 'ELSE'-Aktionen
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • 'IF'-Bedingungen
                  • (Owner of (Casting unit)) Gleich Spieler 3 (Blaugrau)
                • 'THEN'-Aktionen
                  • Einheit - Order HeroTeal to Rechtsklick (Random item in GrabTeal <gen>)
                • 'ELSE'-Aktionen
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • 'IF'-Bedingungen
                      • (Owner of (Casting unit)) Gleich Spieler 4 (Lila)
                    • 'THEN'-Aktionen
                      • Einheit - Order HeroPurple to Rechtsklick (Random item in GrabPurple <gen>)
                    • 'ELSE'-Aktionen
(sry its in german some times, i hope you understand it)

i hope you can help me, thx cryze
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
A test map is attached
If you want to test, type -test #
# is your number:
1 = Red
2 = Blue
3 = Teal
4 = Purple
Your hero unit MUST be in the region of the item, or not, it won't give you any random item
But you said it yourself, you have a trigger that moves the region once every 1 second, right ?
So there should be no problem :)
But be sure, if your Hero unit is not within the region of your respective item, it won't give it to you
 

Attachments

  • Simple Random Item Given System.w3x
    15 KB · Views: 47
Level 9
Joined
May 31, 2010
Messages
366
thx defskull but i forgot something to say:
i made a trigger whos moves a right-clicked item into a store area of the player when its inventory is full
trigger:
  • red1
    • Ereignisse
      • Einheit - A unit Erhält einen auf ein Objekt zielenden Befehl [a unit becomes a order to target an object/free translation]
    • Bedingungen
      • [Here did i entered some units and destructibles who wont be targed of this trigger]
    • Aktionen
      • Gegenstand - Move (Target item of issued order) to (Random point in Store Red <gen>)
      • Wait 0.01 seconds
      • Einheit - Order (Triggering unit) to Stoppen

So i need a pick up trigger wich works with rightclick

also this problem is still after the hero picked up "gold coins" (i used this model: http://www.hiveworkshop.com/forums/models-530/item-goldcoins-184556/?prev=search=coin&d=list&r=20

maybe could there be the problem? any other items are working correctly i think

edit:
yes i said that im sorry about its beeing the german interface but i dont know how to change the language of my we
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
You don't have to translate your triggers, that's not what I meant, what I meant was is the German interface of world editor really that ugly that it uses 'IF' 'THEN' 'ELSE' with the apostrophes and those horrible capital letters? It looks like it might be third-party because it differs so strongly than the normal interface.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
I completely understand you, you are not understanding me. Posting your triggers in german is fine.

This is what I was saying:

There are a lot of third-party programs, ranging from World Editor Unlimited to Jass NewGen Pack to EGUI... there are many others. I was simply asking, out of curiosity, do you use one of these or do you use the standard World Editor that comes with WarCraft III?
 
Level 9
Joined
May 31, 2010
Messages
366
i maybe know my problem the item "Goldcoin" will not disapear after picking up so the hero becomes evertime i use the ability the order to pick up the item again thats why the first one did leaked ... but i dont know how to change this ...

edit: i tried with removing the item after picking up but now the hero dont pick up any other items with the ability and i dont know why...
 
Last edited:

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,190
You will need to move the items into the heroes inventory instead of ordering him to smart (right click in GUI) them. A hero who is ordered to pick up an item does not pick it up instantly so only 1 of the issued orders get carried out.

Al also advise storing the player heroes in a unit array at the index of the player slot number. That way you could get rid of the stupid branching statments testing owner.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Dr Super Good is write, get rid of that abomination of a nested if-statement. If you save each player's hero in an array (using the player-number as an index) then you can easily reference the hero that you want with a single line of code:

  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Unit - Order PlayerHero[(Player number of (Owner of (Triggering unit)))] to Right-Click Ghost Key 0000 <gen>
The Ghost Key 0000 is just a random item I placed to complete the trigger, you should get the idea.
 
Level 9
Joined
May 31, 2010
Messages
366
if there are no other items like books or goldcoins it works without any problems
if there is only one gold coin and i will only use the ability once it works
but if i use the ability at this point again he becomes the order to pick that item (gold coin) up again

this happens cuz items like gold coins or attribute books are not removed from game after picking them up (books will remain in litte points and the gold model i use only moves under the texture of ground (made a 360° camera sys and test by looking under the ground)

so i tried to remove them by a trigger but this didn't work ... just giving the targed item to the hero would work (dont know why) but then the trigger i made to move the items into the store if the inventory is filled up didnt work ...
i don't know...
(hope u understand me cuz of my bad english o_O)
 
Status
Not open for further replies.
Top