• 🏆 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!

Kill random peon when start constructing buildings

Status
Not open for further replies.
Level 21
Joined
Apr 8, 2017
Messages
1,537
Current trigger, its bugged and i dont know why
  • Kill slave
    • Events
      • Units - A unit Starts a building
    • Conditions
    • Actions
      • Set xFastG = (Units of type Soul slave)
      • Unit group - Pick every unit in xFastG and do (Actions)
        • Bucle: Acciones
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If: Conditions
              • (Owner of (Triggering unit)) No equal to (Owner of (Picked unit))
            • Then: Actions
              • Unit group - Remove (Picked unit) from xFastG
            • Others: Actions
      • Unit group - Pick every unit in (Random 1 units from xFastG) and do (Actions)
        • Bucle: Actions
          • Unit - Create 1 Dummy Killslave for Neutral passive at (Position of (Triggering unit)) facing Standard
          • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
          • Unit - Add Kill slave to (Last created unit)
          • Unit - Order (Last created unit) to Orc - Lightning chain (Picked unit)
      • Custom script: call DestroyGroup(udg_xFastG)
I did translate this

This is what i want: Start a building -> Kill random peon -> With X spell

Please n Thanks
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,232
Yes i know i must deleted that location leak.
And the group leak...
(Random 1 units from xFastG)
This makes another group object that has to be destroyed.
It want not to work, first test look weird and other tests it takes more than one unit...
Might need a demo map where this problem can be recreated.

I do know that "(Random 1 units from xFastG)" is bugged in that it is not truly random. To force it to fire only once you could use the single random unit from group unit function. This way the kill actions are not looped and so will only fire once per execution.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,232
Units cannot cast target abilities on units they cannot see.

In this case Neutral Passive might not have vision of the peasants so is unable to cast lightning on them even if the lightning ability has 0 cooldown, costs 0 mana and has as good as infinite cast range.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,232
Still not working correctly :C
Worked perfectly for me when I added 40 peasants and disabled fog and black mask. Every building placed caused a random peasant to die.

Until I disabled fog and black mask a random peasant would die only if the chosen random peasant was nearby, close enough for the neutral passive footman that spawned to see them.

One could create a visibility modifier for neutral passive above the victim peasant so it can be targeted. One could also disable fog of war and black mask for neutral passive so they can always see all peasants. One could also force all players to have shared vision with neutral passive so that neutral passive can see their units and even invisible units.
 
Level 21
Joined
Apr 8, 2017
Messages
1,537
Worked perfectly for me when I added 40 peasants and disabled fog and black mask. Every building placed caused a random peasant to die.

Until I disabled fog and black mask a random peasant would die only if the chosen random peasant was nearby, close enough for the neutral passive footman that spawned to see them.

One could create a visibility modifier for neutral passive above the victim peasant so it can be targeted. One could also disable fog of war and black mask for neutral passive so they can always see all peasants. One could also force all players to have shared vision with neutral passive so that neutral passive can see their units and even invisible units.
Can you attach me that map pls?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,232
Bloodsoul pointed out that the reason why it is not working is that the footman is trying to cast chain lightning on a dead peasant. The solution is to filter the group and remove all dead units.

Here is the final trigger, available for test in the attached map:
  • Kill Slave
    • Events
      • Unit - A unit Begins construction
    • Conditions
    • Actions
      • Set SwapUnitType = Peasant
      • Set SwapPlayer = (Owner of (Triggering unit))
      • Unit Group - Remove all units from KillSlaveGroup
      • Custom script: set bj_groupEnumTypeId = udg_SwapUnitType
      • Custom script: call GroupEnumUnitsOfPlayer(udg_KillSlaveGroup, udg_SwapPlayer, filterGetUnitsOfTypeIdAll)
      • Unit Group - Pick every unit in KillSlaveGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is dead) Equal to True
            • Then - Actions
              • Unit Group - Remove (Picked unit) from KillSlaveGroup
            • Else - Actions
      • Set KillSlaveTempLoc = (Position of (Triggering unit))
      • Unit - Create 1 Footman for Neutral Passive at (Position of (Triggering unit)) facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_KillSlaveTempLoc)
      • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
      • Unit - Add Chain Lightning (Neutral Hostile) to (Last created unit)
      • Set KillSlaveTempUnit = (Random unit from KillSlaveGroup)
      • Unit - Grant shared vision of KillSlaveTempUnit to Neutral Passive
      • Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning KillSlaveTempUnit
It may still bug if the peasant corpses get modified in some way so as to not count as dead. But for the most part it will work reliably.
 

Attachments

  • Diegoit TestMap 3.w3x
    19.8 KB · Views: 52
Level 21
Joined
Apr 8, 2017
Messages
1,537
Bloodsoul pointed out that the reason why it is not working is that the footman is trying to cast chain lightning on a dead peasant. The solution is to filter the group and remove all dead units.

Here is the final trigger, available for test in the attached map:
  • Kill Slave
    • Events
      • Unit - A unit Begins construction
    • Conditions
    • Actions
      • Set SwapUnitType = Peasant
      • Set SwapPlayer = (Owner of (Triggering unit))
      • Unit Group - Remove all units from KillSlaveGroup
      • Custom script: set bj_groupEnumTypeId = udg_SwapUnitType
      • Custom script: call GroupEnumUnitsOfPlayer(udg_KillSlaveGroup, udg_SwapPlayer, filterGetUnitsOfTypeIdAll)
      • Unit Group - Pick every unit in KillSlaveGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is dead) Equal to True
            • Then - Actions
              • Unit Group - Remove (Picked unit) from KillSlaveGroup
            • Else - Actions
      • Set KillSlaveTempLoc = (Position of (Triggering unit))
      • Unit - Create 1 Footman for Neutral Passive at (Position of (Triggering unit)) facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_KillSlaveTempLoc)
      • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
      • Unit - Add Chain Lightning (Neutral Hostile) to (Last created unit)
      • Set KillSlaveTempUnit = (Random unit from KillSlaveGroup)
      • Unit - Grant shared vision of KillSlaveTempUnit to Neutral Passive
      • Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning KillSlaveTempUnit
It may still bug if the peasant corpses get modified in some way so as to not count as dead. But for the most part it will work reliably.
Wow, that was a good point, +4 rep
 
Status
Not open for further replies.
Top