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

Trigger help on a quest

Status
Not open for further replies.
Level 4
Joined
Mar 12, 2009
Messages
64
Im making a quest where you get in a certain distance of a unit and he gives the quest to the player unit who has got inside the range, but how do i make it so that everytime the same player gets in that range again it wont give the quest. how would you make a trigger like this?
 
Level 7
Joined
Sep 9, 2007
Messages
253
you could use a boolean array for that quest.

To do this you would have to set the variable for that quest and that player when they initially are given the quest:
  • Actions
    • Set quest1[(Player number of (Triggering player))] = True
Then you can add a condition to the trigger which gives players that quest.
  • Conditions
    • quest1[(Player number of (Triggering player))] Equal to False
If the player does not have that quest then that players part of the array will be false and the trigger will continue to run. If they do have the quest then their part of the array will be set to true and the trigger will stop.

There are better ways to accomplish this but this method is pretty straight forward. The downside is that you need a different array for each quest. If you have lots of quests then another method may be better for you.

Let me know how you go with this...
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
not a good idea that needs 10 variables for 10 quests. anyway you dont need that since once you got the quest you cant get it again. you can filter out it by checking if the owner to triggering unit dont got the quest and give if he dont got it.

or he can use a single hashtable where key1:player number, ley2: quest number, saved value is progress with quest in integer
 
Level 16
Joined
May 2, 2011
Messages
1,345
you could use a boolean array for that quest.
Hey, does array just mean a variable, or what does it exactly mean? and Hastable!! I don't know this one either Q_Q
This is my way of doing the trigger
  • Quest
    • Events
      • Unit - A unit comes within a range of Your unit
    • Conditions
    • Actions
      • -------- Tell the quest and the story --------
      • Trigger - Turn off (This trigger)
very simple Huh?
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Hey, does array just mean a variable, or what does it exactly mean? and Hastable!! I don't know this one either Q_Q
This is my way of doing the trigger
  • Quest
    • Events
      • Unit - A unit comes within a range of Your unit
    • Conditions
    • Actions
      • -------- Tell the quest and the story --------
      • Trigger - Turn off (This trigger)
very simple Huh?

very simple but if u turn off then player 2 cant pick up the quest or player 1 report, because only 1st time work this trigger

hashtable is array with 2 index, variable array got 1 index.
so variable[index]

variable[0]=10
variable[1]=15

(different index is different value, so variable[0]=10 is like variable=10, variable[1]=15 like variable1=15)

variable array similiar like alot non array variable the difference u can handle them easier

why usefull this?

example u want store to each player a different thing then u can do this

lets say if somebody buy then his variable we change to 10
variable[player number of (owner of buying unit) ] = 10

its mean if player 1 buy a item then variable[1]=10, if player 2 buy item then variable[2]=10

later u can just check easily, example if unit use the item then u can just check
if variable[player number of (owner of trigger) ] = 10 then
//do something
endif

hashtable is similiar but there u can use 2 index (key)

so something like
hashtable[0][0] could be different than hashtable[1][0] or hashtable[0][1]
 
Level 4
Joined
Mar 12, 2009
Messages
64
very simple but if u turn off then player 2 cant pick up the quest or player 1 report, because only 1st time work this trigger

hashtable is array with 2 index, variable array got 1 index.
so variable[index]

variable[0]=10
variable[1]=15

(different index is different value, so variable[0]=10 is like variable=10, variable[1]=15 like variable1=15)

variable array similiar like alot non array variable the difference u can handle them easier

why usefull this?

example u want store to each player a different thing then u can do this

lets say if somebody buy then his variable we change to 10
variable[player number of (owner of buying unit) ] = 10

its mean if player 1 buy a item then variable[1]=10, if player 2 buy item then variable[2]=10

later u can just check easily, example if unit use the item then u can just check
if variable[player number of (owner of trigger) ] = 10 then
//do something
endif

hashtable is similiar but there u can use 2 index (key)

so something like
hashtable[0][0] could be different than hashtable[1][0] or hashtable[0][1]

im having a hard time picturing how to do it this way, like what variables would i use?
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
im having a hard time picturing how to do it this way, like what variables would i use?

i think a integer variable array / quest or hashtable with integer is enough.

like i said u just save the unit custom value or handleid like array index or if hashtable then it is 1st key, then save the progress, i make a demo map

u need hashtable version?

  • Pick Quest 1
    • Events
      • Unit - A unit comes within 200.00 of Beastmaster 0001 <gen>
    • Conditions
    • Actions
      • Set PlayerNumber = (Player number of (Triggering player))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Quest1_Progress[PlayerNumber] Equal to 0
        • Then - Actions
          • Set Quest1_Progress[PlayerNumber] = 1
          • Cinematic - Send transmission to (All players) from Beastmaster 0001 <gen> named Quest 1 NPC: Play No sound and display Kill 5 creep. Modify duration: Add 5.00 seconds and Don't wait
          • Game - Display to (All players) the text: Quest Reicived
          • Quest - Create a Optional quest titled Killing creep with the description kill 5 creep, using icon path ReplaceableTextures\CommandButtons\BTNAmbush.blp
          • Set Quest1_Quest[PlayerNumber] = (Last created quest)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Quest1_Progress[PlayerNumber] Equal to 2
            • Then - Actions
              • Game - Display to (All players) the text: quest done, 1000 go...
              • Player - Add 1000 to (Player(PlayerNumber)) Current gold
              • Quest - Mark Quest1_Quest[PlayerNumber] as Completed
              • Cinematic - Send transmission to (All players) from Beastmaster 0001 <gen> named Quest 1 NPC: Play No sound and display Grat, u completed t.... Modify duration: Add 5.00 seconds and Don't wait
              • Set Quest1_Progress[PlayerNumber] = 3
            • Else - Actions
  • Kill
    • Events
      • Unit - A unit owned by Neutral Hostile Dies
    • Conditions
    • Actions
      • Set PlayerNumber = (Player number of (Owner of (Killing unit)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Quest1_Progress[PlayerNumber] Equal to 1
        • Then - Actions
          • Set Quest1_Kill[PlayerNumber] = (Quest1_Kill[PlayerNumber] + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Quest1_Kill[PlayerNumber] Equal to 5
            • Then - Actions
              • Set Quest1_Progress[PlayerNumber] = 2
              • Game - Display to (All players) the text: go back for report ...
            • Else - Actions
        • Else - Actions
Notice:

if in 1st trigger instead Set Quest1_Progress[PlayerNumber] = 3 u write Set Quest1_Progress[PlayerNumber] = 0 then quest again pickable, so u can start the quest again for another 5 mob
 

Attachments

  • quest example.w3x
    19.1 KB · Views: 42
Status
Not open for further replies.
Top