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

Unit selling merchant.

Status
Not open for further replies.
Level 12
Joined
Dec 2, 2016
Messages
733
I have a merchant that you can buy units from. I'm trying to set it up so I can detect if a specific team bought the unit, or at least specific team colors, how can I go about this?

All I've come up with so far is matching the triggering unit to a specific unit model which is not ideal, since I am using multiple unit models.


Ideally I want to check if the triggering hero is on either team 1 or 2, and if he's on 1 team do blah..., and team 2 do blah....

Thank you.
 
Level 12
Joined
Dec 2, 2016
Messages
733
Use owner of buying unit
I'm using a player comparison. I can't find an option to check if he's an ally of a specific team though. It's just equal comparison. Which condition type should I use?
  • Vampire Merchant Disable Human Team
    • Events
      • Unit - Market of Blood 0016 <gen> Sells a unit
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Buying unit)) Equal to Player 11 (Dark Green)
          • ((Triggering unit) belongs to an ally of Player 11 (Dark Green)) Equal to True
        • Then - Actions
          • Unit - Kill (Summoned unit)
        • Else - Actions
 
Last edited:
Level 15
Joined
Jul 9, 2008
Messages
1,552
You could just make the shop owned by 1 of the vampires. And the enemy wont be able to use it

You dont have to use if then else if thats all your doing just add the conditions to the conditions in the trigger

Use the second 1 and change it to buying unit. The triggering unit is the market of blood.

I dont think u can use ally of team
 
Level 12
Joined
Dec 2, 2016
Messages
733
You could just make the shop owned by 1 of the vampires. And the enemy wont be able to use it

You dont have to use if then else if thats all your doing just add the conditions to the conditions in the trigger

Use the second 1 and change it to buying unit. The triggering unit is the market of blood.

I dont think u can use ally of team

I can't make it owned by the vampires, I want the other team to be able to see the shops inventory, what has been purchased/cooldown. And as far as I remember you needed neutral passive? for that to be possible I think.


  • Vampire Merchant Disable Human Team
    • Events
      • Unit - Market of Blood 0016 <gen> Sells a unit
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Owner of (Buying unit)) Not equal to Player 11 (Dark Green)
          • (Owner of (Buying unit)) Not equal to Player 12 (Brown)
      • ((Owner of (Buying unit)) Not equal to Player 11 (Dark Green)) or ((Owner of (Buying unit)) Not equal to Player 12 (Brown))
    • Actions
      • Unit - Kill (Sold unit)
^ I ended up doing this.

Basically if you guys have ever heard of vampirism, I'm trying to make a new version of the game. So this above code would be fine if it was always going to be the two vampires. But if humans die via vampire attack they have an option to turn into a vampire. So what I'm going to do is have an array variable. With 10 indexes, all 10 slots will start at false. And false = no vampire minion exists. Each index will represent a player color. 0 = red, 10 = lb. I'll have an event that fires when a human dies, and if he chooses to become a vampire minion, red for example. I'll set the array[0] = true.

So now, with the above code. I have this 'or' condition. But I need to do something more along the lines of like this.

I'm not very good with jass yet, but I know Lua pretty well which is similar.


In Lua it would probably look something like this.

Code:
if (Owner of (Buying unit)) Not equal to Player 11 (Dark Green) then
elseif (Owner of (Buying unit)) Not equal to Player 12 (Brown) then
elseif (Owner of (Buying unit)) Equal to Player 1 (Red) then
if HumanArray[0] == true then
-- do code
end

elseif (Owner of (Buying unit)) Equal to Player 2 (Blue) then
if HumanArray[1] == true then
-- do code
 end
-- ETC ETC ETC the rest of the HumanArray's up to 10 checking for minions.
end
else 
-- Kill unit etc
end

Is there a way to do something like that in WE? ^[/trigger]
 
Level 15
Joined
Jul 9, 2008
Messages
1,552
you have the same condition twice?

if thats the case u could just use

  • Untitled Trigger 001
    • Events
      • Unit - market of blood Sells a unit
    • Conditions
      • is_human[(Player number of (Triggering player))] Equal to True
    • Actions
      • Unit - Kill (Sold unit)
 
Level 12
Joined
Dec 2, 2016
Messages
733
you have the same condition twice?

if thats the case u could just use

  • Untitled Trigger 001
    • Events
      • Unit - market of blood Sells a unit
    • Conditions
      • is_human[(Player number of (Triggering player))] Equal to True
    • Actions
      • Unit - Kill (Sold unit)
Oh yeah my bad, was just testing. I think that will do it, thanks a lot :D
I'll post here if I run into any more issues. Appreciate the help.
 
Level 12
Joined
Dec 2, 2016
Messages
733
So this has been getting a bit messy, I think I need to do something different.

I've got a spawn portal, that a vampire can set a spawn portal and chose where the merchant spawns units.

So I need to firstly have the merchant check if the triggering unit is a vampire, and also check that triggering units spawn point variable.



Is there a way to check if a triggering unit is on X team? I can't seem to find that condition type.
 
Level 13
Joined
May 10, 2009
Messages
868
Then, you need to create your own teams via triggers. Create 2 Player Group variables, give a name for each, and when you map loads, assign each player to their respective team. If something happens to them which needs to swap their team, then just remove a player from Team A, and add them to Team B.

  • Your map init
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • -------- ULTRA BLABLABLA HERE --------
      • For each (Integer A) from 1 to 9, do (Actions)
        • Loop - Actions
          • Set tmp_player = (Player((Integer A)))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (tmp_player controller) Equal to User
              • (tmp_player slot status) Equal to Is playing
            • Then - Actions
              • Player Group - Add tmp_player to Team_A
              • -------- Create unit for this player somewhere... --------
            • Else - Actions
      • For each (Integer A) from 9 to 12, do (Actions)
        • Loop - Actions
          • Set tmp_player = (Player((Integer A)))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (tmp_player controller) Equal to User
              • (tmp_player slot status) Equal to Is playing
            • Then - Actions
              • Player Group - Add tmp_player to Team_B
              • -------- Create unit for this player somewhere else... --------
            • Else - Actions
      • -------- SOME MORE BLABLABLA THERE --------
Suddenly, an important event happens, and a certain player needs to be moved to Team B.

  • Main Unit dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to MAIN_UNIT
      • ((Triggering player) is in Team_A) Equal to True
    • Actions
      • Set tmp_player = (Triggering player)
      • Player Group - Remove tmp_player from Team_A
      • Player Group - Add tmp_player to Team_B
      • -------- Enemy - Ally --------
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • -------- If picked player is in Team A, and triggering player is in B now, then we should make 'em enemies. Otherwise, allies. --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • -------- Don't forget to check if picked player is still playing, in case that's somehow necessary --------
              • ((Picked player) is in Team_A) Equal to True
            • Then - Actions
              • -------- New Enemies --------
              • Player - Make tmp_player treat (Picked player) as an Enemy
              • Player - Make (Picked player) treat tmp_player as an Enemy
            • Else - Actions
              • -------- New Allies --------
              • Player - Make tmp_player treat (Picked player) as an Ally with shared vision
              • Player - Make (Picked player) treat tmp_player as an Ally with shared vision
      • -------- - --------
      • Set point = (Position of (Triggering unit))
      • -------- Create a new unit? --------
      • Unit - Create 1 NEW_UNIT for tmp_player at point facing (Facing of (Triggering unit)) degrees
      • Custom script: call RemoveLocation(udg_point)
      • -------- Remove old one (dying unit) --------
      • Unit - Remove (Triggering unit) from the game
That's just an example on how to keep track of your Teams. I don't know what/how is your map style yet, so I just gave that simple example to demonstrate what I said.
 
Last edited:
Status
Not open for further replies.
Top