Knuckle Cracker

Particle Fleet => Map Makers, Ship Builders, and Coders => Topic started by: HofNerd on March 24, 2021, 10:55:28 AM

Title: [PRPL][Help please] How to set emitter ship target probability in PRPL?
Post by: HofNerd on March 24, 2021, 10:55:28 AM
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.
Title: Re: [PRPL][Help please] How to set emitter ship target probability in PRPL?
Post by: GoodMorning on March 25, 2021, 06:28:12 AM
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.)
Title: Re: [PRPL][Help please] How to set emitter ship target probability in PRPL?
Post by: HofNerd on March 30, 2021, 05:38:04 AM
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:





























IDPurposeType
0Lathe targetsboolean
1Energy source @ destroyedboolean
2Is enemyboolean
3Grows strucboolean
4Amp Gem @ destroyedboolean
5Has map space?boolean
6Is mission goalboolean
7Has map space?boolean
8Makes emitter grey when changed, but I do not know what else it doesboolean
9Doesn't want to change with setAttribute?
10Cell x positionint
11Cell y positionint
12Pixel x positionfloat
13Pixel y positionfloat
14Doesn't want to change with setAttribute?
15Healthfloat
16Maximum healthfloat
17No clue what this doesfloat
18No clue what this doesfloat
19No clue what this doesboolean
20No clue what this doesboolean
21Doesn't want to change with setAttribute?
22No clue what this doesboolean
23No clue what this doesboolean
24No clue what this doesboolean
25No clue what this doesfloat
26No clue what this doesfloat

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
Title: Re: [PRPL][Help please] How to set emitter ship target probability in PRPL?
Post by: GoodMorning on March 31, 2021, 01:56:59 AM
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.