PRPL question

Started by Keeper Decagon, October 19, 2016, 04:27:01 AM

Previous topic - Next topic

Keeper Decagon

I'm in the process of making a map with a PRPL core on it, which I had in mind to be the main objective of the map. When it's captured and filled with energy, however, I want it to do a very specific thing: basically, I want it to explode, killing EVERYTHING on the map at the time; structures, doppels, ships, particles and emergents (benign and hostile), as well as the player's ships and structures. It would then complete the mission.

It's to be part of a series where things go horribly awry when the artefact is activated, with this being the first in the series to kick everything off, you see.

But yeah, as a noob to this whole coding thing, I was wondering if this was possible, and if so, how do I make it do these things?

Oh, and as a bonus question, is it possible to change the colour of the Particulates?
"For me, there is no honour or glory. No praise to be had for what I do. I fulfill my purpose for the protection of all... neither of us are going to make it out of here alive." - ?? ??, 145th CE

GoodMorning

I don't think particle colours are mutable.

Something similar to the following code may do what you wish (not spectacularly):


:destroyed
0 0 9999 0 GetAllUnitsInRange ->Units
0 0 9999 0 GetAllShipsInRange ->Ships
0 0 9999 0 GetParticlesInRadius ->Particles #I don't recall what the fourth argument is for...

<-Units GetListCount 0 do
<-Units[I] 0 DestroyUnit
loop

<-Ships GetListCount 0 do
<-Ships[I] 0 DestroyShip
loop

<-Particles GetListCount 0 do
<-Particles[I] 0 DestroyParticle
loop


However, documentation is WIP, so the commands may not be correct. I don't know about Emergent.
A narrative is a lightly-marked path to another reality.

Oblivion

#2
The fourth argument is whether the range is a square or a circle. true or false on the square I believe. If its just for the GetParticlesInRadius I believe its like what planetfall or someone told me, it either finds benign, enemy, or both particulates
~Memes have been scientifrically proven to be the very essence of life unto itself~

GoodMorning

Thank you, Oblivion. That seems inconsistent, but there is a command GetParticlesInRadius, so I suppose it makes sense.
A narrative is a lightly-marked path to another reality.

Keeper Decagon

#4
Quote from: GoodMorning on October 19, 2016, 05:22:00 AM
I don't think particle colours are mutable.

Something similar to the following code may do what you wish (not spectacularly):


:destroyed
0 0 9999 0 GetAllUnitsInRange ->Units
0 0 9999 0 GetAllShipsInRange ->Ships
0 0 9999 0 GetParticlesInRadius ->Particles #I don't recall what the fourth argument is for...

<-Units GetListCount 0 do
<-Units[I] 0 DestroyUnit
loop

<-Ships GetListCount 0 do
<-Ships[I] 0 DestroyShip
loop

<-Particles GetListCount 0 do
<-Particles[I] 0 DestroyParticle
loop


However, documentation is WIP, so the commands may not be correct. I don't know about Emergent.

Alright, thanks. I will try it out when I get home later.
"For me, there is no honour or glory. No praise to be had for what I do. I fulfill my purpose for the protection of all... neither of us are going to make it out of here alive." - ?? ??, 145th CE

Keeper Decagon

Well, looks like it doesn't work, like, at all. No matter what I try, the script refuses to do anything at all. Also, it tells me to put <- or -> in front of the Destroy commands for some reason. Tried that too, but still nothing. I guess I'll have to wait until proper documentation is in place, before messing with the code. Thanks for the help anyways.
"For me, there is no honour or glory. No praise to be had for what I do. I fulfill my purpose for the protection of all... neither of us are going to make it out of here alive." - ?? ??, 145th CE

Oblivion

#6
I checked and destroyed is in fact a prebuilt in function, did you test by destroying the object you attached the script to?
~Memes have been scientifrically proven to be the very essence of life unto itself~

Keeper Decagon

Quote from: Oblivion on October 19, 2016, 06:55:26 PM
I checked and destroyed is in fact a prebuilt in function, did you test by destroying the object you attached the script to?

Yes, I did.
"For me, there is no honour or glory. No praise to be had for what I do. I fulfill my purpose for the protection of all... neither of us are going to make it out of here alive." - ?? ??, 145th CE

GoodMorning

Putting <- -> $ or @ in front of the commands are common fixes for when you have forgotten one (most likely reason for an unrecognised word turning up: it is a function or variable name).

DestroyShip is a real command.

:destroyed indicates the code block which runs when the Core is destroyed (in whatever way). In this case, when the Core is killed, it should find everything and then kill it all. DestroyUnit, DestroyParticle and DestroyShip are command names.

Does it say something like "Unrecognised [...] Maybe you meant <-[cmd] or ->[cmd]" and so forth? If so, what exactly is the command it dislikes?
A narrative is a lightly-marked path to another reality.

Keeper Decagon

Quote from: GoodMorning on October 20, 2016, 05:05:15 AM
Putting <- -> $ or @ in front of the commands are common fixes for when you have forgotten one (most likely reason for an unrecognised word turning up: it is a function or variable name).

DestroyShip is a real command.

:destroyed indicates the code block which runs when the Core is destroyed (in whatever way). In this case, when the Core is killed, it should find everything and then kill it all. DestroyUnit, DestroyParticle and DestroyShip are command names.

Does it say something like "Unrecognised [...] Maybe you meant <-[cmd] or ->[cmd]" and so forth? If so, what exactly is the command it dislikes?

Ok, I tried it again just now, and here is what happened: so it says "Invalid Token: DestroyShip" and then with the "Perhaps you meant <-DestroyShip, ->DestroyShip, "DestroyShip" or @DestroyShip?" straight off the bat when I try to compile it, and that seems to be the only command it seems to dislike. Putting any of those "<-" or whatever in, makes the script compile alright, but when applied to a core that then is destroyed, it will kill all of the structures (Emitters, Energy Sources, Spawners, etc), but will not destroy any ships or particles. It also gives an error in the debug window: "WARNING: Taking item from an empty stack: GETPARTICLESINRADIUS at line 6".

"For me, there is no honour or glory. No praise to be had for what I do. I fulfill my purpose for the protection of all... neither of us are going to make it out of here alive." - ?? ??, 145th CE

Oblivion

This means that either A. DestroyShip is not a real command, and its destroy units or B. It is a real command, but worded differently, and if so, you would have to ask someone with access to all the PRPL scripts (I think its all map makers and admins) for it. As for the taking an item from an empty stack, you didn't give it all the information it needed to carry out the command. Could try GetParticlesInRange. No difference really since your covering the whole map in the range/radius.
~Memes have been scientifrically proven to be the very essence of life unto itself~

GoodMorning

Agreed. I have seen the (full?) list, and was fairly sure that DestroyShip was on there, but if it won't compile...

It is quite possible I used the wrong arguments for GetParticlesInRadius.
A narrative is a lightly-marked path to another reality.

Oblivion

#12
For destroying all ships there is another method for it. From what I understand the CM can't take a hit from any? health particle or at least a medium/high one.

0 0 9999 0 GetAllShipsInRange ->Ships
<-Ships.listcount 0 do
Ships ->CurrentShip
<-CurrentShip GetShipCoords ->Y ->X #Seems like it gives Y first, took me awhile to learn that
<-X <-Y 0 0 1 1 CreateParticle #Spawn a particle right on the CM
loop

#Granted this would have to be reworked a bit if you have enemy ships on your map.
~Memes have been scientifrically proven to be the very essence of life unto itself~

GoodMorning

That would take another frame, because you need to kill your new particles too.

You need the to get a ship UID from the list.

GetCoords pushes X to the stack, then Y on top of it. So when you extract them, you get Y off the top, then X. In your code snippet, you can drop X and Y vars, and just use the return of GetCoords.

It should work, but so should DestroyShip...
A narrative is a lightly-marked path to another reality.

Oblivion

#14
I swear I typed in I guess it just doesn't show up for some reason. Also, doesn't the CM absorb the particle like the hull? Never really saw what happens since usually theres a mass of particles that destroy it in maps.

[ I ] I typed this in. I guess you did too lol.
~Memes have been scientifrically proven to be the very essence of life unto itself~