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

Help fixing/improving this trigger.

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
Hi!

This trigger is part of a quest where the Hero has to collect some Dust spread around an island using 'Explore' ability, but I need it to work for all available players independently, and require the hero to pick a different dust each time.

  • Quest2DustFind
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • (Ability being cast) Equal to Explore
      • DustCollected Less than or equal to 20
    • Actions
      • Set Temp_Point = Position of (Triggering Unit)
      • Destructible - Pick every destructible within 100.00 of Temp_Point and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Destructible-type of (Picked destructible)) Equal to Removable Dust
            • Then - Actions
              • Set DustCollected = (DustCollected + 1)
            • Else - Actions
      • Custom script: call RemoveLocation(udg_Temp_Point)
Now... like it's, the hero can pick the same dust over and over... I don't know how to exclude the picked dust for that player only. (Dusts are destructibles)
 
Level 8
Joined
Apr 26, 2011
Messages
403
Hi!

Create an Boolean array for every player :
DustTypeA [N] // N = number of difference player
DustTypeB [N]
DustTypeC [N]
DustTypeD [N]
....

  • Quest2DustFind
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • (Ability being cast) Equal to Explore
      • DustCollected Less than or equal to 20
    • Actions
      • Set Temp_Point = Position of (Triggering Unit)
      • Destructible - Pick every destructible within 100.00 of Temp_Point and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Picked destructible)) Equal to Dust_Type_A
              • DustTypeA [player number of (owner of (triggering unit))] Equal to False
            • Then - Actions
              • Set DustCollected = (DustCollected + 1)
              • set DustTypeA [player number of (owner of (triggering unit))] = true
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Picked destructible)) Equal to Dust_Type_B
                    • DustTypeB [player number of (owner of (triggering unit))] Equal to False
                • Then - Actions
                  • Set DustCollected = (DustCollected + 1)
                  • set DustTypeB [player number of (owner of (triggering unit))] = true
                • Else - Actions
                  • If ....blahblah for Dust_Type_C.. D... E etc
        • Custom script: call RemoveLocation(udg_Temp_Point)
 

nGy

nGy

Level 11
Joined
Apr 15, 2011
Messages
123
Imo hashtables would be better...
idk but i'd do it like this:

  • Quest2DustFind
    • Events
      • Unit - A unit begins casting an ability
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • (Ability being cast) Equal to Explore
      • DustCollected Less than or Equal to 20
    • Actions
      • Set tempPoint = (Position of (Triggering unit))
      • Destructible - Pick every destructible within 100.00 of tempPoint and do (Actions)
        • Loop - Aktions
          • Set tempBoolean = (Load (Key (Picked destructible)) of (Player number of (Triggering player)) from hash)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • tempBoolean Equal to False
              • (Destructible-type of (Picked destructible)) Equal to Removable Dust
            • Then - Actions
              • Set DustCollected = (DustCollected + 1)
              • Hashtabelle - Save True as (Key (Picked destructible)) of (Player number of (Triggering player)) in hash
            • Else - Actions
      • Custom script: call RemoveLocation ( udg_tempPoint )
 
Last edited:

nGy

nGy

Level 11
Joined
Apr 15, 2011
Messages
123
Noooo, I didn't replace "Gleich" and "Aktionen" T.T, my identity was discovered! It's really hard to replace all this German stuff as it's used to be like this normally and you don't really notice it.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Ok, I have no idea about anything related to HashTables, I don't even know how to do what you did in the example trigger....
 

nGy

nGy

Level 11
Joined
Apr 15, 2011
Messages
123
There are masses of hashtable tutorial but it's actually really easy to explain:
Hashtables are used to store certain values like in a coordinate. So you could also write: "Save 'Your Value' as 'x-Value' of 'y-Value' in 'Your Hashtable'". This would mean "Your Value" is saved at the point (x-Value|y-Value) in the coordinate.
The issue of handles and handle id's I can't explain myself (I just know what I have to do, to get it to work) but if you're searching the key(" ")-thing just look for Hashtable - Get Handle ID
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
But don't I have to save the value of the destructibles first?... How to do that?

Please give me further information. This trigger is giving me a lot of trouble =/
 
Last edited:
Level 8
Joined
Dec 9, 2009
Messages
397
If your using JNGP hashtables in GUI are messed up (Can't select a lot of things in the menu)
So you could create the triggers in normal WE, then copy/paste into your map.

I'm not sure what all you can do with destructibles, if you could assign a custom value to it, you can add players that picked it up to playergroup(custom value of picked)

then when they try to gather it,
if owner of unit(casting unit) is in player group(custom value of picked)
then
You already gathered that
else
add owner of unit(casting unit) to playergroup(custom value of picked)
whatever you want.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Destructibles can't have custom values.

I tough about changing them for units but using custom values wouldn't work either. Because the 2nd player that picks it would change the value and re-enable it for the first player to pick again.

Thanks for the thing about JNPG and Hash :)
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Amazing! It's done... NOW, another problem comes alive :D

- If the hero dies, I need to set the DustCount to 0 and re-enable all the destructibles disabled to pick for that player....

EDIT: I'm loosing my mind here. This nearly the only thing left for me to finish the map for it's beta release... (Not counting the implement of save-load). I really need to know how to do this!
 
Last edited:

nGy

nGy

Level 11
Joined
Apr 15, 2011
Messages
123
If you chose the Hashtable-method try out this:

  • HeroDeath
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Destructible - Pick every destructible in (Playable map area) and do (Actions)
        • Loop - Aktionen
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • if - Conditions
              • (Destructible-type of (Picked destructible)) Equal to Removable Dust
            • then - Actions
              • Hashtable - Save False as (Key (Picked destructible)) of (Player number of (Triggering player)) in hash
              • Set DustCollected = 0
            • else - Actions
 
Status
Not open for further replies.
Top