Drawing beams

Started by Crimson King, February 05, 2014, 12:24:03 AM

Previous topic - Next topic

Crimson King

I have a map that I am working on and part of what I would like to do is have the CRPL core fire a Terp style beam at the selected coords before/while it lowers/raises the terrain. Range may or may not be limited by distance from the core and amount of the terrain being lowered/raised may vary as well. I have looked at the CRPL documents and it only confuses me. Could someone help me out with this?

P.S. I'm looking at modifying or creating a custom image based on the Terp image for use with this map as well but I am not any good at graphics. If someone is willing to help, please PM me.

stewbasic

Basically you will add a custom beam image and modify its vertical scale and rotation to hit the target. The commands you need are

http://knucklecracker.com/wiki/doku.php?id=crpl:docs:setimage
http://knucklecracker.com/wiki/doku.php?id=crpl:docs:setimagescaley
http://knucklecracker.com/wiki/doku.php?id=crpl:docs:setimagerotation

I recommend looking at Virgil's bomb script in the credits mission (see http://knucklecracker.com/forums/index.php?topic=14453.0 for how to get the script).

Grayzzur

You need a few more commands than just those.

Virgil's bomb script is a great example. Instructions for opening an existing map in the editor are also on the wiki now.

Basically you need an image with a thin beam graphic and the rest is transparent. The image is scaled in the Y direction for beam thickness. The image is scaled in the X direction for the length of the beam. Then there's math that basically centers the beam halfway between the starting and ending points and rotates it to the correct angle.

Notice that this is all done with pixel coordinates. If you have a map cell you want to use as a target (which I assume, since you're talking about terrain cells), you'll also want to look at CellToPixel which converts a map cell to pixel coordinates, for your target.

Now, who ever thought to themselves, "Trigonometry? When am I ever going to use this in real life?" :)
"Fate. It protects fools, little children, and ships named 'Enterprise.'" -William T. Riker

Crimson King

Thanks for the help with the code. I've got a beam working now. :)