{"id":1531,"date":"2025-10-03T16:07:03","date_gmt":"2025-10-03T15:07:03","guid":{"rendered":"https:\/\/grimms3dworlds.ddns.net\/?page_id=1531"},"modified":"2025-10-03T16:07:03","modified_gmt":"2025-10-03T15:07:03","slug":"coronas-lens-flares","status":"publish","type":"page","link":"https:\/\/grimms3dworlds.ddns.net\/index.php\/coronas-lens-flares\/","title":{"rendered":"Coronas (lens flares)"},"content":{"rendered":"\n<div style=\"font-family: 'Segoe UI', Arial, sans-serif; max-width: 900px; margin: 0 auto; padding: 20px; background: #ffffff; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1);\">\n    <script>\n        function copyCode(button) {\n            const pre = button.previousElementSibling;\n            const code = pre.querySelector('code');\n            const text = code.innerText;\n            navigator.clipboard.writeText(text).then(() => {\n                button.textContent = 'Copied!';\n                button.style.background = '#28a745';\n                setTimeout(() => {\n                    button.textContent = 'Copy';\n                    button.style.background = '#007bff';\n                }, 2000);\n            }).catch(err => {\n                console.error('Failed to copy: ', err);\n            });\n        }\n    <\/script>\n\n    <h1 style=\"color: #1a3c5e; border-bottom: 2px solid #e0e6ed; margin-bottom: 15px; padding-bottom: 8px;\">Adding Corona (Lens Flare) Effects<\/h1>\n\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">This guide explains how to add corona (lens flare) effects to your Call of Duty multiplayer map using a custom script and assets. Follow the steps below to implement the effect correctly.<\/p>\n\n    <p style=\"background: #e7f3fe; border: 1px solid #b6d4fe; padding: 15px; color: #0c5460; border-radius: 5px; margin-bottom: 20px;\">\n        <strong>Note:<\/strong> The corona effect in the Radiant right-click menu may not function properly. Instead, use the provided script and assets below, or create your own using the Asset Manager and Effects Editor.\n    <\/p>\n\n    <img decoding=\"async\" src=\"https:\/\/grimms3dworlds.ddns.net\/wp-content\/uploads\/2025\/10\/corona.png\" alt=\"Corona Effect Example\" style=\"max-width: 500px; display: block; margin: 0 auto 20px; border: 1px solid #ddd; border-radius: 5px;\">\n\n    <h2 style=\"color: #1a3c5e; border-bottom: 2px solid #e0e6ed; margin-bottom: 15px; padding-bottom: 8px;\">Step 1: Creating the Corona Script<\/h2>\n\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">To add the corona effect, you need to create a script file named <code>_corona.gsc<\/code> in your <code>main\/maps\/mp<\/code> folder (for multiplayer maps).<\/p>\n\n    <ol style=\"color: #4a4a4a; padding-left: 20px;\">\n        <li style=\"margin-bottom: 8px;\">Create a new text file named <code>_corona.gsc<\/code> in the <code>main\/maps\/mp<\/code> folder.<\/li>\n        <li style=\"margin-bottom: 8px;\">Open the file in a text editor and add the following code:<\/li>\n    <\/ol>\n\n    <div style=\"position: relative;\">\n        <pre style=\"background: #1e1e1e; color: #ffffff; padding: 15px; border-radius: 5px; font-size: 14px; line-height: 1.4; max-height: 400px; overflow-y: auto; overflow-x: auto; white-space: pre;\">\n            <code>\n\/\/ File: maps\/mp\/_corona.gsc\n\/\/ Purpose: Plays a corona effect specified by script_noteworthy at script_corona entity origins, with fallback to fx\/misc\/missing_fx\n\/\/ Entities: script_corona (classname)\n\/\/ Key-Value Pairs:\n\/\/   - script_noteworthy (string): Specifies the FX to play (optional, full path, e.g., \"fx\/misc\/corona_sun\")\n\ncorona_main()\n{\n    \/\/ Get all entities with classname \"script_corona\"\n    coronas = getentarray(\"script_corona\", \"classname\");\n    \n    \/\/ Process each corona entity\n    for (i = 0; i < coronas.size; i++)\n    {\n        coronas[i] thread corona_effect();\n    }\n}\n\n\/\/ Function to play the corona effect\ncorona_effect()\n{\n    \/\/ Use script_noteworthy if defined, otherwise use fallback\n    if (isdefined(self.script_noteworthy))\n        fx_name = self.script_noteworthy; \/\/ Expects full path, e.g., \"fx\/misc\/corona_sun\"\n    else\n        fx_name = \"fx\/misc\/missing_fx\";\n    \n    \/\/ Load and play the effect (will crash if fx_name is invalid)\n    level._effect[fx_name] = loadfx(fx_name);\n    maps\\mp\\_fx::loopfx(fx_name, self.origin, 0.3, self.origin + (0, 0, 1));\n}\n            <\/code>\n        <\/pre>\n        <button onclick=\"copyCode(this)\" style=\"position: absolute; top: 10px; right: 10px; background: #007bff; color: #ffffff; border: none; padding: 8px 12px; border-radius: 4px; cursor: pointer; font-size: 12px;\">Copy<\/button>\n    <\/div>\n\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">Save the file after adding the code.<\/p>\n\n    <h2 style=\"color: #1a3c5e; border-bottom: 2px solid #e0e6ed; margin-bottom: 15px; padding-bottom: 8px;\">Step 2: Updating Your Map's GSC File<\/h2>\n\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">Next, modify your map's GSC file (<code>mp_yourmapname.gsc<\/code>) to include the corona script.<\/p>\n\n    <ol style=\"color: #4a4a4a; padding-left: 20px;\">\n        <li style=\"margin-bottom: 8px;\">Open <code>mp_yourmapname.gsc<\/code> in a text editor.<\/li>\n        <li style=\"margin-bottom: 8px;\">Add the following line at the top of the file:<\/li>\n    <\/ol>\n\n    <div style=\"position: relative;\">\n        <pre style=\"background: #1e1e1e; color: #ffffff; padding: 15px; border-radius: 5px; font-size: 14px; line-height: 1.4; max-height: 400px; overflow-y: auto; overflow-x: auto; white-space: pre;\">\n            <code>#include maps\\mp\\_corona;<\/code>\n        <\/pre>\n        <button onclick=\"copyCode(this)\" style=\"position: absolute; top: 10px; right: 10px; background: #007bff; color: #ffffff; border: none; padding: 8px 12px; border-radius: 4px; cursor: pointer; font-size: 12px;\">Copy<\/button>\n    <\/div>\n\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">In the <code>main()<\/code> function of the same file, add the following line:<\/p>\n\n    <div style=\"position: relative;\">\n        <pre style=\"background: #1e1e1e; color: #ffffff; padding: 15px; border-radius: 5px; font-size: 14px; line-height: 1.4; max-height: 400px; overflow-y: auto; overflow-x: auto; white-space: pre;\">\n            <code>maps\\mp\\_corona::corona_main();<\/code>\n        <\/pre>\n        <button onclick=\"copyCode(this)\" style=\"position: absolute; top: 10px; right: 10px; background: #007bff; color: #ffffff; border: none; padding: 8px 12px; border-radius: 4px; cursor: pointer; font-size: 12px;\">Copy<\/button>\n    <\/div>\n\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">For example, your <code>main()<\/code> function might look like this:<\/p>\n\n    <div style=\"position: relative;\">\n        <pre style=\"background: #1e1e1e; color: #ffffff; padding: 15px; border-radius: 5px; font-size: 14px; line-height: 1.4; max-height: 400px; overflow-y: auto; overflow-x: auto; white-space: pre;\">\n            <code>\nmain()\n{\n    level._effect = [];\n    maps\\mp\\_load::main();\n    maps\\mp\\_corona::corona_main();\n\n    game[\"allies\"] = \"american\";\n    game[\"axis\"] = \"german\";\n    game[\"attackers\"] = \"allies\";\n    game[\"defenders\"] = \"axis\";\n}\n            <\/code>\n        <\/pre>\n        <button onclick=\"copyCode(this)\" style=\"position: absolute; top: 10px; right: 10px; background: #007bff; color: #ffffff; border: none; padding: 8px 12px; border-radius: 4px; cursor: pointer; font-size: 12px;\">Copy<\/button>\n    <\/div>\n\n    <h2 style=\"color: #1a3c5e; border-bottom: 2px solid #e0e6ed; margin-bottom: 15px; padding-bottom: 8px;\">Step 3: Adding Assets<\/h2>\n\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">To use pre-made sunflare assets, download the <code>sunflares.zip<\/code> file from the following link and extract it to your Call of Duty folder:<\/p>\n\n    <p style=\"color: #4a4a4a; line-height: 1.6;\"><a href=\"https:\/\/grimms3dworlds.ddns.net\/wp-content\/uploads\/2025\/10\/sunflares.zip\">Download sunflares.zip<\/a><\/p>\n\n    <h2 style=\"color: #1a3c5e; border-bottom: 2px solid #e0e6ed; margin-bottom: 15px; padding-bottom: 8px;\">Step 4: Setting Up in Radiant<\/h2>\n\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">Follow these steps to configure the corona effect in Radiant:<\/p>\n\n    <ol style=\"color: #4a4a4a; padding-left: 20px;\">\n        <li style=\"margin-bottom: 8px;\">In the Radiant 2D view, right-click and select <strong>script > origin<\/strong>.<\/li>\n        <li style=\"margin-bottom: 8px;\">With the script origin selected, press <strong>N<\/strong> to open the entity window.<\/li>\n        <li style=\"margin-bottom: 8px;\">Change the <code>classname<\/code> key to <code>script_corona<\/code>.<\/li>\n        <li style=\"margin-bottom: 8px;\">Add a new key named <code>script_noteworthy<\/code> and set its value to the path of your FX file.<\/li>\n    <\/ol>\n\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">If using the provided assets, choose one of the following FX file paths based on your desired effect:<\/p>\n\n    <table style=\"width: 100%; border-collapse: collapse; margin-bottom: 20px;\">\n        <tr style=\"background: #f8f9fa; border: 1px solid #ddd; color: black;\">\n            <th style=\"border: 1px solid #ddd; padding: 8px; text-align: left; color: black;\">Filename<\/th>\n            <th style=\"border: 1px solid #ddd; padding: 8px; text-align: left; color: black;\">Description<\/th>\n            <th style=\"border: 1px solid #ddd; padding: 8px; text-align: left; color: black;\">Color Swatch<\/th>\n        <\/tr>\n        <tr style=\"border: 1px solid #ddd; color: black;\">\n            <td style=\"border: 1px solid #ddd; padding: 8px; text-align: left; color: black;\">fx\/props\/corona_effect<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px; text-align: left; color: black;\">Default corona effect<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px; text-align: left; color: black;\">N\/A<\/td>\n        <\/tr>\n        <tr style=\"border: 1px solid #ddd; color: black;\">\n            <td style=\"border: 1px solid #ddd; padding: 8px; text-align: left; color: black;\">fx\/props\/corona_effect_candle255_147_41<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px; text-align: left; color: black;\">Candle-like warm glow<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px; text-align: left; color: black; background: rgb(255, 147, 41);\">&nbsp;<\/td>\n        <\/tr>\n        <tr style=\"border: 1px solid #ddd; color: black;\">\n            <td style=\"border: 1px solid #ddd; padding: 8px; text-align: left; color: black;\">fx\/props\/corona_effect_mercury_200_255_255<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px; text-align: left; color: black;\">Cool mercury-like glow<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px; text-align: left; color: black; background: rgb(200, 255, 255);\">&nbsp;<\/td>\n        <\/tr>\n        <tr style=\"border: 1px solid #ddd; color: black;\">\n            <td style=\"border: 1px solid #ddd; padding: 8px; text-align: left; color: black;\">fx\/props\/corona_effect_tungsten_255_197_143<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px; text-align: left; color: black;\">Tungsten warm glow<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px; text-align: left; color: black; background: rgb(255, 197, 143);\">&nbsp;<\/td>\n        <\/tr>\n    <\/table>\n\n    <p style=\"background: #e7f3fe; border: 1px solid #b6d4fe; padding: 15px; color: #0c5460; border-radius: 5px; margin-bottom: 20px;\">\n        <strong>Hint:<\/strong> The RGB codes in the filenames (e.g., 255_147_41) indicate the color of the effect. Choose the effect that best matches your map's lighting.\n    <\/p>\n\n    <img decoding=\"async\" src=\"https:\/\/grimms3dworlds.ddns.net\/wp-content\/uploads\/2025\/10\/script_corona.png\" alt=\"Script Corona Setup in Radiant\" style=\"max-width: 500px; display: block; margin: 0 auto 20px; border: 1px solid #ddd; border-radius: 5px;\">\n\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">You can place multiple script origins in your map, and the corona effect will play at each location.<\/p>\n\n    <h2 style=\"color: #1a3c5e; border-bottom: 2px solid #e0e6ed; margin-bottom: 15px; padding-bottom: 8px;\">Step 5: Compiling Your Map<\/h2>\n\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">After setting up the script and assets, compile your map in Radiant to apply the changes.<\/p>\n\n  \n\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>function copyCode(button) { const pre = button.previousElementSibling; const code = pre.querySelector(&#8216;code&#8217;); const text = code.innerText; navigator.clipboard.writeText(text).then(() => { button.textContent = &#8216;Copied!&#8217;; button.style.background = &#8216;#28a745&#8217;; setTimeout(() => { button.textContent = &#8216;Copy&#8217;; button.style.background = &#8216;#007bff&#8217;; }, 2000); }).catch(err => { console.error(&#8216;Failed to copy: &#8216;, err); }); } Adding Corona (Lens Flare) Effects This guide explains how to [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1531","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/grimms3dworlds.ddns.net\/index.php\/wp-json\/wp\/v2\/pages\/1531","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/grimms3dworlds.ddns.net\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/grimms3dworlds.ddns.net\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/grimms3dworlds.ddns.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/grimms3dworlds.ddns.net\/index.php\/wp-json\/wp\/v2\/comments?post=1531"}],"version-history":[{"count":3,"href":"https:\/\/grimms3dworlds.ddns.net\/index.php\/wp-json\/wp\/v2\/pages\/1531\/revisions"}],"predecessor-version":[{"id":1534,"href":"https:\/\/grimms3dworlds.ddns.net\/index.php\/wp-json\/wp\/v2\/pages\/1531\/revisions\/1534"}],"wp:attachment":[{"href":"https:\/\/grimms3dworlds.ddns.net\/index.php\/wp-json\/wp\/v2\/media?parent=1531"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}