HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Regional Triggering

07-23-2006, 07:35 AM#1
SilverSong
I'm doing an epic adventure, exploration, survival map.

What I want is that when an explorer enters the center of the region, it triggers 1 to 3 units to spawn within the region.

But I also want to limit the amount of creatures/resources that spawn.

Should this be an array? I'm having trouble figuring out what the exact trigger should be.

Also once I get all the regions done I want to be able to variable them so that they are never the same place on start up. Like for example right now region 1 spawns tigers, and region 2 spawns elks, and region 3 spawns centaurs. I want it so that on the start of game region 1 could spawn either tigers, elks or centaurs, and so could regions 2 and 3. But I don't want the regions to duplicate either, and I don't want a resource spawned from any region to be missing.

I plan on having about 30 resources that can be found... maybe more.
07-23-2006, 08:15 AM#2
karukef
I can't give you the entire triggers for doing all that, but here is how I would do it in a pseudo-step by step way, trying to keep it easy:
  • Place out all the regions I want on the map
  • Create an array that I at start of map initialize to refer to each regions. If there are 10 regions, the array will have 10 elements in it.
  • If you really need to have a different type of creature spawn in each region, and also not duplicate it, it's a bit complex: You could create an equally sized array of integers (i.e 10 integers, 0-9). Then you could shuffle it (someone must have made some Jass or a trigger for shuffling an array?) Then, when a unit enters a region, you go through the region array using a loop and find out which region was entered. Let's say the unit enters region #3 in that list. Then you get the integer #3 from the integer list, which is by now a random number 0-9. Then you can do whatever suits: you could make it spawn Elks if the number is 0, Tigers if it's 1, Centaurs and Mutant Slugs if it's 2 - whatever suits the map.
  • For the resources, I am not sure what 'a resource' is, but just make an array of all possible resources then go through it creating 1 or more of it on the map, which guarantees that you create all possible resources. Just make sure that the spot you decide to create the resources is accessible :)

If anything is unclear or if I misunderstood anything just point it out, and me or someone else will surely help you on.
07-23-2006, 09:16 AM#3
SilverSong
resources are gold and oil
07-23-2006, 10:34 AM#4
karukef
So when you say 30 resources, does that mean 30 gold and oil? I thought you meant 30 different resources :)
07-23-2006, 06:51 PM#5
SilverSong
30 different resources, I guess I could list them all.

Some are aquired, some can be refined. Some require killing animals to get. Some are purchased directly from stores, while others you just need to stand in their zones to aquire them. I plan on adding more to the list later on.

Overland routes, Level 1 only.
Level 1 Trade Goods: Bones, Myrrh, Gold, Ostrich Feathers, hatchets, daggers, necklaces, jade, iron, animal skins, lumber
From Center: Bones, Myrrh, Gold, Ostrich Feathers,
From Central South: hatchets, daggers, necklaces, Jade
From Central East: Iron Ore, Animal Skins, Lumber

Oceanic routes: Level 1 and up
Level 2 Trade Goods: Glass, Spices, Weapons, Tools, Jade Refined, Gold Refined, Ivory Tusks, Rhinocerous Horn, Slaves, Animal Hides

From North West: Glass, Spices, weapons, tools, Jade refined
From South East: Gold, Ivory, Rhinocerous Horn, Slaves, Animal Hides

Level 3 Trade Goods: Ponies, Skilled Labor, Velvet, Silk, Skilled Labor, Iron Refined, Merchanteering Technologies.
From Central: Scrying Bones, Incense, Gold items, Ostrich Fans,
From Central South: +2 Hatchets, daggers, enchanted necklaces, Refined Jade
From Central East: Refined Iron, Fur Coats, Seasoned Lumber

Level 4 Trade Goods: Dyed Silk, Fine Wines, Skilled Labor, Coral Reefs, Merchanteering Technologies II, Mercenaries

Level 5 Trade Goods: Fine Silk Robes, Fine Fur Cloaks, Milled Lumber, Oil, Fine Jewelry, Salted Fish, Grapes, Barley.

Level 6 Trade Goods: Lace, Dragon Scales, Steel Ore, Goldstone, Unicorn's Horns, Cocoa Beans, Fine Craftsmen Tools,

Jade, Gold, Silk, Silver, Ivory, Lumber, Fine Wine, Skilled Labor, Coral Reefs, Velvet, Myrrh, Merchant Vessels, merchant vessel upgrades, trade cities: Central


For animals and Lumber I already wrote my own codes, but I was wondering if there was a way to give them a facelift from the old RoC codes, beyond creating regions for all of them. My goal on such a facelift would be to reduce the number of strings necessary to achieve the same results therefor making the whole code smaller and more compact.

Short example, I didn't feel like pasting it all in. But it goes through Players 1-10 like this.

Trigger:
fishing
Events
Unit - A unit owned by Player 1 (Red) Acquires an item
Unit - A unit owned by Player 2 (Blue) Acquires an item
Unit - A unit owned by Player 3 (Teal) Acquires an item
Unit - A unit owned by Player 4 (Purple) Acquires an item
Conditions
?Unit Type of ((Hero Manipulating Item)) Equal to Pool
Actions
If (((Item-type of (Item being manipulated)) Equal to The Lion Horn of Stormwind) and ((Random integer number between 1 and 2) Equal to (Random integer number between 1 and 2))) then do (Item - Create at (Position of (Triggering unit))) else do (Do nothing)
If (((Item-type of (Item being manipulated)) Equal to The Lion Horn of Stormwind) and ((Random integer number between 1 and 4) Equal to (Random integer number between 1 and 4))) then do (Item - Create at (Position of (Triggering unit))) else do (Do nothing)
If ((Item-type of (Item being manipulated)) Equal to The Lion Horn of Stormwind) then do (Hero - Drop (Item being manipulated) from (Triggering unit)) else do (Do nothing)
If ((Item-type of (Item being manipulated)) Not equal to The Lion Horn of Stormwind) then do (Hero - Drop (Item being manipulated) from (Triggering unit)) else do (Do nothing)