Welcome Guest [Log In] [Register]
ZetaBoards - Free Forum Hosting
Enjoy forums? Start your own community for free.
Viewing Single Post From: Triggering [GUI/MUI/vJASS] Question and Answer.
Member Avatar
Crypt Lord Level 3
[ *  *  * ]
Lufion question, found from this link

Im not that bad actually but well forget it. It works now, and I have a new question so if you dont mind to help.

Now I want to make a "Base System" so I made a Circle and in that circle I created a region called Base.
Also I have severel Towers called "Base Tower" that shall act as defence towers that surround the Base.

So now I want that if a Hero enters the region i made in the circle, the towers and the circle change theyre ownership to the Player that owns the hero that entered the region. I managed to do that with no problems, and created 2 Variables,
First = triggering unit,
Second = Units owned by the owner of the entering Unit matching is mechanical = true / the towers are mechanical

As I said the first part works so, when a unit that has to be a hero, enters the region, the towers and the circle change theyre ownership to the owner of the entering heroes colour.

The problem is now that I cant make it undo. So I want it to kinda reset when the Hero that entered the region dies
meaning that the tower and the circle go back to theyre neutral passive faction and change theyre colour to grey again, until the next Player/Hero walks on the Circle to make them change again and so on.

So ive added this timer thing, that says Wait until Aka_Base //that is the triggering unit\\ is death equal to true checking every 1 seconds
and as action after it
Unit group - Pick every unit in Aka_Base2//so the mechanical units that are now under control of the triggering unit (entering Hero) that are in this case only the towers\\ and do actions
Unit - change ownership of picked unit//since I pick the units in the group as u told me\\ to neutral passive and change colour
and after that i removed everyone from group Aka_Base2

Effect : As i said i can walk with a hero in the circle and the towers and circle change ownership + colour to that one of the entered Unit/Hero but when the Hero dies nothing happens, so they dont change back to neutral passive and also dont change theyre colour.


Wow @@! will have lot of answers

Simple, just create a new player variable and name it to something like Default_BaseOwner and set it to the default owner. When the new owner dies, change the owner to Default_BaseOwner. And don't use Wait until the owner dies, create a new trigger and add Any unit dies event. Filter it (put condition) and do the owner change actions. Hope that is clear :)

Next, I will talk about bad things in the code.

1> In your code, you're using Units owned by the owner of the entering Unit matching is mechanical = true. I quite worry about this variable. You have to add a unit type filter or unit in region group, so the filter won't pick mecha units from the entire map.

2> Never use Wait action, it slows game performance.

3> Group leak, destroy the Aka_Base2 with Custom Scripts : call DestroyGroup(udg_Aka_Base2) at the end of the line

Anime Warfare Project

Posted Image

Terrain : |||||||||||||||||||||||||||||||||||||||| - 87%
Trigger : |||||||||||||||||||||||||||||||||||||||| - 48%
Character : |||||||||||||||||||||||||||||||||||||||||| - 18%
Decoration : |||||||||||||||||||||||||||||||||||||||| - 60%
Offline Profile Quote Post
Triggering [GUI/MUI/vJASS] Question and Answer. · Triggering Classes

War3 Modding

Blizzard Modding

Other Games


Models & Skins
Ongoing Contests
Hosted Projects
World of Warcraft
Starcraft 2
Diablo III
Heroes of the Storm
Dota 2
League of Legends

Copyright © 2011-2015 Chaos Realm. A project initiated by Bogdan Radu.