Some questions about an immune-system map

Status
Not open for further replies.
Level 2
Joined
Apr 18, 2012
Messages
10
TL;DR: Immune system map. Want to know how to make units reproduce and target structures. Also want suggestions for good base models to use.

(I'm very sorry if I'm violating any rules; Please tell me if I am)

I have to make a game about the immune system, and decided to adapt warcraft for the purpose. I'm very noobish about custom maps (but I have some fairly serious programming experience) I'm wondering how do some things:

  • What's the right way to make an unit reproduce? For instance, each bacteria might make a copy of itself every five seconds. Should this be a trigger or what?
  • I'm representing the (infectable) cells of the body as some structure. How do I make the pathogens attack said structures?
  • Viruses can only reproduce with an infected cell. Unless this is somehow shown wrong, I'm going spawn some infected-cell structure. How would I make
    viruses go to unoccupied infected cells?
  • Suggestions about models for cells, infected cells, viruses, bacteria, and "defenders" (specifically, macrophages, which eat pathogens, B cells, which do weak AOE stuff, and T cells, which do powerful, highly effective melee stuff adapted to specific attackers) would be very welcome.

Thank you

(Once again, please tell me if I'm violating any rules of conduct or the like)
 
Last edited:
Level 20
Joined
Jul 14, 2011
Messages
3,213
1- For Bacteria reproduction by self multiplying: Yes, you have to trigger (You can make the bacteria cast "Mirror image" but with no illusion, but the creation of the same unit type on its side

2- Create the pathogens, and set them as enemies of the structures in Player properties. Other solution may be making the structures targeteables as "X", "Y" or "Z" and make the specific pathogens that attack those structures able to target "X", "Y", or "Z".

3- I don't understand

4- Maybe Rot and small fire effects from WC may fit.
4- You can also use Small water elementals or any other unit changing it's color to look Red, green, blue, purple, or however you want.
4- Here's a slug http://www.hiveworkshop.com/forums/models-530/snail-slug-50522/?prev=search=slime&d=list&r=20
4- Here's a slime http://www.hiveworkshop.com/forums/models-530/blue-green-slime-110521/?prev=search=slime&d=list&r=20
4- Here's a mucus http://www.hiveworkshop.com/forums/...ogerson-123621/?prev=search=slime&d=list&r=20
 
Level 2
Joined
Apr 18, 2012
Messages
10
  1. Either what trigger event is triggered by each unit every X seconds, either what's the right way to do this? I tried out Mirror Image and Parasite, but couldn't find hydra spawn. No idea at all what to do with them next
  2. How would I set them as enemies? the on only thing I see under "player properties" is what players there are, their races, names, and colors. I don't understand how to do the alternative, either
  3. Viruses need to infect a cell to reproduce. Therefor, viruses should go to infected cells, and start reproducing. However, viruses shouldn't go to infected cells which already have viruses in them. I'm wondering how to do all that.
  4. Thanks a bunch for the model links - any ideas for the cells themselves?

I'm pretty sure that I'm asking some horribly noobish stuff in parts, so link me to generic tutorials about run-of-the-mill type stuff.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
1- Open Spoiler

Event: A unit enters playable map area
Condition: Unit Type of Triggering Unit = Bacteria
Action: Add Triggering Unit to BacteriaGroup

Event: Every 5 seconds of gametime
Condition: None
Actions: Pick every unit of Unit in BacteriaGroup and ->
-> Set TUnit = Picked Unit
-> Add Mirror Image to TUnit
-> Order TUnit to cast Mirror Image
-> Remove Mirror Image from TUnit

^^ Customize that Mirror Image to do nothing, we only want the effect.

  • Events
    • A Unit finishes casting an Ability
  • Conditions
    • Ability Being Cast = Mirror Image
  • Actions
    • Set TUnit = Triggering Unot
    • Set TPoint = Position of TUnit
    • Set TPoint 2 = TPoint offset by 200 towards Random Angle
    • Unit - Create 1 (Unit Type of TUnit) at TPoint2
    • Special Effect - Create some pretty thing at TPoint2
    • Special Effect - Destroy Last Created SpeciaL Effect
    • Custom script: call RemoveLocation(udg_TPoint)
    • Custom script: call RemoveLocation(udg_TPoint2)
    • Unit Group - Add (Last Created Unit) to BacteriaGroup


2- Look in "Force propeties". There you can customize the allies properties

3- Add every "HEalthy" unit to a UnitGroup and remove them from the group once they get infected. Order viruses to "infect" units that belongs to "Healthy" group.

4- http://www.hiveworkshop.com/forums/models-530/red-blood-cell-62197/?prev=search=cell&d=list&r=20

You can also use any model in the game with changed vertex color (It can be a small red pudge, for example, or a Water Elemental)
 
Level 17
Joined
Jul 17, 2011
Messages
1,863
well first i suggest you go and read some tutorials after that do this for your reproduction system (1).
give your bacteria the mirror image ability, it will automatically trigger whenever they attack something edit it so that they do 1.00 dmg and take 1.00 dmg also edit the duration and the number of images as well as the cooldown.

for your infected cells you can use a dummy unit who casts doom on them

i dont know if you will understand tho
 
Level 2
Joined
Apr 18, 2012
Messages
10
Thanks a bunch, and sorry for the late response:

1. I tried to do all that, it doesn't work. Here are some trigger things (no idea if I'm using the right formatting, so sorry in advance:
  • Add bacteria
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Bacteria
    • Actions
      • Game - Display to (All players) the text: (Added bacteria to group: + (String((Unit-type of (Triggering unit)))))
      • Unit Group - Add (Triggering unit) to BacteriaGroup
  • Start Reproduction
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Game - Display to (All players) the text: Doing reproduction ...
      • Unit Group - Pick every unit in BacteriaGroup and do (Actions)
        • Loop - Actions
          • Set TUnit = (Picked unit)
          • Unit - Add Mirror Image to TUnit
          • Game - Display to (All players) the text: Added Reproduce
          • Unit - Order TUnit to Orc Blademaster - Mirror Image
          • Unit - Remove Mirror Image from TUnit
          • Game - Display to (All players) the text: Bacteria ordered to...
  • Reproduce
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Mirror Image
    • Actions
      • Game - Display to (All players) the text: Reproduce caught
      • Set TUnit = (Triggering unit)
      • Set TPoint = (Position of TUnit)
      • Set TPoint2 = (TPoint offset by 200.00 towards (Random angle) degrees)
      • Unit - Create 1 (Unit-type of TUnit) for (Owner of TUnit) at TPoint2 facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_TPoint)
      • Custom script: call RemoveLocation(udg_TPoint2)
      • Unit Group - Add TUnit to BacteriaGroup
That said, the added-to-group message is shown, the reproduce-given message is shown, and the reproduce-order message is shown, but the reproduce-caught message is not. I don't think I'm ordering units the right way, since there's no custom ability menu, which is why I used the default mirror image

2. I don't get it, could you please explain this part more?

3. I couldn't try this out because of normal attacking not working, and how would I order them to do this?

4. Thanks a bunch! This works, and I figured out how to recolor it to whatever is appropriate.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
In your last action you ad "TUnit". TUnit is the caster, and the caster is already in the group. You have to add "Las Created Unit" to the Group :)

It's probably not working because abilities have about 1 or 2 seconds default casting time, and you're removing the ability before the unit finishes casting it (or even starts).

Add the " Unit - Remove Mirror Image from TUnit" in the "Reproduce" trigger, and fix the "Add Last Created Unit to BacteriaGroup" and it'll work :)

BTW; you can create some special effect on TPoint2 where the new bacteria appears. Use the "Destroy Last Created Special Effect" function right after creating it.
 
Level 2
Joined
Apr 18, 2012
Messages
10
1. I was bawled out in the chat for using Mirror Image as a dummy ability, and came up with this:
  • Simple Reproduct
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Game - Display to (All players) the text: Starting reproducti...
      • Unit Group - Pick every unit in (Units of type Bacteria) and do (Actions)
        • Loop - Actions
          • Game - Display to (All players) the text: Waiting...
          • Unit - Create 1 (Unit-type of (Picked unit)) for (Owner of (Picked unit)) at ((Position of (Picked unit)) offset by (Random real number between 0.00 and 300.00) towards (Random angle) degrees) facing Default building facing degrees
          • Wait (Random real number between 1.00 and 5.00) game-time seconds
          • Game - Display to (All players) the text: Spawned
However,
  • That isn't random at all
  • Even if the bacteria are dead, it still makes as many bacteria as the last total every 5 seconds
  • It crashes the game pretty quickly because of too many units

Bacteria should be constantly spawning one-by-one, and not in huge bursts. The time it takes to reproduce should be related to the total number of bacteria, so that the game doesn't crash so quickly. Could you write up a trigger that does this?

2. Yeah, bacteria hate humans, etc, but they still just sit around and don't go out and attack. I was told in the chat that I should use either AI to do that, or triggers (this option sounds really laggy, as you'd be making O(n**n) comparisions every time you made a bacteria choose a target)

3. How would I order anything to attack anything?

4. Thanks a bunch, like I said. Any chances of a fleshy terrain tile?

5. The defenders need to be able to defend. To that end, there needs to be something that represents bone marrow, and makes random defenders. These should be spawned into a holding place (representing the spleen and lymph nodes) where they can reproduce until they are deployed into combat. They can also be converted into much stronger T-cells by something that represents the thymus. All of these things (bone marrow production rate, thymus conversion rate, spleen reproduction rate, individual unit speed, health and attack rate) should be upgradeable with XP gained from killing pathogens. What's the right way to do all this? Triggers? Structures? Techtree? Please help.
 
Last edited:
Level 20
Joined
Jul 14, 2011
Messages
3,213
1- In another trigger "A unit Dies" remove that unit from BacteriaGroup to prevent leaks.

2- Incresae the Bacteria Reproduce time to around 15-25 (5 is really fast)

3- Don't use WAIT actions unless it's a matter of death/life... and Don't do it inside a Pick Every Unit loop (The Option already warns about doing that).

4- Be aware of all the leaks that trigger you posted has. Position of Picked Unit, and Offset, besides repetitite callings.

5- You can limit the amount of alive bacterias and stop reproduction if they've reached the top.

6- To order attack anything you order the created bacteria to move-attack to the position of a random unit that belongs to the enemy. You can periodically check the order of the bacterias and order them to attack anywhere (Random Point) if they're doing nothing.

7. Flessy terrain tyle looks awesome, never tough about that... but I have no idea...
 
Level 2
Joined
Apr 18, 2012
Messages
10
1.
  • Death
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Bacteria
    • Actions
      • Unit Group - Remove (Triggering unit) from BacteriaGroup
It didn't help, bacteria still spawn. Moreover, despite me never having bacteria, it gives some to me and some to him.

2. Did that, it didn't change much, made debugging a bit slower

3. Okay, what should I use instead?

4. I don't really understand what you mean by leaks, but here's what it looks like now:

  • Simple Reproduct
    • Events
      • Time - Every 15.00 seconds of game time
    • Conditions
    • Actions
      • Game - Display to (All players) the text: Starting reproducti...
      • Unit Group - Pick every unit in BacteriaGroup and do (Actions)
        • Loop - Actions
          • Game - Display to (All players) the text: Waiting...
          • Set TUnit = (Picked unit)
          • Set TPoint = (Position of TUnit)
          • Set TPoint2 = (TPoint offset by 200.00 towards (Random angle) degrees)
          • Unit - Create 1 Bacteria for (Owner of TUnit) at TPoint2 facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_TPoint)
          • Custom script: call RemoveLocation(udg_TPoint2)
          • Game - Display to (All players) the text: Spawned
5. I didn't figure out how to do that in a condition, since there is no (Number of units in (BacteriaGroup))

6. How do you check a UnitGroup's orders?

7. Uh, please? That would be really nice to have.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
1- But it cleans the group. If you don't, you'll be picking dead units and giving orders to dead units, wich consumes memory and does nothing.

2- What do you mean with "debugging"?

3- Timers. Create a timer, start it, and everytime the timer expires multiply the units.

4- Exactly that. Could be improved with Jass, but it's pretty much the best you could achieve with GUI.

5- There is a "Number of Units in Unit Group" condition. It's an Integer Comparison.

6- "Pick every unit in UnitGroup and do... If/Then/Else. If Current order of Picked Unit =! (Not equal) to "attack" then create a point in a random area or pick a random unit from enemies, and order the Picked Unit to attack (inside the If/Then/else).

Note: one of the main reasons for lagging is the collision size of units. Whenever you create a unit inside that colides with something, the game uses a lot of memory to find the right spot for that unit. When that happens a lot it gets reaaaaaaaaaaaaally laggy. I tested with 30 units and my PC was burning. Probably that's causing lag. Set the Movement Type of Bacterias no "none" and the collision size to 0, and check if it still lags.
 
Level 2
Joined
Apr 18, 2012
Messages
10
  1. I realize, but that wasn't what I was asking. I now realize that the bug was because I was adding everyone to the BacteriaGroup, not checking for UnitType.
  2. Debugging as in seeing if it worked or not
  3. Timers doesn't help at all. I need each bacteria to clone itself at a random time, so that there are bacteria popping up at random times, not in huge bursts. To this end, I tried having two triggers: One looping through every Bacteria every 20 seconds, calling the second trigger, which waits random(1, 20) and then spawns a new bacteria. The now-obvious flaw with this is that I can't properly pass the bacteria, since local variables don't exist in the GUI (and JASS looks too horribly fucked up to do anything reasonable with it). Using a global variable for this would result in every spawned bacteria being spawned next to the last bacteria in the BacteriaGroup
  4. Great. Like I said above, this isn't exactly what I wanted, although it's still much better than nothing.
  5. Thanks!
  6. I don't like the attack random-stuff thing at all (although thanks a bunch for the order comparaison thing), so what I picked a random bacteria's position (since they should be all in a mob kind of thing), then looped through the Cells doing (in pseudocode, because I forgot to save and lost a good part of my work):

    BacteriaTarget = None
    ShortestDistance = 999999
    for Cell in CellGroup:
    if (distance between points (position of Cell), (BacteriaPosition)) > ShortestDistance:
    ShortestDistance = (distance between points (position of Cell), (BacteriaPosition))
    BacteriaTarget = Cell

    Then I loop through the Bacteria and order all of them to attack BacteriaTarget. This works very oddly: they attack a cell or two, then they appear to loose interest. Any ideas?
  7. What lag?
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
3. Timers are more precise than "wait" actions :) Having a periodic 1 seg trigger reducing the bacteria reproduce time by 15-(Random Real between 0.10 and 2.00). You check If Lifetime is less than or equal to 0, set lifetime again to 15, and multiply the bacteria.

GUI has locals (Custom scrip: local...), and JASS is amazing, but, yeah, seems hard to believe that it's usefull and practical in some way (though it is).

6- Check the Game Constants and the unit guard distance and guard return time.
6.1 - You could add all Cells to a CellGroup then Pick every unit in BacteriaGroup and order to attack Random x units from CellGroup (Or you could order the bacteria to move-attack to the position of that random Cell from CellGroup so it attacks anything in between them)

7. I don't know... Some hipothetical lag?
 
Level 2
Joined
Apr 18, 2012
Messages
10
  1. I got reproduction to work.
    • Reproduce Loop
      • Events
        • Map initialization
      • Conditions
      • Actions
        • Game - Display to (All players) the text: Looping
        • Countdown Timer - Start ReproductTimer as a One-shot timer that will expire in ((10.00 / (Real((Number of units in (Units of type Bacteria))))) + (Random real number between 0.00 and 7.00)) seconds
    • One Reproduce
      • Events
        • Time - ReproductTimer expires
      • Conditions
      • Actions
        • Game - Display to (All players) the text: Starting reproduct
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Number of units in BacteriaGroup) Equal to 0
          • Then - Actions
            • Unit Group - Add all units of (Units of type Bacteria) to BacteriaGroup
            • Game - Display to (All players) the text: Renewed bacteria li...
          • Else - Actions
        • Set TUnit = (Random unit from BacteriaGroup)
        • Unit Group - Remove TUnit from BacteriaGroup
        • Set TPoint = (Position of TUnit)
        • Set TPoint2 = (TPoint offset by 200.00 towards (Random angle) degrees)
        • Unit - Create 1 (Unit-type of TUnit) for (Owner of TUnit) at TPoint2 facing Default building facing degrees
        • Special Effect - Create a special effect at (Center of (Playable map area)) using Abilities\Spells\Orc\MirrorImage\MirrorImageCaster.mdl
        • Game - Display to (All players) the text: Made unit
        • Custom script: call RemoveLocation(udg_TPoint)
        • Custom script: call RemoveLocation(udg_TPoint2)
        • Trigger - Run Reproduce Loop <gen> (checking conditions)
    I realize it may leak a bit, but it works, and does what is needed.
  2. Art- is there any smooth pink terrain, possibly with veins? Also, how do you tint a red model white? Finally, any ideas about a model for Bone Marrow (the thing that makes defenders)?
  3. I want defenders to be spawned in a separate space (the 'spleen'), where they reproduce until they are deployed. How do I make one of these? I think I've seen it in other maps.
  4. How fast the Bone Marrow produces (random) defenders should be upgradable, with gold (earned by killing pathogens). How do I make such upgrades, which should change a variable?
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Yeah, it has some Unit Group leaks (Units of Type) leaks twice
Also the Special Effect Creation and the Location where it's created leaks
 
Status
Not open for further replies.
Top