Travelling Merchant

DM Cross

You want to see a magic trick?
Reaction score
567
For my New Age of Warcraft map (a melee map with new custom units and heroes and a few triggers ;) for spice) I've decided to create some of my own items and such...Naturally, I'm going to create a few Master items, or something along those lines, like Armor peices that will turn heroes into some new beast when they're all worn, or something like that...Anyway, what I wanted to know was how to create a trigger to make a shop, in the guise of a unit, jump around the map...Let me try that again, it was a little complex:

I want to make a shop called the 'Traveling Merchant' who sells rare items.

Every x seconds, I want the Traveling Merchant to move from his current place, to the next place. (That's obviously region related, but I get that part)

So how would you write a trigger like that?
 

SilverHawk

General Iroh - Dragon of the West
Reaction score
89
Three questions:

1) How often do you want it to move?
2) How many different regions?
3) In a pattern or randomly?

If you answer that then I'm pretty sure that I can do it. I think you can do it along the lines of turning on triggers and having them run periodically.
 

DM Cross

You want to see a magic trick?
Reaction score
567
1) Let's say every day/night
2) I didn't really think about it, let's go for 4 regions, why not?
3) Random, makes it harder to find him ;)
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
Unit - order "merchant" to move to center of RegionArray[ Random number between 1 and "number of regions" ]
(or "random point in region")

Where "RegionArray" is an array that holds all your regions.

For the event, either a periodic timer, or based on "game time becomes ...".


The shop itself is simpler,
put all the items in "techtree - items sold"
and give it the abilities "sell items" and "select hero" (or "select unit").
 

SilverHawk

General Iroh - Dragon of the West
Reaction score
89
Actually I thought of a way to make it much simpler. Here it is:

E:
Time of day becomes 6:00 / 18:00 (two events, I'm lazy)

C:

A:
Set <integer> = Integer((4 * random number from 0.00 to 1.00) + 1)
If <integer> = 1 then move <travelling merchant> to center of <region 1>
etc.
 

BrokenX

New Member
Reaction score
26
Lets not use random ;).

Heres a little thing to get you started maybe? you have to create your unit right off the start k... and place him in the region that will detect he is there so it will move him.

Code:

Events
time - elapsed time is 2.50 seconds.
Conditions
Actions
Create 1 (merchant) for (Your player) at (Your region)

Now this will move him in a big circle ;) required... 5 regions?

k


Code: Move1

Events
Unit - a unit enters (Your region where u will create you merchant thing)
Conditions
(Owner of(Entering Unit)) is equal to (Your player he will be under)
Actions
Unit - Order (Entering) Unit to (MOVE) to (region A)

Code: Move2

Events
unit - a unit enters (Region A)
Conditions
(Owner of(Entering Unit)) is equal to (Your player he will be under)
Actions
Unit - Order (Entering) Unit to (MOVE) to (Region B)

Code: Move3

Events
Unit - a unit enters (Region B)
Conditions
(Owner of(Entering Unit)) is equal to (Your player he will be under)
Actions
Unit - order (entering Unit to (MOVE) to (Region C)

Code: Move4

Events
Unit - A unit enters (Region C)
Conditions
(Owner of(Entering Unit)) is equal to (Your player he will be under)
Actions
unit - order (Entering) unit to (MOVE) to region (D)

Code: Move5

Events
Unit - a unit enters Region (D)
Conditions
(Owner of(Entering Unit)) is equal to (Your player he will be under)
Actions
Unit - Order (Entering) unit to (MOVE) to (region E)

Code: Move6

Events
Unit - a unit enters region (E)
Conditions
(Owner of(Entering Unit)) is equal to (Your player he will be under)
Actions
Unit - order (Entering Unit to (MOVE) to (Region A)

This will make it so he keeps going it a circle or you can place them all over in the orders you like ;) so he keeps going around and around ;) you can add more triggers on it can keep going if you like :).


Broken X
 

DM Cross

You want to see a magic trick?
Reaction score
567
I'd like to try Ace's way first because a) I would like it to be random...and b) well..he IS the moderator ;) However, a few questions:

1) do i have to have the merchant already in one of the regions at game start?
2) Could you explain the arrays a bit to me? I haven't gotten into those yet, really, so the help would be much appreciated :D
 

BrokenX

New Member
Reaction score
26
If you scroll up and read my first code ;) it creates a panda merchant or whatever it is called, inside of your region then it starts moving him automaticaly, and this is why i made this type of code for you because arrays are a ... hassal :) kind of hard if you are new to them ^.- .
 

DM Cross

You want to see a magic trick?
Reaction score
567
... :D *Starts making the triggers BrokenX posted*

Question, though...Will that make him WALK to the different spots, everytime, as soon as he gets to one?
 

BrokenX

New Member
Reaction score
26
Possibily... it would require alot of regions, you could have him going so many places at once I can see it in my head now. Non-stop, yea you could make him go many places, it is possibly yes, :).



(Off topic)
w00t 200 posts ;).
 

DM Cross

You want to see a magic trick?
Reaction score
567
Lol, congrats...

Go you, Broken...Ok, I added the triggers (All 5 of them -.- (I only had 4 regions, not 5, but thanks for the extra information anyway!)) so I'm going to test it...(Heh, kind of funny that the first time we met you were yelling at me for not knowing triggers, and now you're helping...Irony laughs down upon us all, doe it not?)
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
Alexander said:
Will that make him WALK to the different spots, everytime, as soon as he gets to one?

Yes.
As soon as he enters one of the regions, he will immediately walk on to the next one.


A time based solution would be better there,
since, after all, it's a merchant.
Which means he's supposed to actually want to sell you something,
not just to run away from you ;)


That said, arrays are simple.
New variable, give it some name, put in the type ("region")
and set the size to the number of regions you're going to have.

Then, at map initialization, put all the regions inside the array:
Code:
    Set MerchantRegions[1] = Region 001 <gen>
    Set MerchantRegions[2] = Region 002 <gen>
    ....

Then something that gets him to move:
Code:
MoveMerchant
    Events
        Game - The in-game time of day becomes Equal to 6.00
        Game - The in-game time of day becomes Equal to 18.00
    Conditions
    Actions
        Unit - Order "Merchant" to Move To (Random point in MerchantRegions[(Random integer number between 1 and "number of regions")])

If the event is "game time", it doesn't matter where he starts...


If you don't like arrays, go with the other suggestion up here:
a couple of "if then"s...
 

DM Cross

You want to see a magic trick?
Reaction score
567
Hmm...He didn't move...Maybe because he's a structure...Any ideas, there, Mister 200?

-Edit-
Hmm...maybe he'd move if he had MOVEMENT SPEED, ALEXANDER?! Good one, right? -.-

To Ace:
Thanks, I think I got arrays already...Though, since i started this way, i might want to just finish it up like this...However, I wouldn't be surprised to know you're way creates less lag, since it seems to be only one trigger...So i'll deffinately try it later ;) But for now -.- stupid walkess bastard of a merchant (am i allowed to say that about non-existant merchants?)
 

DM Cross

You want to see a magic trick?
Reaction score
567
Ok, it...Sort of worked...Well, he ran this time, it's just that he ran into trees and stopped moving -.- Ace, I'm not sure if your idea would work because I think he'd just get stuck like this more often...I think I just have to place a few regions around to avoid this...

Also, if I do something like

E: Merchant enters MerchantRegion1
C: Owner of Merchant is equal to Neutral Passive
A: Wait x seconds
Order move to Merchant Region2

Do you think that would work to, as you stated, make him 'not run away from you'?
 

Rinpun

Ex TH Member
Reaction score
105
Hey man, maybe you should add the ability wander or something too if you want the merchant to stick around. Aka, if he's at a place waiting for the time to go by, he's not just sitting there...but wandering around the general vicinity until he has orders to move to another spot.
 

DM Cross

You want to see a magic trick?
Reaction score
567
Awesome idea! :D Ty! Added that...Now let's see if he wanders in the spot, or just starts wandering :p
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
Anything posted here will work, with some tries.
However, if he gets stuck in trees, there's a problem with your map layout...

WC3 has a rather advanced pathing, meaning that,
if there is a way to go, the units will find it.
If they stop somewhere in the middle... hm...
 

DM Cross

You want to see a magic trick?
Reaction score
567
What I did was I added a few more Regions so that he'd walk AROUND the trees...

Ace, it wasn't that he COULDN'T find a way around, it's just the way the trees were set up he got stuck in a hook...

X, I added a wait onto a certain 3 triggers so those will be his 'Selling spots' I guess...
 

DM Cross

You want to see a magic trick?
Reaction score
567
Grroar...Something went odd with the first spot he was supposed to stay...He just kept moving back and forth, but after awhile...Grroar some more, I think I'm just going to make him as slow as peanut butter and make him walk to each place one after the other -.-
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top