I want to make a CRPLCORE which is effectively an image that can be automatically targeted and destroyed by a spore tower, the image then flips to a destroyed version of it. Because I cant seem to find out how to do it, I have done it by cheating. I have put a unit under my image and detected when it is destroyed and then flipped the image that way (as below) But visually it doesn't work how I would like it to and it would be so much better if I could make the image targetable in the first place. Ideally, it would need a health bar too. Could someone kindly advise me please?
Thanks in advance :)
PS. I am doing this in a PAC map
$unitdetect:1
$flag:0
GetUnitCountInRange(currentcoords 2) ->unitdetect
<-unitdetect 1 lt if
<-flag 1 lt if
CreateEffect(7 CellToPixel(CurrentCoords) 1 3 3 0.02)
Self "main" "Custom1_128pp" SetImage
Self "main" 2.1 2.1 SetImageScale
Self "main" 2 SetImagePositionZ
PlaySound("Explosion6")
1 ->flag
endif
endif
Could you describe what happens to the image when it goes into this 'destroyed' state? The visual problems you are experiencing might be because of the Custom1_128pp, maybe try making it just a normal 128?
When it comes to auto-targeting, the PAC spore towers are run on custom code, you would need to delve into those .crpl's to figure out a method to make spore towers automatically target it. I don't see why you would want to though because the player should typically have full control over their units (or it can get frustrating).
If you're just talking about a generic spore tower, it can't target CRPL objects as far as I'm aware.
A normal unit basically just checks for creeper underneath it, does that work for you?
Thank you Telanir and J for posting :)
This is on a PAC map just so you know.
What I am currently doing is I have a wall of images ( which looks like a wall) and underneath the images are units like a collector which can be targeted by a spore tower. When the collector is destroyed I flip the image to a destroyed image in the code above and that actually works ok . But what I wanted to make was a CRPLCORE which could be targeted by a spore tower automatically ( so it would need to see the CRPLCORE as a unit it could destroy) and that is what I was looking to do. so is this not possible?
Telanir already provided the easiest solution: if you want to do this on a PAC map, simply change the script of the custom spore tower to enable it to target those specific "wall" cores. Check line 297-302 in StructureGui.crpl.
Quote from: Tyler21 on April 12, 2015, 04:40:35 PM
Telanir already provided the easiest solution: if you want to do this on a PAC map, simply change the script of the custom spore tower to enable it to target those specific "wall" cores. Check line 297-302 in StructureGui.crpl.
Thanks :) I will take a look