[Help] How to make a global code that effects all (non-custom) enemy units.

HappyHead · 1682

HappyHead

  • Jr. Member
  • **
    • Posts: 5
I'm looking to make an apply and forget script that effects all (non-custom) enemy units on the map, but I've got no idea what I'm doing.
I'm trying to get two separate things accomplished with a single global script: 1. Make all enemy units increase their output over time and 2. increase/change the output of all enemy units as a function of the total number of enemy units currently being nullified.

For simplicity, lets focus on emitters. I can probably piece together the other units if I've got a good starting place.

So, in a simple setup where a map just has 3 emitters each with a base output of 50 creep per 15 tics, what would I have to do to get all emitters to increase their output by 1 every 150 tics in such a way that I could use the exact same script on another map with 5 emitters putting out 30 creep per 20 tics?

Then, how would I go about making a table that would modify emitter output based on total enemies (of any kind) currently being nullified such that, while 1 enemy is nullified, all remaining emitters produce 1 additional egg every 200 tics, while 2 enemies are nullified, creep output is increased by 20 and 2 eggs are produced every 200 tics, and while 3+ enemies are nullified all remaining emitters creep output is increased by 60 and 2 eggs are produced every 200 tics... all in such a way that if a nullifier blows up the emitters go down a tier....


I know its a bit of a headache, but so far I cant piece together how I'd begin to make this idea a reality. I'm a complete noob when it comes to RPL, but I'd really like to make a series of levels with a script like this applied.... I realize I'm probably going to have to write separate sections for each enemy type and I'm fine with that, but how can I accomplish this without making it a script that is specific to individual units?



bluebolt

  • Community Guild
  • *****
    • Posts: 108
  • Eagerly Awaiting 4RPL
Unfortunately I don't know the commands for editing enemy unit values(I don't believe story units are ever changed mid mission), or getting all units/all units in range(There might be a command used in the mission that introduces miners, but I have not checked- to look at code in that mission, just press shift-e to open the editor mid mission).

However, the script will go into the Global Control part of the cpack editor. The Pre scripts run before the Post scripts.

I'd probably get all enemy units once and store them in a list, then check every once in a while how many are nullified and modify values depending on that.

Even YOU may survive an apocalypse! Fight back against the creeper today!