• 🏆 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!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

Help making quest trigger/variables.

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
Hi! I need some help with this, I know its easy, but variables confuse me.

General Explanation:
In a quest i'm making, the hero has to go through a wide region picking "Dusts" (Wich are destructibles with Dust model), using "Explore" ability. When the hero uses the skill, the destructible is removed, and the Count of "How many dust he has already" increases by 1.

Precise Explanation:
I need it to detect when the hero is near to one destructible of a type (There are GoodDust and EvilDust), and if the Hero uses 'Explore' over (small area around, 75 radius around) a GoodDust, the "Dust Recovered" Count increases by 1. Quest is updated when 11 GoodDusts are recovered. Otherwise, if the Hero uses "Explore" around a EvilDust, some enemy unit appears in that position.

I was making it by 17 separeted triggers, but then I though that variables could do the job, but i have no idea on how to use them (yet).
 
Level 17
Joined
Feb 11, 2011
Messages
1,860
Unfortunately picking items in a group doesn't work as it does with units - you can't pick all items in a area, only in a region. This means you can't use "Pick all items within 75 of target point of ability being cast and do actions" (because it doesn't exist). If you make your Explore ability target items and not a point, it would be easier.

The quest trigger part is easy. But first: how many players do you have and can all of them go on this quest?
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Explore is a dummy ability based on "Thunder Clap" that works only by triggers, has no effect at all, nor target. Also, those are not items :) Are DESTRUCTIBLES with the Dust (The same that Puck does when shift in DotA) model. So, "Remove destructible" and "Pick Eevery Destructible" and "Matching destructible" does exist. =)
 
You can enumerate through those 'dusts' for location settings and use Pick all units in Range (...) of 'point'. Although it requires seeting the position of each destructible before actually doing the function. So when you create each one you are forced to spam:
  • Set p[1] = (Position of (Last created destructible))
And later in loop refer to each location for ForGroup function.

Alternative is to use jass functions:
JASS:
native          EnumDestructablesInRect     takes rect r, boolexpr filter, code actionFunc returns nothing

// Which requires booleanexpr as filter.
// In GUI it's always null but in jass you can use destructible type comparison:
native          GetDestructableTypeId       takes destructable d returns integer
With help of ^functions above you can pick each destructible of given type and check if hero is near any of them.
 
Level 17
Joined
Feb 11, 2011
Messages
1,860
Haha, sorry - me not reading again! Try this:

  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to [your dummy Thunder Clap]
      • Dust_Collected Less than 11
    • Actions
      • Set Temp_Point = (Position of (Triggering unit))
      • Destructible - Pick every destructible within 75.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 [your good dust item]
            • Then - Actions
              • Set Dust_Collected = (Dust_Collected + 1)
              • Game - Display to (Player group((Owner of (Triggering unit)))) the text: (Dust collected: |cffffcc00 + ((String(Dust_Collected)) + |r.))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Dust_Collected Equal to 11
                • Then - Actions
                  • Game - Display to (Player group((Owner of (Triggering unit)))) the text: Quest complete!
                • Else - Actions
            • Else - Actions
      • Custom script: call RemoveLocation(udg_Temp_Point)
Note: This is assuming that only 1 player can go on this quest. It also doesn't remove any of the Dusts, it just adds to the count and if the count is 11 it tells you the quest is complete.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
I'll test and report.

Report: Works AMAZINGLY WELL!. I made some little modifcations (increased range to 100, added EvilDust also to the count, etc.) Does exactly what I wanted to, how I wanted to. Thank you very much!
 
Last edited:
Status
Not open for further replies.
Top