HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Triggers for buildings within a "Restriction Region"

08-06-2003, 03:06 AM#1
Desert_Eagle25
Since my last idea flopped, I am trying to do a Zoator TD-Like destroying thing where if any towers are constructed in a region that doesnt belong to the region owner, the owner of the region (Player color and number) can type "-restricted" and any towers not belonging to that person (Player color and number) are destroyed. I was only able to get the Event down as a chat message, but I dont know what to do for Conditions and Actions. Any help, please? Thanks in advance :D
08-06-2003, 04:03 AM#2
Newbieff
condition should be something like:

chat message equals to "-restricted"

action:
(hmmm....is there like one that says NOT belonging to player? if there isnt....then this)

destroy every unit owned by player xx in region YY
then repeat with every player cept the one that the region belongs to
08-06-2003, 05:27 AM#3
Desert_Eagle25
Sorry, can't find that...but if it's there, how do I get there? I can't find any options for destroying a unit belonging to a player..
08-06-2003, 07:05 AM#4
Neo_Genesis
There are a couple ways to do it, I actualy did it in my TD map NeoWarz TD.

You can use an Event to detect a unit placed in a region or you can do it with the chat message I post the code for both for you

Chat Message first
(note you do not need the quotes)

Event
Player - Player 1 (Red) types a chat message containing "-" as A substring
Actions
If(All conditions are true) then do (then Actions) Else do (esle Actions)
If-Conditions
(Entered Chat string) Equal to "-restricted"
Then
Unit Group - Pick every unit in (Units in("Your_region_name here")) and do (Actions)
Loop - Actions
If-Conditions
(Owner of (Picked Unit)) Not Equal to (Triggering player)
Then
Unit - Kill(Picked unit)
Else
Else

that will work for your chat string, event for instant placement coming in a moment.
08-06-2003, 07:16 AM#5
Neo_Genesis
Method Two

Unit Dection

Event
|->Unit - A unit enters("your_region_here")
Conditions
|->(Owner of(Triggering unit)) not equal to Player 1 (Red)*
Actions
|->Unit - Kill(Triggering unit)

Both of those will work.

For multiple regions just make an array of regions and replace "your_region_here" with region_array[0] or region_array[(player number of(triggering player))] or region_array[[(player number of(owner of(triggering unit)))]

for the * you can just change out the player to who ever is in the region

I hope those help you out.

Neo_Genesis
08-06-2003, 07:40 AM#6
Desert_Eagle25
I like Method 2 better, i actually understand it more, lol. The action of killing the triggering unit effects invulnerable units, right? I actually dont want it to kill people's workers, just their buildings they build, as I made all the workers Invulnerable.
08-06-2003, 07:53 AM#7
Desert_Eagle25
BTW, what are the If-Conditions?
08-06-2003, 07:55 AM#8
Neo_Genesis
it does effect all units however you can add to the conditions

Conditions
|->Unit - Unit Type of(Triggering unit) not equal to "your_worker_unit_type_here"

eaxample:

Conditions
|->Unit - Unit Type of(Triggering unit) not equal to Peasant
08-06-2003, 07:58 AM#9
Neo_Genesis
In TFT they added branching If conditions

so instead of working with if(this and that and this or this) then (do that)

you get a branchable tree that is much esayer to add/remove things from

its under basic actions just hit the i key it should be the first one
08-06-2003, 08:17 AM#10
Desert_Eagle25
Also, isn't it more efficient if you use 'Unit - A unit is contructing' in "my_region" and 'Unit - A unit is constructed' in "my_region" ??
08-06-2003, 08:20 AM#11
Neo_Genesis
yes it is =D
08-06-2003, 10:02 AM#12
Desert_Eagle25
Thanks ALOT Neo! With some testing and configuration I think i can get it to work! Your my life saver, I owe you one, big time.
08-06-2003, 05:30 PM#13
Desert_Eagle25
Quote:
Originally posted by Neo_Genesis
There are a couple ways to do it, I actualy did it in my TD map NeoWarz TD.

You can use an Event to detect a unit placed in a region or you can do it with the chat message I post the code for both for you

Chat Message first
(note you do not need the quotes)

Event
Player - Player 1 (Red) types a chat message containing "-" as A substring
Actions
If(All conditions are true) then do (then Actions) Else do (else Actions)
If-Conditions
(Entered Chat string) Equal to "-restricted"
Then
Unit Group - Pick every unit in (Units in("Your_region_name here")) and do (Actions)
Loop - Actions
If-Conditions
(Owner of (Picked Unit)) Not Equal to (Triggering player)
Then
Unit - Kill(Picked unit)
Else
Else

that will work for your chat string, event for instant placement coming in a moment.


For the

" Then
-Unit Group - Pick every unit in (Units in("Your_region_name here")) and do (Actions)
--Loop - Actions"

What do I replace both of the "actions" with?
08-06-2003, 05:50 PM#14
Desert_Eagle25
Anyone still willing to help?
08-06-2003, 06:11 PM#15
Neo_Genesis
replace the actions with?

you mean the actions at the end of
Unit Group - Pick every unit in (Units in("Your_region_name here")) and do (Actions) ?

you dont actualy change that actions the code maybe writen out better would be

This is a comment to help explain what is going on in the code

Event
|-->Player - Player 1 (Red) types a chat message containing "-" as A substring
**A player types any word that has "-" in it this allows you to add multiple commands under the same trigger and save space**
Conditions
Actions
|-->If(All conditions are true) then do (then Actions) Else do (else Actions)
......|-->If-Conditions
............|-->(Entered Chat string) Equal to "-restricted"
**This multiplue if statment checks to see what command was entered in this case it is looking for -restricted**
..........Then
..........|-->Unit Group - Pick every unit in (Units in("Your_region_name_here")) and do (Actions)
**This will pick all units in a region you specify, again you can replace "Your_region_name_here" with a varrable array of regions and just use: array_name[(player number of (triggering player))]**
..............|-->Loop - Actions
...................|-->If(All conditions are true) then do (then Actions) Else do (else Actions)
........................|-->If-Conditions
.............................|-->(Owner of (Picked Unit)) Not Equal to (Triggering player)
.............................|--> Unit - Unit Type of(Picked unit) not equal to "unit_builder_type_here"
**Make sure the unit does not belong to the person who typed "-restricted" and that it is not a builder type unit (you have to put the unit type in for the builder**
.............................Then
.............................|-->Unit - Kill(Picked unit)
.............................Else
Else

I hope that is maybe a little more clear on what is going on.

If you want you can check out my TD map for code at
http://www.geocities.com/neowarztd/