• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Played-Owned Regions

Status
Not open for further replies.
Level 3
Joined
Jul 14, 2008
Messages
41
Hey there,
I have always had problems with this.
I want to make a region that is owned by a player. The regions are already made (called "lot"s) and can be bought by players.
With "owned by a player" I mean that only the player owning that region can build there.
This is in GUI by the way. Any tips/info?
Thanks in advance.
 
1. Create a variable (array of regions pR_r) that will contain all regions that can be owned by players.
2. Create a variable (array of players pR_p), which will contain the owners of regions (var 1 ^).
3. Create trigger:
||Conditions
A unit enters Entire map
||Solutions:
Boolean(Unit is a building) == true
||Actions:
For each integer A from 1 to {size of your array} do multiple actions:
|if (Multiple conditions):
||(pR_r[integer A] contains Triggering unit)
||(Owner of Triggering unit is not pR_p[integer A])
|Then:
||Kill Triggering Unit
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
Create an Integer variable with an index for each region you have (e.g. RegionOwner[x]). When a unit buys a piece of land, set RegionOwner[BoughtRegion] = (Player number of (Owner of (Buying unit))).

To make sure only that player can build there, you should have to make some wall around it and a circle of power that will only teleport the unit of the owner of that land onto it.
 
Level 3
Joined
Jul 14, 2008
Messages
41
That is the problem, I want people to be able to walk onto other player's regions but only the owner will be able to build there.
 
Level 4
Joined
Feb 2, 2009
Messages
71
The easiest way, is to change in

Advanced - Game Constants
Cancel Refund Factor - Building Construction

so that you get all the money back when a building is cancelled. Then you order the building to cancel construction if built were it shouldn't.

Or if you're mean... just leave the game constants be, making them who violates the rules, lose 25% of the construction cost.
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
Wouldn't that be dangerous concerning resources spend on it? I also don't know if the building will be prevented from starting when the builder is already at the position where the building should be build (because there's no interval between moving and building then).
 
Level 25
Joined
May 11, 2007
Messages
4,650
Wouldn't that be dangerous concerning resources spend on it? I also don't know if the building will be prevented from starting when the builder is already at the position where the building should be build (because there's no interval between moving and building then).

If the unit stops before he builds a structure the resources are returned back, try a melee map for example.
 
Level 3
Joined
Jul 14, 2008
Messages
41
Try something like

  • Events
    • Unit - a unit is issued an order targeting a point
  • Conditions
    • Issued order equal to "farm" or issued order equal to "barracks" or...
    • AND
    • Region[0] contains (targeted point) equal to true
  • Actions
    • Unit - Issue (triggering unit) to stop

I tried that but I couldn't get it right, I tried using variables like Region[array] but I have to make a variable for each region (since the array is used to determine whos the owner of the region, for example Region[2] belongs to the Player 2) and well... there are a bunch of regions.
 
Status
Not open for further replies.
Top