• 🏆 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] Capture the Flag - Making the flag a unit that can be placed in Heroe's inventory

Status
Not open for further replies.
Level 1
Joined
Sep 26, 2019
Messages
2
There are two teams with three players on each, six players total. The players on each team control a single Hero. I've set up a Trigger called 'Red Team steals Blue Flag' where the Red Team picks up the Blue Team's flag and places it in their inventory.
I've read on other topics that making the flag a unit is better than turning it into an item. However, I've come across the issue where the flag is unable to be picked up. What events, conditions, and actions may I use to resolve this issue? I've tried on my own for a week to resolve the issue myself but I'm having difficulty wrapping my head around creating processes on my own.
 
Level 9
Joined
Jul 30, 2018
Messages
445
You'd have to explain a bit more what you have done and point out the exact point that you don't get or are having problems with.

But in general, I don't really see why the flag should be a unit. And how would that even work? Just make an item that looks like the flag, and when you pick it up, add some special effect to the unit carrying it and then it drops when the Hero dies. If the flag's owner team picks it up, then just move the item to its original location.

You can even make it an item that is "used" automatically when picked up (like Tome of Agility or whatever), so it won't take space in the inventory. Then just make a trigger to keep track who has the flag and if that unit dies, you create a new flag at the position of the dying unit.
 
Depends on what you need.
  • items can be picked up and dropped, need a concrete mouse click, might need a free slot, requires less triggers
  • effects or units can be scaled, attched to move along with a unit to simulate flag-carrying, requires more triggers
What events, conditions, and actions may I use
Something to detect or the pick up, or when a unit comes in range with the flag.
Condition just if player is in correct team and flag is currently allowed to be picked up.
The unit which has the flag needs some special treatment, like triggers need to react for what happens when it dies, drops the flag, or reaches finish.
 
Level 39
Joined
Feb 27, 2007
Messages
4,992
The flag could be a unit if heroes have an ability to cast on a flag to capture/return it. Then another ability replaces it when you have the flag to drop it. Whenever a hero is issued an order targeting the flag, instead order it to use the spell on the flag. This allows you to set a capture radius (spell cast range) and retain ‘right click to capture’ functionality. Some triggers would be required to hide/attach/plant the flag on spell casts but those would be simple.
 
Level 1
Joined
Sep 26, 2019
Messages
2
You'd have to explain a bit more what you have done and point out the exact point that you don't get or are having problems with.
You're right. I wrote a flowchart of whats to happen, and I realized that I've missed a lot of steps, such as:
  • Writing a trigger about the Flag item and giving it properties to be captured (which I should change into a Tome as it will not consume a inventory slot).
  • A trigger about picking up and carrying the enemy flag into the team's base region.
  • A trigger about picking up your teams flag, and after a short channel, it returns it to your base flag's region.
  • A trigger after a successful score, increases a point on the Leaderboard, then returns the flag to the enemy team's base position.
Everything else, including the Leaderboard, works. Its just the flag and its triggers that I'm having issues with as I've been avoiding writing scripts in JASS and LUA as much as possible for the time being.
 
Status
Not open for further replies.
Top