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!
im doing trigger that if you pick a dialogue option your starting units and building will get replaced with alternative one, but for some reason my tree of life is
First of all displaced and second of all it destroys entangled gold mine. Any idea how i can start game with tree in right place and my custom made gold mine?
Ok, so you have two problems:
1. custom town hall unit's location is misplaced after replacing original town hall unit.
2. gold mine is no longer entangled after replacing original town hall unit.
Ad 1:
Misplacement happens due to Wisp units being too close to the town hall unit (most likely, they already entered the "blue" part of its pathing map).
What worked for me was to simply hide workers of that player, then replace town hall and finally unhide workers.
Second, a bit more scripted but more universal option, is to store town hall's position into variable, then replace the town hall, then move the town hall to the location given by variable (using custom script SetUnitX and SetUnitY commands) and finally hiding and unhiding the town hall (SetUnitX/Y does not update pathing map, but hiding and unhiding the structure does update it).
Here are examples for both options:
Test 1
Events
Player - Player 1 (Red) skips a cinematic sequence
Conditions
Actions
Set VariableSet WorkersGroup = (Units owned by Player 1 (Red) matching (((Matching unit) is A peon-type unit) Equal to True).)
Unit Group - Pick every unit in WorkersGroup and do (Actions)
Loop - Actions
Unit - Hide (Picked unit)
Unit - Replace Ancient of War 0002 <gen> with a Tree of Life using The old unit's relative life and mana
Unit Group - Pick every unit in WorkersGroup and do (Actions)
Ad 2:
Entangled Gold Mine is bound to the Tree of Life that entangled it. Replacing that Tree of Life is same as if you destroyed it during game -> Entangled Gold Mine will become a standard Gold Mine.
You can see here what happens when you start as a Night Elf player: Doc - MeleeStartingUnitsNightElf
Of note is this part of the script:
JASS:
set nearestMine = MeleeFindNearestMine(startLoc, bj_MELEE_MINE_SEARCH_RADIUS)
if (nearestMine != null) then
// Spawn Tree of Life near the mine and have it entangle the mine.
// Project the Tree's coordinates from the gold mine, and then snap
// the X and Y values to within minTreeDist of the Gold Mine.
set nearMineLoc = MeleeGetProjectedLoc(GetUnitLoc(nearestMine), startLoc, 650, 0)
set nearMineLoc = MeleeGetLocWithinRect(nearMineLoc, GetRectFromCircleBJ(GetUnitLoc(nearestMine), minTreeDist))
set tree = CreateUnitAtLoc(whichPlayer, 'etol', nearMineLoc, bj_UNIT_FACING)
call IssueTargetOrder(tree, "entangleinstant", nearestMine)
...
So they determine the location of a nearby Gold Mine, create a Tree of Life next to it and then order that Tree of Life to cast "entangle instant" on the Gold Mine.
In your case, you already know the position, etc. since you are just replacing Tree of Life with your custom one. So what you just need to do is find the nearest Gold Mine and order your town hall to cast entangle instant:
Unit - Order Your_Custom_TreeOfLife to Night Elf Tree Of Life - Entangle (Instant) Some_Gold_Mine
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.