Conquer building by remain in its range (more complicated than this)

Tothumn

New Member
Reaction score
4
Hi!

My goal is to conquer (change ownership) an enemy building by getting close to it (lets say range 600) and remaining there for a while.But pause the effect when an other unit (non-structure ,controlled by owner of the building) is also in range and reset when no units of the conqueror player left in range.
When a third enemy unit appears make sure that when time expires give the building to the conqueror who was there first.
Different buildings take different time to conquer and there are a few types that cant be conquered.
It also would be nice to show both players somehow how the conquering goes, but its not as important as allowing multiple conquerings at the same time for every player.(so when there are 4 buildings in range, start conquering all of them)
Every non structure unit on the map that is controlled by user can conquer.

I think it sounds like a challenge. :rolleyes:
If someone could do a system like this for me i'd give special thanks and +rep.And it would be useful for others as well because it is more elegant and also a little bit different than the old "HP is below amount change ownership to owner of attacking unit" solution. If you want to take something chase the owner away if you want to keep it arrive in time and chase the attackers away. Pretty realistic isnt it?


I couldnt do this but of course I tried, and maybe only a little scripting knowledge stands between me and the solution so here is what i've done so far:

I gave mana to buildings and set mana regen -1/sec by trigger. I gave all units 2 types of brilliance aura. -1mana for all own structures in range 600 and +2mana for all enemy structures in range 600 and a 'conquer' named buff for the second aura.
Then here is a trigger which supposed to change the ownership when the buildings mana becomes 100% :
Trigger:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Triggering unit) has buff Conquer ) Equal to True
    • Actions
      • Wait until ((Percentage mana of (Triggering unit)) Equal to (Percentage mana of maxmana 0009 <gen>)), checking every 1.00 seconds
      • Unit - Change ownership of (Triggering unit) to (Owner of (????? unit)) and Change color
      • Unit - Set mana of (Triggering unit) to 0.00


Conquer is the buff the conquerors aura has, and maxmana 0009 is just a unit that always has 100%mana.

As you see i cannot describe who supposed to get the building, not to mention the third player problem. Everything else is solved this way.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
when the unit enters the region, if variable x (unit variable) is equal to no unit, or owner of the target building is equal to an ally of the owner of the triggering unit, set it equal to triggering unit, then use owner of X unit

then when the owner is changed set the variable back to no unit, that way when a unit enters the region that is an enemy of the unit after it is captured can recapture it, but if an ally enters it does not change the X unit variable from no unit
 

Dirac

22710180
Reaction score
147
I've already coded this using vJass, do you mind? i'll post it in this post if you're fine with it
 

Tothumn

New Member
Reaction score
4
Sure im interested!

Gfreak I hardly get your solution and I cannot script and I dont think its possible without local variables for every region.And how to make these regions? I dont really get what happens when a second enemy player arrives.
 

inevit4ble

Well-Known Member
Reaction score
38
You can goggle "contol point tutorial". I'm on my phone else I would link it but it should give you a better understanding.
 

Smitty

Member
Reaction score
20
This seems pretty simple, I'd write out a whole set of triggers (actually you'd only really need one or maybe 2) but I'm also on my phone, plus I'm sure there are loads of resources for this kind of problem already. If you still have a problem tomorrow I'll be able to write you a full solution then, but it sounds like these guys have the answer. Good luck ^.^
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
Sure im interested!

Gfreak I hardly get your solution and I cannot script and I dont think its possible without local variables for every region.And how to make these regions? I dont really get what happens when a second enemy player arrives.

basically, when a unit enters the range of the building being captured it will set that unit to the one that is capturing it if it is not already being captured, but once captured it can be captured again but only by enemies of the owner and i pretty much did everything needed in the trigger in my post short of actually going into W.E and copying a trigger
 

Tothumn

New Member
Reaction score
4
Uhh...

Thanks for explaining and sorry for being dumb but Its still not clear, lets go into details.

First my main issue: I still think it would not work because X (the unit variable) can store only 1 unit at a time. So what if P2 footman enters region of P1 barracks (X=P2 footman) and conquering is in progress while a P3 grunt rush through the region of P4 Barrakcs (X=P3 Grunt) then P1 barracks mana becomes 100% and barrack changes ownership to P3 instead of the conqueror P2. It would be a very common bug that the one who has entered one of the regions later, get all the ownership changing buildings in the game until he is the latest.

and there are other things but these might be only my ignorances, I underlined the problematic parts:

when the unit enters the region[SUP]1[/SUP], if variable x (unit variable) is equal to no unit, or owner of the target building[SUP]2[/SUP] is equal to an ally of the owner of the triggering unit, set it equal to triggering unit, then use owner of X unit

1, Which region? There are no regions. All the buildings will be built in the game and I dont know how to attach a region to each and how to distinguish them.But if the event differs from your suggestion then the conqueror unit cannot be specified.

2, There is also no target building ( I assume) "target unit" or "target unit of ability being cast" can't refer to the building which has a buff because of a passive ability.And inside the action I cannot set a boolean comparison that checks if the targeted unit is a building or not, and I couldnt set "equal to an ally of the owner of the triggering unit" either.:(
 

Smitty

Member
Reaction score
20
I think he actually wanted more functionality than that. I'll be able to get at the WE in a couple of hours, I'll slide you an answer then. One question which might make this easier; do your towers cast spells or use mana at all?
 

Smitty

Member
Reaction score
20
Here's what I've managed to do without the editor in front of me. Sorry if it's a bit hard to understand in places, I'll sort that out if needed when I can get at the WE. Ditto to some of the long-windedness of the checks. But it should do what you want;

Capture points;

Create a custom buff (called capture). Create a trigger so that as soon as a building is built, if it matches the conditions that you want, it has the 'capture' buff permanently. This building is then capturable. Set the mana for each building to the number of seconds you want it to take an enemy unit to capture it.

Variables;_

Capturing tower (building)
Alliancecheck (unit group)
Allianceunitcheck (unit)

Events;
Every 1 second

Conditions

Actions;
Pick every unit in playable map area matching conditions (is a building, has capture buff, is alive) and do actions;
>Set variable (capturing tower)=picked unit
>IF number of units matching conditions (is an enemy of picked unit, is not a building, is alive) within 600 range of picked unit = 0
>THEN set mana of (capturing tower) to 100%
>set variable (capturing tower) = no unit
>ELSE pick every unit in 600 range of (capturing tower) matching condition (is alive, is not a building) and do actions;
>> add (picked unit) to unit group (alliancecheck)
>> set variable (allianceunitcheck)=picked unit
>>pick every unit in (alliancecheck) and do actions;
>>>IF (picked unit) is an enemy of (allianceunitcheck)
>>>THEN
>>>ELSE (reduce mana of (capturing tower) by 1.
>>IF mana of (capturing tower) = 0
>>THEN change ownership of (capturingtower) to owner of (allianceunitcheck)
>>ELSE nothing
>>set variable (allianceunitcheck)=no unit
>>set variable (alliancecheck) = no units
>set variable (capturing tower) = no unit

EDIT: Ignore underscores, they're there because I copypasta'd this across from a 'note'.
This is a my own work, so while I'll be happy to lap up the fame,'glory, and supermodel girlfriends I'm sure this will bring me, I'll also try to fix any problems ;) but try it out, as I say I currently can't :(

Also, I typed all this shit for you on my phone there had BETTER be some kind of reward. Preferably money. Or food. Especially if it's cake! ;)

Hope this works, good luck :)
 

Tothumn

New Member
Reaction score
4
I go sleep now but I'll think it through tomorrow.
Its amazing even if it not works LoL :D

what if instead of alliance unit check I check whether:
>>>IF (picked unit) is an enemy of (capturing tower)

and THEN
(reduce mana of (capturing tower) by 1.
(instead of ELSE)
 

Smitty

Member
Reaction score
20
Ah, you've not quite got it right, I'll draw it out properly now I can :)

And the reason it checks against the unit picked is because if there is a unit within range of the tower which belongs to a different player, that means there are 2 different players in the zone, therefor you want it to do nothing, surely? Otherwise how would you decide which player captured the tower? That also covers a situation in which there are allies of the tower defending it.

Here it is, uses a couple of different methods, but still basically the same, should just use a bit less CPU.

Instead of the variable AllianceCheck, use Capturing.

Screen shot 2011-08-27 at 03.17.46.png

You can see I used the Banish buff instead of creating a custom one... because I'm lazy :]

I'm not entirely sure my variable cancelling is correct (those last 3 or so lines) maybe someone would like to point it out, but I'm tired, so that's my excuse :]

Hope this works ok :D

EDIT: Hmm, tested it in a few basic situations, but it doesn't seem to always work. Tweaking it as I can, but I may need some help to spot the obvious mistake :x
 

Tothumn

New Member
Reaction score
4
I was tired too, I used Triggering unit instead of matching :nuts:

I think your efforts so far worth some +rep, but dont run away, the girl with the money in the cake is still waiting for you :D

Ill make your new trigger ,maybe I will spot something...
 

Smitty

Member
Reaction score
20
Hmm, seems there's an issue with not capturing if there's an ally of the tower in range. I'll try making it as 4 seperate triggers, to simplify things, since I think the 'event response' unit references are confusing it/me a bit. screenshots pending :)
 

polo2005

Wana start playing LoL? http://tinyurl.com/369as27
Reaction score
97
out of curiosity i got to ask, i'm a bit confused what you meant by "When a third enemy unit appears make sure that when time expires give the building to the conqueror who was there first."
there is more than 2 players, or do you meant when it become a 1vs2 in unit numbers?
 

Tothumn

New Member
Reaction score
4
I tested and actually Im fine with this. You have to chase the ally away too to get the building.

EDIT: polo, there is more than 2 players of course :)
that makes msot of the problems
 

polo2005

Wana start playing LoL? http://tinyurl.com/369as27
Reaction score
97
so the problem is solved? :)
do you mind if i'm try to make my own version just for fun?

another question, is the buildings placed from start?
 

Smitty

Member
Reaction score
20
I tested and actually Im fine with this. You have to chase the ally away too to get the building.

EDIT: polo, there is more than 2 players of course :)
that makes msot of the problems

Hmm, I didn't test it too specifically, but I can't, reading it through, see any reason why it wouldn't work. I'd suggest testing with multiple buildings being captured at once, multiple players capturing the same tower, and combinations of all scenarios. If it works, good stuff :D

One potential problem; instead of comparing UnitAllianceCheck with all units in capturing, instead make another 'pick' action, picking all units within 600 range of Capturing tower matching conditions (is not a building, is alive) and add them all to a unit group 'AllianceCheck'. Then run an alliance comparison with a random unit from Capturing against all units from AllianceCheck. Should help the trigger to detect allies/multiple forces. If it works as it is, then leave it, but I'd suggest some more rigorous testing, while my brain is on the subject :p

Good luck :)

EDIT: @ Polo; no, he wants buildings to be built throughout the game. Makes it a bit more complicated, but since the only other way to do it that I can see off the top of my head would be to create a trigger for each tower (if you were using regions), it wouldn't be as neat and tidy a method anyway ;)
 

Tothumn

New Member
Reaction score
4
There were only one issue:
When 2 allied players go to capture an enemy building, it doesnt matter who arrived first, the building will be given away randomly between them.

Now I tried to do the change, but the buildings do not change ownership because AllianceUnitCheck is no longer in use. And giving it to a random unit from Capturing ends with the same result. ( I didnt test this yet)
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top