• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Halo-like Turret System

Status
Not open for further replies.
Level 8
Joined
Jul 18, 2010
Messages
332
Hi, does anybody here know the turrets in Halo?

Well, I'm trying to make a system wherein a neutral passive bunker/cargo/turret transports/carries a unit to make it attack. I've been searching a lot about bunkers and cargos but I can't seem to find anything that matches what I want.

When a unit rides the turret(it's kinda like a tower), the turret will be owned by the unit inside it. The turret is invincible and the only one that can be damaged is the one inside(this is the part which I clearly don't know how to do). When the unit inside the turret gets out or dies, the turret will be owned by neutral passive again. Anybody can use it, from any players up to neutral hostiles.
 
possible solution, which takes only very few triggers:

- Place one turret on top of each other for every player (set pathing to zero and remove the pathing texture, so that you are allowed to stack them) - copy the orc burrow for this one, as it already provides the ability to put units inside and allows to define an attack.
- Make the other dummy burrows (of other players) unclickable and invisible for the player by setting their scaling to 0 locally (use GetLocalPlayer() for that).
- When a unit entered the burrow, remove the burrows of other players, so that other players can not enter anymore. Create them again as soon as the unit leaves (use transport events) ... or you can just use "Hide Unit" to remove the other burrows temporarily
- edit the load ability for the burrows to allow only 1 unit inside - depending on which ability you base it of (burrow load or goblin zepelin load), you can also select wether it should accept all units or just units of a certain type
- adjust the max HP of the burrow to match the unit inside (search for "SetUnitMaxState" snippet on hive!)
- when the burrow dies, make sure the inside unit dies aswell
- when the unit leaves the burrow, set its life to that of the burrow


solution 2 (harder to trigger, but more elegant solution):
- instead of making the turret a burrow/transport, track all target order events on the units that need to enter the turret: if its a "smart" target order targetting the turret, set a global boolean for this particular unit to true (make a boolean array and use a unit indexer for that to make it MUI).
- if its a different order or targetting something else, set it back to false
- place a "unit enters range" event on the turret
- if enter range event fires, check if the boolean for the entering unit is true, if yes, instantly move the unit on top of the turret (disable pathing, set the position of the unit to that of the turret), also, change the ownership of the turret to the owner of entering unit
- Add locust to the turret, so it can't be clicked or targetted anymore (as people will want to target the unit on top of the turret)
- Pause the unit on top of the turret so it cant attack anymore
- The turret itself is locust, so it can not be targetted anymore (you do not want that anyway, as the entered unit shall be attacked instead of the turret), but it can still attack!
 
Last edited:
Level 8
Joined
Jul 18, 2010
Messages
332
I'm sorry I didn't get your first 3 points. I got the last one but I don't get the first three things that you said.

Edit: I think I'm getting it now but it sounds impractical. Setting the pathing to zero will make them walkable which I don't want. I was thinking, is it possible to make neutral passive be allied with all the other players and neutral hostile and make their turrets available for everyone. And then when a unit enters, the turret will be owned by that certain unit. And when it gets out, it will be owned by neutral passive again. Any unit can enter except for one.
 
Level 8
Joined
Jul 18, 2010
Messages
332
Your second solution is close but remember, you can't add the locust ability in triggers. Do you have any other solutions for that? How about just giving the turret locust ability at start and just put a pathing blocker on it?

Another thing, the turret will be a tower so I'm thinking of setting the transparency of the unit inside it to 100% so it can't be seen? Will it still be attackable?
 
Level 8
Joined
Jul 18, 2010
Messages
332
solution 2 (harder to trigger, but more elegant solution):
- instead of making the turret a burrow/transport, track all target order events on the units that need to enter the turret: if its a "smart" target order targetting the turret, set a global boolean for this particular unit to true (make a boolean array and use a unit indexer for that to make it MUI).
- if its a different order or targetting something else, set it back to false
- place a "unit enters range" event on the turret
- if enter range event fires, check if the boolean for the entering unit is true, if yes, instantly move the unit on top of the turret (disable pathing, set the position of the unit to that of the turret), also, change the ownership of the turret to the owner of entering unit

Ok, instead of tracking like that and since the game is like DOTA anyway (you get to control a hero), I'll just turn it into a command. When the hero is near the turret, the player needs to press the down arrow to enter the turret. Press down again to exit.

- Add locust to the turret, so it can't be clicked or targetted anymore (as people will want to target the unit on top of the turret)
- Pause the unit on top of the turret so it cant attack anymore
- The turret itself is locust, so it can not be targetted anymore (you do not want that anyway, as the entered unit shall be attacked instead of the turret), but it can still attack!

I actually need the hero to be unpaused but with 0 movement speed. I need to able to control the turret's attacks. The turret actually has one skill, so that's my problem right now. What I'm thinking is that, the attack of the turret will be triggered. The event will be, when the player clicks on a point on the map, the turret will attack ground that point(There are only two turrets at the map so I don't think it will lag).

My problem is, how am I going to trigger the skill. It's a target point skill, a missile skill. Any ideas? I'm thinking, the reason that I want the hero to be unpaused and have 0 movement speed so that it can look at any angle without moving(Not sure if the movement speed should be zero). And when the player presses the up arrow, a missile will launch to wherever angle his hero is looking at.

If anybody has a better idea, tell me please. And if anybody has any idea to make this trigger as efficient and elegant as possible, do tell me please.

EDIT: Another thing, the neutral hostiles can control the bunker, but of course they won't need the triggers above cause they are not player controlled. I'm thinking I'll just have a neutral hostile unit at start and when they are killed, no neutral hostile unit can enter again unless someone has an idea for this.
 
Ok, instead of tracking like that and since the game is like DOTA anyway (you get to control a hero), I'll just turn it into a command. When the hero is near the turret, the player needs to press the down arrow to enter the turret. Press down again to exit.
It's counter intuitive. I recommend tracking the smart order event on the turret. It's not that hard to do. You just need a boolean array, one boolean for every hero. If the order is smart on turret, set it to true. If it's any other order (else block), set it to false.
Then just make a trigger with the Enter Range event for that turret and check if the boolean of that hero is true. It's as easy as that and makes your map more intuitive to play.

I actually need the hero to be unpaused but with 0 movement speed. I need to able to control the turret's attacks. The turret actually has one skill, so that's my problem right now. What I'm thinking is that, the attack of the turret will be triggered. The event will be, when the player clicks on a point on the map, the turret will attack ground that point(There are only two turrets at the map so I don't think it will lag).

My problem is, how am I going to trigger the skill. It's a target point skill, a missile skill. Any ideas? I'm thinking, the reason that I want the hero to be unpaused and have 0 movement speed so that it can look at any angle without moving(Not sure if the movement speed should be zero). And when the player presses the up arrow, a missile will launch to wherever angle his hero is looking at.
If you want the hero to be able to turn, you must set the movement speed to 1 instead of 0 and periodically move the hero back to the turret position. The reason for that is that afaik a movement speed of 0 prevents a unit from turning (not 100% sure, you should try it out first!).

Making the turret hero controlled is easy: Simply catch target order or point order events on the hero and then order the turret to attack the order target.
For the turret ability, just add a dummy ability to your hero when it is in the turret and if the hero casts that dummy ability, do the same as with attack just for the turret ability. Locust units can cast spells.

If anybody has a better idea, tell me please. And if anybody has any idea to make this trigger as efficient and elegant as possible, do tell me please.
Another solution is using morphing.
You basicly transform your hero into a turret either by using the chaos ability or any other morph ability.

EDIT: Another thing, the neutral hostiles can control the bunker, but of course they won't need the triggers above cause they are not player controlled. I'm thinking I'll just have a neutral hostile unit at start and when they are killed, no neutral hostile unit can enter again unless someone has an idea for this.
All the turret triggers should also work with neutral hostile if done right. All you need is probably a different enter trigger, as neutral hostile is unlikely to have a hero.
 
Level 8
Joined
Jul 18, 2010
Messages
332
Thanks!!

I rather use this triggers than morphing. I have a fear for morphing, metamorphosis or any other transforming ability.

For the neutral hostile entering the turret, I rather just follow the thing wherein I'll just have a neutral hostile unit at start and when they are killed, no neutral hostile unit can enter again.
 
Level 8
Joined
Jul 18, 2010
Messages
332
NEW PROBLEM!!

I wanted the hero to be unpaused and its movement speed to be 1 and its transparency to 100% but I just remembered that it shouldn't be able to attack or cast a spell.

Anybody knows another way around this? The most efficient solution please.
 
Why would you want the hero to be unpaused if you don't want it to attack/cast?
What you can do is entangling/rooting the unit with a dummy ability with duration = 0.
This will perma-root the unit, allowing it to turn and get orders, but not to move. I think there's also an object data field in the ability that is able to disable attacks while rooted.
To end the rooting, simply remove the debuffs from the unit.
 
Level 8
Joined
Jul 18, 2010
Messages
332
NEW PROBLEM!!

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Rifleman Point Copy 7 <gen> contains (Picked unit)) Equal to True
    • Then - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked unit) is in bunkerherogroup) Not equal to True
          • (Owner of Desert Crossbow Bunker 0191 <gen>) Equal to Neutral Passive
        • Then - Actions
          • Unit - Change ownership of Desert Crossbow Bunker 0191 <gen> to Player 1 (Red) and Change color
          • Custom script: call UnitAddAbility(gg_unit_n06O_0191, 'Aloc')
          • Unit - Move (Picked unit) instantly to riflemanpoint_Copy_7, facing (Facing of (Picked unit)) degrees
          • Animation - Change (Picked unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
          • Unit - Set (Picked unit) movement speed to 1.00
          • Unit - Turn collision for (Picked unit) Off
          • Unit - Add classification of An Ancient to (Picked unit)
          • Unit Group - Add (Picked unit) to bunkerherogroup
          • Unit - Add Cargo Hold (Orc Burrow) to (Picked unit)
          • Unit - Create 1 spirit rain dummy for (Owner of (Picked unit)) at riflemanpoint_Copy_7 facing (Facing of (Picked unit)) degrees
          • Unit - Add a 0.25 second Generic expiration timer to (Last created unit)
          • Unit - Add Disable Spells to (Last created unit)
          • Unit - Order (Last created unit) to Neutral Fire Lord - Soul Burn (Picked unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked unit) is in bunkerherogroup) Equal to True
        • Then - Actions
          • Unit - Change ownership of Desert Crossbow Bunker 0191 <gen> to Neutral Passive and Change color
          • Custom script: call UnitRemoveAbility(gg_unit_n06O_0191, 'Aloc')
          • Unit - Move (Picked unit) instantly to riflemanpoint_Copy_7, facing (Facing of (Picked unit)) degrees
          • Animation - Change (Picked unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
          • Unit - Set (Picked unit) movement speed to (Default movement speed of (Picked unit))
          • Unit - Turn collision for (Picked unit) On
          • Unit - Remove classification of An Ancient from (Picked unit)
          • Unit - Remove Cargo Hold (Orc Burrow) from (Picked unit)
          • Unit - Remove Disable Spells buff from (Picked unit)
          • Unit Group - Remove (Picked unit) from bunkerherogroup
        • Else - Actions
    • Else - Actions
This is just the small part of the trigger.

It works almost perfectly now but whenever a hero enters the bunker, the map starts to lag horribly.

I have a huge feeling it's because of the disable spells ability. I use it to, obviously, disable the hero from casting spells. It's based on soul burn, damage amount to 0, damage penalty to 0, damage period to 0, attack speed reduction to 0, cast range to 999999, mana cost to 0, targets allowed to air, friend, ground, and hero, AND DURATION TO 0.

I set the duration to 0 so it would be infinite but I guess that's what makes the map lag so much.

If it's true, does anybody know another way to disable the hero from casting spells.
 
Level 8
Joined
Jul 18, 2010
Messages
332
There a lot of spells in this map. Not just spells, but also spellbooks. If a full leveled hero is about to enter the bunker, I'm gonna have to delete about 12 to 16 spells and it's not just that, the spells that the hero have can be random because the spellbooks act as skill trees wherein they can choose which abilities they wanna hve.

And that's basically the whole trigger, that part of the trigger is just going to repeat itself for all the bunkers and for all the players.

I think I should just use a player group, the trigger's too long.

I think soul burn is the best option but yeah, there's a bug.

EDIT: I think I've solved it now. http://www.hiveworkshop.com/forums/triggers-scripts-269/help-soul-burn-casting-lag-207638/

But I'm still not sure about making the duration 0.
 
Status
Not open for further replies.
Top