Sleeper Units and their creation (question)(answered)

Started by GoodMorning, May 15, 2016, 12:45:13 AM

Previous topic - Next topic

GoodMorning

The time has come again to ask expert assistance:

I am beginning to build a script that will corrupt player units into their Sleeper counterparts, or an analog of them.

I was going to custom-define them, but realised that the work had already been done, probably better than I have time for.

My question now is: What do I need to do to build them? I recall Nicant/Creepermind saying that the PaC Sleeper was a difficult merge, and rather than wasting a week, am asking here.

For more detail on the idea, imagine a factory for units running this:


# Corrupter.crpl
# Created on: 5/14/2016 9:19:24 AM
# ------------------------------------------
#Corrupts a specified unit. If none is supplied (-1), picks the closest.
# If it moves before arrival, become a different unit.
# This may not require much change to become a Sleeper analogue. Hmmm...
#

$Target:-1
$Speed:1
$Image:Default

once
  -1 ->BestUnit
 
  while -1 <-BestUnit eq repeat
    30 Delay
    <-Target -1 eq if
      9999 ->MinDist
      GetAllPlayerUnits 0 do
    ->UID
Self <-UID Distance ->Dist_Found #What's the function to go here again?
<-Dist_Found <-MinDist lt if
  <-Dist_Found ->MinDist
  <-UID ->BestUnit
endif
  loop
  <-BestUnit ->Target
    endif
  endwhile
 
  <-T_X <-T_Y <-Speed QueueMove
 
  while GetQueuedMoveCount neq0 repeat
    10 Delay
  endwhile
 
  Self <-BestUnit Distance eq0 if
    <-BestUnit GetUnitType @Corrupt
<-BestUnit 2 Destroy
  else
"DEFAULT" @Corrupt
  endif
 
  Self CONST_CREATEPZ FALSE SetUnitAttribute
  Self 0 Destroy
endonce

:Corrupt #[UnitType - ]
# Creates a corrupted version of the specified unit at the current position.
  ->UnitType
 
  "CRPLCORE" CurrentCoords CreateUnit ->Child
  <-Child "Corrupt_" <-UnitType concat ".crpl" concat AddScriptToUnit
  #Don't do anything more, further behaxiour should be specified in the Corrupted_<unit>.crpl file.



(I know that a few lines are wrong, notably those calculating distance, but I couldn't get the reference up when writing this, so remembered parameter lists were all I had. I'll fix it if the broader question bears fruit.)
A narrative is a lightly-marked path to another reality.

Nicant

#1
Ok, first i would stop working on your code because if you want your unit to be built by the sleeper node, you will have to use telanir's Custom Creep Template. https://knucklecracker.com/forums/index.php?topic=18434.0 To get it you have to click the download link called "_CTemplate.crpl". After you have downloaded the Template, you can add your code to the template and start working on it again. Once your done creating your unit, i will tell you how to make the sleeper node build your unit! Hopefully this helps with the first step of creating your sleeper unit!
CW4 hype!!

Builder17

No , he is wanting enemy unit what corrupts normal player units into sleeper units.

GoodMorning

I recalled from when I examined your Creep Forge code a while ago that building Sleeper units yourself was risky. What I am trying to do does not involve the Sleeper Node, but the built units.

My intent was a "factory" that builds "Corrupters" progressively, and does so faster as you attack and improve.

The "Corrupters" will seek out a unit, and appear to turn it into the equivalent Sleeper unit. (Remove and replace.)

Thus an incautious player may be faced with a Creep Reactor in the middle of a power farm, or a Creep Bertha. I would not corrupt anything unbuilt, but this could make the Thor less useful, especially unsupported.

I will make my own Corrupted unit set if the Sleeper set is impractical, but as the scripting has already been done, I was going to use it.

I am asking mainly whether the Sleeper Creeps can be created directly, or whether there is a variable I must change to cause them to come into existence pre-completed. I am also concerned about their compatibility with the normal Sleeper, and whether they require a Node to be present in order to function at all.
A narrative is a lightly-marked path to another reality.

Nicant

#4
Quote from: GoodMorning on May 15, 2016, 10:39:23 PM
I recalled from when I examined your Creep Forge code a while ago that building Sleeper units yourself was risky. What I am trying to do does not involve the Sleeper Node, but the built units.

My intent was a "factory" that builds "Corrupters" progressively, and does so faster as you attack and improve.

The "Corrupters" will seek out a unit, and appear to turn it into the equivalent Sleeper unit. (Remove and replace.)

Thus an incautious player may be faced with a Creep Reactor in the middle of a power farm, or a Creep Bertha. I would not corrupt anything unbuilt, but this could make the Thor less useful, especially unsupported.

I will make my own Corrupted unit set if the Sleeper set is impractical, but as the scripting has already been done, I was going to use it.

I am asking mainly whether the Sleeper Creeps can be created directly, or whether there is a variable I must change to cause them to come into existence pre-completed. I am also concerned about their compatibility with the normal Sleeper, and whether they require a Node to be present in order to function at all.

Ok, well in that case do not do any thing i said before to do. Sleeper Creeps can be built by another unit. If you take a look at my sleeper guppy, the guppy will build the Creep Collector when it lands. The Sleeper Node does not have to be in the map to make other sleeper units to function. (Just tested it) However, To make any sleeper units work at all you need to use the template map. (Learned that the hard way :( ) Your factory and Corrupters do not have to be sleeper units and when you replace the player unit into a sleeper unit, you do not have to put in any values pretty sure. Anyways, this could be an interesting new enemy and i hope this helps! ;D
Edit: There is no Creep Relay yet so when you do the coding try to exclude relays! (and thors and crystal siphons!)
CW4 hype!!

GoodMorning

Exclude? Create! (and then spend weeks debugging...)
A narrative is a lightly-marked path to another reality.

GoodMorning

One more thing: Should I be using the template map, or one of yours, to get the Creep Guppy, for instance? Would you mind? (My view is that imitation is the sincerest form of flattery, and that copying is the most faithful form of imitation, but I know some people view it as stealing...)
A narrative is a lightly-marked path to another reality.

Nicant

If you want to get the other units i made you need to use mine. I really wish there was a better way to give people my units with Telanir's template. If Telanir does complain about it i will happily take it down, but so far he did not say a word about it.
CW4 hype!!

Grayzzur

Everything submitted becomes property of Knuckle Cracker. It's polite to credit the original author, but technically anything posted belongs to Knuckle Cracker. Create maps, have fun, and spread the joy that is creeper!
"Fate. It protects fools, little children, and ships named 'Enterprise.'" -William T. Riker

GoodMorning

Yes, in legality, but keeping people happy helps.

In my view, using a script is complimentary, so why would anyone object? However, mine seems to be a rare view.
A narrative is a lightly-marked path to another reality.

Grayzzur

Yes, keeping people happy is good. That's why I mentioned it's polite to credit the original author. Usually that's all anyone cares about (credit), and stops any feelings of work being "stolen."
"Fate. It protects fools, little children, and ships named 'Enterprise.'" -William T. Riker

Telanir

Quote from: Nicant on May 17, 2016, 03:31:13 PM
If you want to get the other units i made you need to use mine. I really wish there was a better way to give people my units with Telanir's template. If Telanir does complain about it i will happily take it down, but so far he did not say a word about it.

I am satisfied when my work is used, as long as it is not forgotten I am happy. I am thankful for those who credit me and my work and I wouldn't ever demand you take anything down. When we script we are aware that what we write is property of the game-developer, and knowingly volunteer anyways.
Want to make genius CRPL? The new top map? You can start here!

Find out more about Creeper World 3 on the wiki!

CW3, The Sleeper Menace!

Own an iOS device? Check out my game Blobivers