Spore targeting

Started by wolkiewicz, July 17, 2015, 04:12:10 AM

Previous topic - Next topic

wolkiewicz

Ok, two questions here:
1. Can I set something to target spore?
2. I wrote simple code:
$count:1
$payload:200
$del:1800

once
SetTimer0(5400)
endonce

if(GetTimer0 eq0)
CurrentCoords RandUnitCoords <-count <-payload CreateSpore
<-count 1 add ->count
<-del Delay
endif


And every spore target the same unit. How can I fix that?

Tyler21

#1
1. No. Unless you create a spore-like CRPL core (see custom spore, check Grayzzur's maps)

2. Do you intend to launch an increasing number of spores or one spore every minute which increases in its health? Your script does the latter (the former can be achieved by the below loop). However, I have no clue here why separate RandUnitCoords calls result the same target. They shouldn't necessarily if there are multiple valid targets.


(I forgot that the n1 argument in the CreateSpore function defines its health, not the spore count. The var name <-count totally confused me :) )

2. Your code creates <-count number of spores and launches all of them at a RandUnitCoords coordinate. In order to launch multiple spores at different coordinates you have to implement a do loop.
For instance:
<-count 0 do
CurrentCoords RandUnitCoords 1 <-payload CreateSpore
loop

Note that in a do loop the limit comes first and the starting index is the second argument. Also note that the loop stops when the index reaches the limit, that is, <-count in your case. So the last index for which the script is executed is <-count -1. That's why you have to set 0 as the starting index (and not 1).


"Enjoyment appears at the boundary between boredom and anxiety, when the challenges are just balanced with the person's capacity to act."
― Mihaly Csikszentmihalyi

Check my collection of the 30 most difficult and challenging maps in Colonial Space!

warren

Several people have created custom spores (including myself). I would be shocked and appalled if there were no good examples on the wiki.

Also, your code will not likely malfunction the way Tyler21 predicts as the RandUnitCoords is inside your loop. However, I would be surprised if your code launched more than one spore as written.

Tyler21

Sorry, it's my bad, I corrected my original post.
"Enjoyment appears at the boundary between boredom and anxiety, when the challenges are just balanced with the person's capacity to act."
― Mihaly Csikszentmihalyi

Check my collection of the 30 most difficult and challenging maps in Colonial Space!