So, I am working on a mission which includes emitters spawned through PRPL. I want to set the chance of particles from those emitters to target ships, but I can't figure out how. I found the PRPL instructions for other things in the PRPL reference:
https://knucklecracker.com/wiki/doku.php?id=prpl:prplreference
I expected an instruction like "SetEmitterShipTargetProbability" to exist alongside "SetEmitterEmitterTargetProbability" (just like the two settings in the map editor), but for some reason I cannot find something similar in the PRPL reference.
An example of what I am trying to make:
once
CreateUnit("Emitter" 2 2) ->UID #Make an emitter on 2, 2
SetEmitterTargetProbability(<-UID 1) #Make 100% of particles target
SetEmitterEmitterTargetProbability(<-UID 0) #Make 0% of particles target emitters
SetEmitterShipTargetProbability(<-UID 1) #This line does not compile. I want to make 100% of particles target ships
SetUnitLatheTargets(<-UID 0) #Makes the emitter untargettable.
endonce
I am still new to PRPL, so I may have missed something. If someone knows the PRPL instruction for setting the emitter ship target probability, please post it here.
I'm afraid that's the same command I'd try to use, and the wiki doesn't seem to contain a command for setting the target to an energy source, either.
If I'm right that that doesn't exist, you have two options for targeting all particle at ships, but both involve setting the target yourself. One is to create a custom emitter where you make your own particles, the other is to find particles created by your emitter and set their target.
Although, if you're creating this in a once-block, you could manually create that Emitter, put it offscreen, and just move it onto the map by script when it's needed. (And change the max-particles to/from 0 from/to something useful at the same time.)
I haven't found a page explaining which unit attributes are accessable through getAttribute, on the wiki I ran into this page:
https://knucklecracker.com/wiki/doku.php?id=prpl:accessornotation&s[]=attribute
It seems unfinished and unfortunately for me, the missing page content is probably what I am looking for.
But I am not ready to give up (yet). That is why I have experimented a little with getAttribute. I have used GetAttribute to take a look at the attributes of an emitter with this script I made:
$type:"Emitter"
$attributeSearchRange:100
GetAllUnitsInRange(0 0 9999 1) ->list
do(GetListCount(<-list) 0)
<-list[I] ->UID
if(GetUnitType(<-UID) <-type eq)
0 ->index
while <-index <-attributeSearchRange lte
repeat
if(GetAttribute(<-UID <-index) StackSize 1 eq)
->Value
Concat(Concat("ID: " <-index) Concat(" Value " <-Value)) Trace
endif
<-index 1 add ->index
endwhile
endif
loop
PauseGame
1 Delay
By using setAttribute on an emitter and observing the results, I was able to figure out what roughly half of the attribute are for:
ID | Purpose | Type |
0 | Lathe targets | boolean |
1 | Energy source @ destroyed | boolean |
2 | Is enemy | boolean |
3 | Grows struc | boolean |
4 | Amp Gem @ destroyed | boolean |
5 | Has map space? | boolean |
6 | Is mission goal | boolean |
7 | Has map space? | boolean |
8 | Makes emitter grey when changed, but I do not know what else it does | boolean |
9 | Doesn't want to change with setAttribute | ? |
10 | Cell x position | int |
11 | Cell y position | int |
12 | Pixel x position | float |
13 | Pixel y position | float |
14 | Doesn't want to change with setAttribute | ? |
15 | Health | float |
16 | Maximum health | float |
17 | No clue what this does | float |
18 | No clue what this does | float |
19 | No clue what this does | boolean |
20 | No clue what this does | boolean |
21 | Doesn't want to change with setAttribute | ? |
22 | No clue what this does | boolean |
23 | No clue what this does | boolean |
24 | No clue what this does | boolean |
25 | No clue what this does | float |
26 | No clue what this does | float |
No value change resulted in a change to the emitter's chance to target ships to change. This leads to the conclusion that that attribute is not visible for PRPL.
I now also ran into a similar problem: I cannot change the spawn offset of doppel or ship spawners through PRPL. I want to make a map where the player has to survive for a certain time against attacks from all directions. And to making things more interesting I wanted to randomize the position on the map edge the hostile doppels and ships spawn, but the offset values seem invisible to prpl script, just like the targetting chance values of emitters.
An alternative could be to make the doppel and ship spawners invisible and move the ship spawners and doppel spawners to random coordinates near the map edge every few seconds instead. This would require the lathe targetting to be set to false or else it could be destroyed. This however would make the structure highly visible. (Yellow outlining on an invisible structure is still visible.) This would not look very good, and would remove the element of surprise as to what direction a new ship/doppel would attack from.
I can also manually create a doppel with CreateUnit, but I haven't found any documentation on how to set ship type and other properties. Searching "Doppel" in the PRPL reference finds only two instructions: setDoppelBehavior and setDoppelHomeCell.
https://knucklecracker.com/wiki/doku.php?id=prpl:prplreference
As far as I know, none of these abilities exist except by workarounds.
The remaining GetAttribute values were once tabulated by someone (Nicant? kajacx?), but I don't recall them being useful for this.
Randomness is generally to be avoided (so the scoreboard is fair), but the effect you mention can be done by letting the ship spawn "naturally" and them moving it around with a script on the same frame it spawns.
I understand that knucracker judged it better to move on to CW4 than to keep working on the less-used commands in PRPL.