• 🏆 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 with quest item

Status
Not open for further replies.
Level 3
Joined
Oct 22, 2010
Messages
29
So I have the quest item in my inventory.... How do I write a code so that I take said item and turn it in to the questgiver.

(this isn't a real trigger)

Event
Player 1 gives quest item to questgiver
Condition
Item is equal to (whatever is needed)
Action
Mark quest complete
Hero gets exp
Player gets cash
Turn this trigger off

I am tired and really need your help.
 
Level 22
Joined
Feb 4, 2005
Messages
3,971
  • help with quest item
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Tome of Experience
      • (Owner of (Hero manipulating item)) Equal to Player 1 (Red)
      • (Unit-type of (Hero manipulating item)) Equal to Footman
    • Actions
      • Quest - Mark (Last created quest) as Completed
      • Hero - Set (Triggering unit) experience to ((Hero experience of (Triggering unit)) + 1000), Hide level-up graphics
      • Player - Set Player 1 (Red) Current gold to 750
      • Trigger - Turn off (This trigger)
For 'last created quest' there where you create the quest createa variable = last cr8ed quest and use the variable instead of 'last created quest'. Best is if you put the item on the ground next to the hero and make a trigger with Melee Initialization to order the unit to pick the item so that this trigger occurs. It would make it instantly, you wont even see how the hero gets it. Cause using Every X second to check if the unit also has it would be more leaking.
 
Imtor, this trigger will add experience to the unit that acquires the item, not the unit that gave the item. Here is how it should be:
  • Item
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Ghost Key
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Not equal to Mountain King
        • Then - Actions
          • Hashtable - Save Handle Of(Triggering unit) as (Key owner) of (Key (Item being manipulated)) in Hash
        • Else - Actions
          • Set OwningUnit = (Load (Key owner) of (Key (Item being manipulated)) in Hash)
          • Game - Display to (Player group((Owner of OwningUnit))) the text: Quest Completed!
          • Hero - Set OwningUnit Hero-level to ((Hero level of OwningUnit) + 1), Show level-up graphics
 

Attachments

  • Quest Test Map.w3x
    17.3 KB · Views: 34
Level 3
Joined
Oct 22, 2010
Messages
29
OMG!!! I love your test map. It works great there but when I copied all your hashtables and triggers, it still drops the item at the QG's feet. I did change a couple things and I'll post it to show you but it shouldn't break the triggers.

  • Thomas
    • Events
      • Unit - A unit comes within 75.00 of Thomas 0015 <gen>
    • Conditions
      • ((Entering unit) is A Hero) Equal to True
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • Special Effect - Destroy SpecialEffects[1]
      • Quest - Display to (All players) the Quest Update message: I was playing near ...
      • Quest - Create a Required quest titled Lost Jewel with the description Find the stone for ..., using icon path ReplaceableTextures\CommandButtons\BTNAmbush.blp
      • Set Quests[1] = (Last created quest)
      • Quest - Enable Quests[1]
      • Camera - Apply Camera 002 <gen> for Player 1 (Red) over 5.00 seconds
      • Animation - Play Thomas 0015 <gen>'s Walk animation
      • Trigger - Turn off (This trigger)
then
  • Lost Jewel
    • Events
      • Unit - A unit owned by Player 1 (Red) Acquires an item
    • Conditions
      • (Quests[1] is enabled) Equal to True
      • (Item-type of (Item being manipulated)) Equal to Shiny Stone
    • Actions
      • Quest - Display to (All players) the Quest Update message: You recovered the s...
      • Trigger - Turn off (This trigger)
and last
  • Item
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Shiny Stone
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Not equal to Child
        • Then - Actions
          • Hashtable - Save Handle Of(Triggering unit) as (Key owner) of (Key (Item being manipulated)) in Hash
        • Else - Actions
          • Set OwningUnit = (Load (Key owner) of (Key (Item being manipulated)) in Hash)
          • Game - Display to (Player group((Owner of OwningUnit))) the text: Quest Completed!
          • Hero - Set OwningUnit Hero-level to ((Hero level of OwningUnit) + 1), Show level-up graphics
          • Hashtable - Clear all child hashtables of child (Key (Item being manipulated)) in Hash
What am I doing wrong?

-edit-
TY Fjury I'll fix that now.

-edit again-
Now I give the item away, thanks to Fjury, but the quest doesn't complete. Do I need to make another trigger for losing the item? Are my triggers posted above conflicting with eachother? I am very new. Sorry 'bout all the noob questions.

-updated code-
Quest is still not completing... I am very, very new to coding. I know it's something simple again but have no idea what it is. This is my new code. I'm counting on you Pharaoh_ lol
 
Last edited:
First of all, wrong conditions.
• You don't need a Trigger comparison. Obviously, the event that fired the "Thomas" trigger, fired it. Comparing the trigger to itself is redundant.

• You don't need to check whether the region contains your unit, because the trigger already got fired up, when your unit got close to "Thomas".

  • Quest - Enable (Last created quest)
You forgot this line in the first trigger. Your second trigger checks whether the quest is enabled, but you haven't enabled it.

  • (Owner of (Hero manipulating item)) Equal to Player 1 (Red)
Remove that condition. Your trigger fires when a unit from Player 1 (Red) acquires an item and you have an additional condition to check whether the owner of this unit is Player 1 (Red). Of course it's player 1, that's why you added that event. If you want to have such a condition, then change your event to the Generic Unit event: "Unit - A unit acquires an item".

That's all. It should normally work now :]
 
Level 3
Joined
Oct 22, 2010
Messages
29
Did you enable the question, like I told you to? At least respond to my answer, before 'bumping'.

I editted my trigger and posted it with an update before I bumped it. =)

Update:

  • Mud Men TI
    • Events
      • Unit - A unit comes within 100.00 of Greater Dark Minion 0060 <gen>
    • Conditions
      • ((Entering unit) is A Hero) Equal to True
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) has an item of type Stone Token) Equal to True
        • Then - Actions
          • Item - Remove (Item carried by (Triggering unit) of type Stone Token)
          • Quest - Display to (All players) the Quest Update message: "I'll destroy that ...
          • Quest - Mark Quests[3] as Completed
          • Player - Add 400 to Player 1 (Red) Current gold
          • Hero - Add 250 experience to (Triggering unit), Show level-up graphics
          • Special Effect - Create a special effect attached to the overhead of Greater Dark Minion 0029 <gen> using Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
          • Set Special_Effects[4] = (Last created special effect)
          • Trigger - Turn on GDM 0029 <gen>
          • Trigger - Turn off (This trigger)
        • Else - Actions
This removes the item when you go back to the questgiver. The easy answer was using (Triggering Unit) in the trigger:
  • Item - Remove (Item carried by (Triggering unit) of type Stone Token)
 
Last edited:
Status
Not open for further replies.
Top