Travelling Merchant

DM Cross

You want to see a magic trick?
Reaction score
558
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?
 
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.
 
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 ;)
 
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").
 
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.
 
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
 
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
 
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 ^.- .
 
... :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?
 
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 ;).
 
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?)
 
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...
 
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?)
 
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'?
 
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.
 
Awesome idea! :D Ty! Added that...Now let's see if he wanders in the spot, or just starts wandering :P
 
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...
 
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...
 
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.
  • A Andyoyo:
    Thank you for the hard work over the years. It did not go unnoticed.
  • U Uberplayer:
    Thanks for everything!
  • XXXconanXXX XXXconanXXX:
    And we JUST got a new warcraft 3 campaign after 20 years! Bummer lol. Thanks for building and maintaining such an awesome community over the years TheHelper! Forums like these are definitely a relic of their time, and in its heyday it really was the place to be in its niche. Hopefully the discord community stays active!
  • WildTurkey WildTurkey:
    All the best helper
  • WildTurkey WildTurkey:
    Thanks for what you have done for me and my family
  • WildTurkey WildTurkey:
    I wish you all the best and am saddened to say goodbye
  • The Helper The Helper:
    That is fantastic WildTurkey I am so happy to hear that! Bless you and your family!
  • The Helper The Helper:
    and i dont think I am going to close the site it is just likely to change drastically but I am working on something for the interim still fleshing it out. Most of the forums are going to be gone though and the NUON site and Warcraft sites will probably to to different hosts. I might keep the news forum though :)
    +1
  • The Helper The Helper:
    So I paired down the forums to what is going to be in the interim
  • The Helper The Helper:
    I might also just go for one news forum and make it Headline News only all that sub forum stuff was busy work on my part i think :)
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    I know right
    +1
  • Varine Varine:
    It's been great guys, I appreciate you having kept it up for so long! I feel like this has been a big part of my growing up in life, and I do very much appreciate everything that this forum has been able to give to me. So thank you.
    +2
  • Varine Varine:
    If there's bits still around I am willing to bet I will be, but I honestly wouldn't be too upset if some of my teenager posts were to no longer be around. I was a little fucking problem back then
    +1
  • Varine Varine:
    I'm going on a backpacking trip pretty soon. I've been trying to do it for a few years now and it just couldn't happen. I'll be by myself, and I think it'll be really good for me. My pack is already too heavy so I can't bring alcohol, and that might be a benefit to me. Like had that probation and couldn't drink, but it's a bit different when you can't do something voluntarily versus threat of literal imprisonment
    +1
  • Varine Varine:
    The trail is 40 miles altogether, but I'm planning on cutting cross country a bit because I want to camp on top of this mountain. I'm bringing a little telescope, if there's still a place for it I'll post some pictures when I get back!
    +2
  • jonas jonas:
    honestly there's nothing on that trip that would become better by drinking
  • jonas jonas:
    looking forward to those pictures
  • The Helper The Helper:
    Happy Thursday people! I think I have come up with a new direction for the site. One that will never fizzle out because a game is not popular anymore. I think I am going to try to make TheHelper.net a place that helps people with real stuff as much as it did with game technical support back in the day. Stay tuned...
    +3
  • The Helper The Helper:
    Happy Tuesday!
    +1
  • The Helper The Helper:
    Happy Thursday! Hope everyone has a Fantastic Day!
    +2
  • The Helper The Helper:
    Happy Thursday everyone. I hope everyone has a blessed day!

The Helper Discord

Members online

No members online now.

Affiliates

Hive Workshop NUON Dome World Editor Tutorials
Back
Top