Unit Snippets

Status
Not open for further replies.

Mind

New Member
Reaction score
7
Code:
Events:
    [time - periodic event]
    Every two seconds of the game
Conditions:
Actions:
    [unit group - pick every unit in region and do single action]
    Pick every unit in [region] and do set life of (picked unit) to life of picked unit -50
    [special effect - create special effect at point]
    Create a special effect at [region] using FireTrap
    [sound - play sound]
    Play bluefireburst
 
B

Billy(

Guest
Movement using keyboard

Here's a map that allow the player to control the unit using arrow keys.
 

Attachments

  • movement by keyboard.w3x
    31 KB · Views: 1,424
R

R2-FU

Guest
It took me a while to figure out this trigger, for some reason the event looks wrong to me, but it works.
Code:
Events:
   Unit - A unit owned by (Player) begins construction
Conditions:
   (Unit-type of (triggering unit)) Equal to (any building that can normally be built)
Actions:
   Unit - Replace (triggering uint) with a Gold Mine using (life and mana, w/e)
   Neutral Building - Set (last replaced unit) to (any number) Gold
I used to have 13 conditions and 12 actions, but i realized i didn't need most of it, so here it is, modify accordingly
 
T

The_Master

Guest
Waves

Waves- such as on DOTD or Resident Evil. To make this ALOT simpler, i just made a example map. I have just now tested this map for glitches and it seems I fixed them all. Pay attention to the Footmen Acquisition range and the trigger dealing with computer sight range if you want to use my atk triggers too.
 

Attachments

  • (01)WavesTest.w3x
    21 KB · Views: 823

Wark

Animal
Reaction score
27
Hi,

Here is a "Gold per Kill" trigger I modified for anyone who wants to make a team game.

I modified the conditions so that the player cannot get gold by killing his own units, or an allies' units.
Code:
[B]Events[/B]
    Unit - A unit Dies

[B]Conditions[/B]
    (Owner of (Killing unit)) Not equal to (Owner of (Dying unit))
    ((Dying unit) belongs to an ally of (Owner of (Killing unit))) Not Equal to True
[B]Actions[/B]
     Player - Add 5 to (Owner of (Killing unit)) Current gold

This might be a good solution for somone who is worried about people killing their own units (or an allies units) for gold.

Also, replace "5" with the number of gold you want given.

Hope this helps,
Wark
 

hobo218

Meh
Reaction score
75
this is a helpful trigger i developed for a TD (this is for a map based off wintermaul TD)
it causes creeps to only spawn from player red's spawn so 1 player can play to test it

Code:
Untitled Trigger 001
    Events
        Player - Player 1 (Red) types a chat message containing -all alone as An exact match
    Conditions
    Actions
        Trigger - Turn off Core Funtion <gen>
        Trigger - Turn on test with red <gen>

Code:
test with red
    Events
        Time - Next_Level expires
    Conditions
        Defeat Equal to False
    Actions
        Countdown Timer - Pause Next_Level
        Countdown Timer - Destroy (Last created timer window)
        Unit - Create 20 Monster_Type for Attackers at (Center of Left Spawn <gen>) facing Default building facing degrees
        Wait 0.01 seconds
        Unit - Create 20 Monster_Type for Attackers at (Center of Left Spawn 2 <gen>) facing Default building facing degrees

the second trigger should be unchecked for "initialy on"
 

XXXconanXXX

Cocktails anyone?
Reaction score
284
Cloning Units

A simple trick to clone units. It create a game cache, stores the unit, then restores the data where you want it to, 'cloning' it.

Code:
Clone
    Events
    Conditions
    Actions
        Game Cache - Create a game cache from Clone
        Game Cache - Store (Last created unit) as Doner of Cloned Unit in (Last created game cache)
        Game Cache - Restore Doner of Cloned Unit from (Last created game cache) for Player Whoever at Point facing 0.00
        Game Cache - Clear (Last Created game Cache)

How it works:

The game cache is created, which can hold any type of value you wish in it.

All handles consist of four integers, w hether it be made of numbers or letters. We store the data into the game cache, which saves the DATA of the unit, not the unit itself.

In a way, we 'trick' the game into flushing the unit's data and restoring it. Thing is, the old unit is never removed, thus cloning the unit.
 

N-a-z-g-u-l

New Member
Reaction score
30
Give Units to your allies!

I made a script where you use an ability (this case: fan of knives [edited]) and then a dialog will be display where you can choose wich player will get this unit. you can also abort the action.
 

Attachments

  • give_towers.w3x
    15.8 KB · Views: 541
R

Renshin

Guest
How to make units give gold on death and make it show up on the screen?
(to see the +24 number pop up on ur screen when u kill the unit)

1st off... make a trigger, for all the players that u want to give bounties when they get killed:
Code:
Bounties
    Events
        Map initialization
    Conditions
    Actions
        Player - Turn Gives bounty On for Neutral Hostile
        Player - Turn Gives bounty On for Player 1 (Red)
        Player - Turn Gives bounty On for Player 2 (Blue)
        Player - Turn Gives bounty On for Player 3 (Teal)
        Player - Turn Gives bounty On for Player 4 (Purple)
        Player - Turn Gives bounty On for Player 5 (Yellow)
        Player - Turn Gives bounty On for Player 6 (Orange)
        Player - Turn Gives bounty On for Player 7 (Green)
        Player - Turn Gives bounty On for Player 8 (Pink)
        Player - Turn Gives bounty On for Player 9 (Gray)
        Player - Turn Gives bounty On for Player 10 (Light Blue)
        Player - Turn Gives bounty On for Player 11 (Dark Green)
        Player - Turn Gives bounty On for Player 12 (Brown)

then all u hve to do, is set the amount of gold u want each unit to give,
in the Object Manager, at the unit's 'Stats - Gold Bounty Awarded' field values. :)
 

the Lumpy

►►►
Reaction score
53
Unit Sharing

This is a sort of wierd trigger that lets you share a unit with a different player.

Here is why I made this:
My friend wanted to have a wisp, but he was orcs and I was night elfs. I turned on shared unit control and let him use a wisp, but he started building stuff with the wisp and it used up all my gold. I made this as a way to temporarily give him ownership of a unit so that I could take it back at any time. I had to give me vision of it because on my map you couldn't see what your friends were doing.

This also provides a kind of cheap way to spy on the enemy's base. :D

I would suggest playing the map first to see how it works.
Please let me know if you find any problems. :)
 

Attachments

  • UnitSharing.w3x
    15.8 KB · Views: 560

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
Unit Combining Tutorial

This tutorial will teach even the average person how to create a unit-combing spell, in both abilities, and triggers.

1. Your first step is to create 2-3 units, one being the stronger one that the weaker
one(s) will combine into.

2. Your second step copy the ability “Mount Hippogryph”, and name it the name you want the ability to be called.

3. Change the unit that it combines with to be the other unit, if you made it, or the unit that will have the ability (so it can combine with itself)

4. Change the created unit to be the stronger unit of the units you made.

5. Change the icons, tooltips, and customize it to be what you want it to be.

6. Your ability is done. The unit will automatically move to the other unit, and combine with it to create the stronger unit.

Trigger way.
Code:
Combining
    Events
        Unit - A unit Is issued an order targeting an object
    Conditions
        1.(Issued order) Equal to (Order(coupletarget))
        2.(Owner of (Ordered unit)) Equal to (Owner of (Target unit of issued order))
        3.(Unit-type of (Target unit of issued order)) Equal to Hippogryph
        4.(Unit-type of (Ordered unit)) Equal to Archer
    Actions
    -------- Unit-Type of Combining --------
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            ((Ordered unit) is A Hero) Equal to False
        Then - Actions
            5.Unit - Order (Ordered unit) to Move To (Position of (Target unit of issued order))
            6.Wait until (((Region centered at (Position of (Ordered unit)) with size (32.00, 32.00)) contains (Ordered unit)) Equal to True), checking every 1.00 seconds
            7.Unit - Replace (Target unit of issued order) with a Hippogryph Rider using The old unit's relative life and mana
            8.Unit - Remove (Ordered unit) from the game
        Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            ((Ordered unit) is A Hero) Equal to True
        Then - Actions
            Set Hero_Combiner_A = (Ordered unit)
            Set Hero_Combiner_B = (Target unit of issued order)
            Unit - Order (Ordered unit) to Move To (Position of (Target unit of issued order))
            Wait until (((Region centered at (Position of (Ordered unit)) with size (32.00, 32.00)) contains (Ordered unit)) Equal to True), checking every 1.00 seconds
            Unit - Create 1 (Unit-type of Hero_Combined) for (Owner of (Ordered unit)) at (Position of (Target unit of issued order)) facing (Facing of (Target unit of issued order)) degrees
            Unit - Hide Hero_Combiner_A
            Unit - Hide Hero_Combiner_B
        Else - Actions
Explanation:
1. The issued order has to be couple target (the order string of the dummy ability), otherwise if the unit is ordered to attack the unit, it will go and combine.

2. The owners have to be the same, unless you want your unit to be able to mount other owners' units.

3. You wouldn't want the unit to combine with a swordsmen, to make a hippogryph, would you?

4. If you have multiple combining abilities in your map, other units might be enabled to combine with a hippogryph without this.

5, 6. This is optional. It makes the unit walk up to the unit to combine.
7. This makes the stronger unit actually appear.

8. This removes the unit with the ability from the game, so it looks like it mounted it. You wouldn't want it to make all of the hippogryphs into riders.

Second Trigger:
Code:
Reversing
    Events
        Unit - A unit Is issued an order with no target
    Conditions
        (Issued order) Equal to (Order(decouple))
    Actions
        -------- Unit-Type of Combining --------
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Ordered unit) is A Hero) Equal to False
            Then - Actions
                Unit - Remove (Ordered unit) from the game
                Unit - Create 1 Archer for (Owner of (Ordered unit)) at (Position of (Ordered unit)) facing Default building facing degrees
                Unit - Create 1 Hippogryph for (Owner of (Ordered unit)) at (Position of (Ordered unit)) facing Default building facing degrees
            Else - Actions
        -------- Hero-Type of Combining --------
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Ordered unit) is A Hero) Equal to True
            Then - Actions
                Set Hero_Combined = (Ordered unit)
                Unit - Hide (Ordered unit)
                Unit - Move Hero_Combiner_A instantly to (Position of (Ordered unit))
                Unit - Unhide Hero_Combiner_A
                Unit - Move Hero_Combiner_B instantly to (Position of (Ordered unit))
                Unit - Unhide Hero_Combiner_B
            Else - Actions

This is to reverse the combination. If it is a hero, your hero will appear with all the normal stats, otherwise, just use the first actions.
Note:
All of the units are just an example. You can change the units accordingly to how you want them. Also, your ability may be based on a different ability, so you will need to change the order strings accordingly. Also, it will not work for the heroes way, if you have multiple heroes in your map. You may need to set an array, or multiple variables.
Hope it improves your map!
Code:
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
A simple tutorial for making a unit sidestep.
Make 3 triggers
One will be to move the unit, one will be to turn on the trigger, one to turn it off.
Code:
Moving Right
Events
      Time - Every 0.25 seconds of game time
Conditions
Actions
      Unit - Move (Triggering unit) instantly to ((Center of (Region centered at (Position of (Triggering unit)) with size (0.00, 0.00))) offset by 25.00 towards ((Facing of (Triggering unit)) - 90.00) degrees)
Code:
Turn on
Events
      Player - Player 1 (Red) Presses the Right Arrow key
Conditions
Actions
      Trigger - Turn on Moving the Unit <gen>
Code:
Turn off
Events
      Player - Player 1 (Red) Releases the Right Arrow key
Conditions
Actions
      Trigger - Turn off Moving Right <gen>
Also, This trigger is for moving right. You will need to add one to make it move left, too.
if you make these triggers into your map, just change the unit in the first trigger to player 1's hero. You may also need to make these three triggers for every player if there are multiple players. Good luck on your maps!
 
N

Neopolis3

Guest
Mounting Tutorial
The Night Elf Runner needs to deliver a message to Tyrande Whisperwind. But first, she needs to cross trough human territory, who have infested the area with cannon towers. She is not agile enough to avoid all the towers? What is she to do?

How to mount with very few triggers used. Uses two custom abilities, Anti-Magic Shell and War Stomp with all stats nulled. Also, doesn't require the mountable units to have abilities like the Archers "Mount Hippogryph". Also, this version will not work on heroes and units with inventories.
 

Attachments

  • Mounting Tutorial.w3x
    17.5 KB · Views: 601

mase

____ ___ ____ __
Reaction score
154
Here is a perfect movement system created by me lol. It literllaly is perfect, except for the timing, ppl may want to edit how fast the unit will move! This is also mulitplayer, i made it so u dont have to edit nething if u want it to be multiplayer. but u will have to add player 12 to the Left, Down, Up, Right, Left Release, Down Release, Up Release, and Right Release triggers.
 

Attachments

  • Keyboard movement.w3x
    23.8 KB · Views: 669

mase

____ ___ ____ __
Reaction score
154
Dont no how it works, but it works! These triggers allow u to load a unit by pressing the Up arrow key (on keyboard) 2x within 1 second, if u press it only 1x it does nothing other than move ur guy if u hold it. The camera isnt perfect bc i didnt really work on it.
 

Attachments

  • Loading Using Keyboard.w3x
    27 KB · Views: 528

InfectedWithDrew

I used to go here a lot.
Reaction score
95
Thinking inside the box...

Code:
Prevent attack
    Events
        Unit - A unit leaves Region # <gen>
    Conditions
        (Owner of (Leaving unit)) Equal to Player #
    Actions
        Unit - Move (Leaving unit) instantly to (Center of Region # <gen>)

This keeps people inside their bases. You can add timers or deactivate with other triggers to turn this off.

Before you make this YOU MUST make a region that encompasses the player's entire base. If you want to you can add space for expansion.
 
Z

zigzagrocket

Guest
New Spawn engine

Spawns units at a built building, but matches the units to the building and will only allow each building to spawn a certain amount of units. Hope it proves useful
 

Attachments

  • Unit Spawner.w3x
    23.2 KB · Views: 547

lllidan

New Member
Reaction score
22
Balanced Creep Spawn System​

I made this a while back for one of my maps. What it does is it takes the average level of all the heroes, and makes a creep(s) of that level on your map. Great for hero arenas.

All you have to do is:

-Edit the blue areas accordingly
-Create a Integer variable named Players
-Create a Integer variable named AverageLevel
-Create a Integer variable named Total_Levels
-Create a Point variable named Spawn_Point
-Add the creeps you want it to choose from to your current tileset. You must do this, as the "random" only applies to a random creep in that tileset.
-Make sure to have at least one for each possible level, otherwise creeps simply won't spawn at certain times in the game.


Code:
Random but Balanced Creep Spawn
Spawn Creeps
    Events
        Time - Every [COLOR=Blue]<Your Spawn Frequency>[/COLOR] seconds of game time
    Conditions
    Actions
        Custom script:   set bj_wantDestroyGroup = true
        Set totalplayers = (Number of units in (Units in (Playable map area) matching ((((Matching unit) is A Hero) Equal to True) and (((Owner of (Matching unit)) controller) Equal to User))))
        Set TotalLevels = 0 [COLOR=Green]//Initializing Variable[/COLOR]
        Custom script:   set bj_wantDestroyGroup = true
        Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) is A Hero) Equal to True) and (((Owner of (Matching unit)) controller) Equal to User))) and do (Actions)
            Loop - Actions
                Set TotalLevels = (TotalLevels + (Hero level of (Picked unit)))
        Set AverageLevel = (TotalLevels / totalplayers)
        Set Spawn_Point = (Random point in[COLOR=Blue]<Your Region>[/COLOR]<gen>)
        Custom script:   set bj_wantDestroyGroup = true
        If ((Number of units in (Units in Region 14 <gen> owned by Neutral Hostile)) Less than [COLOR=Blue]<Quantity Restriction>[/COLOR]) then do (Unit - Create 1 (Random level AverageLevel creep unit-type) for Neutral Hostile at Spawn_Point facing Default building facing degrees) else do (Do nothing)
        Custom script:   call RemoveLocation (udg_Spawn_Point)
        [COLOR=Green]//Repeat for all other regions.[/COLOR]

Enjoy
-lllidan

http://www.thehelper.net/forums/showthread.php?t=29193
 

Rabarber

You can change this now in User CP.
Reaction score
94
Circling units

An easy trigger to make units circle around a point. There are two unit variables;
TempUnit - The unit that's circling around.
VarUnit - The unit that TempUnit is circling around.

You will only need the Circling trigger. Remember to set the TempUnit and VarUnit triggers before you use this.

Completely leak-less.
 

Attachments

  • Circling Units.w3x
    51.3 KB · Views: 534

Tonks

New Member
Reaction score
160
Turning while Sliding:

Code:
Turning
    Events
        (Unit you want to turn) is issued an order targetting a point
        [I]*Repeat for all units you want to turn*[/I]
    Conditions
        (unit is currently sliding)
        [I]*You'll have to put in your own condition, because of the unique Sliding triggers. i.e, if you're using a variable sliding trigger, you'll have to put (Slide_on[((Player Number of (Owner of (Triggering Unit))] equal to True*[/I]
    Actions
        Unit- Move (Triggering unit) instantly to (Position of (Triggering Unit)), facing (Target point of issued order)
        Unit- Make (Triggering unit) face (Target point of issued order) over 0.00 seconds
        [I]*Both of these actions are requires to prevent bad turning. For instance, if I just put Make(Triggering Unit) face (Target point of issued order), on occasion the turn would only be half-completed before it got interrupted by the Sliding, so you would do a 90 degree turn rather than a 160 or 180 degree turn.*[/I]
 
Status
Not open for further replies.
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/
  • The Helper The Helper:
    Here is another comfort food favorite - Million Dollar Casserole - https://www.thehelper.net/threads/recipe-million-dollar-casserole.193614/

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top