Extended Mapscripts

Status
Not open for further replies.

d-luX

Member
Staff member
Super Administrator
Developer
How to add Ammo & Health supplies without editing a map in Radiant.

1. Extract the mapname.script out of the map.pk3 (maps folder)
2. Open the mapname.script with Notepad++ or Visual Studio Code
3. At the begining of the script find those lines:
C++:
game_manager
{
       spawn
       {
and add following code:
C++:
        create
        {
            scriptname "scrf_health"
            targetname "scrf_health"
            origin "4037 -2683 146"
            classname "misc_cabinet_health"
            angle "180"
            mins "-20 -8 -25"
            maxs "20 8 25"
            modelscale "1"
            contents "1"
            clipmask "1"
            model "models/mapobjects/supplystands/stand_health.md3"
        }

        create
        {
            scriptname "scrf_healthtr"
            targetname "scrf_healthtr"
            classname "trigger_heal"
            target "scrf_health"
            origin "4037 -2683 146"
            mins "-45 -45 -25"
            maxs "45 45 25"

            healthtotal "12"
            healthrate "1"

            contents "1"
            clipmask "1"
        }

        create
        {
            scriptname "scrf_ammo"
            targetname "scrf_ammo"
            origin "4037 -2630 146"
            classname "misc_cabinet_supply"
            angle "180"
            mins "-20 -8 -25"
            maxs "20 8 25"
            modelscale "1"
            contents "1"
            clipmask "1"
            model "models/mapobjects/supplystands/stand_ammo.md3"
        }

        create
        {
            scriptname "scrf_ammotr"
            targetname "scrf_ammotr"
            classname "trigger_ammo"
            target "scrf_ammo"
            origin "4037 -2630 146"
            mins "-45 -45 -25"
            maxs "45 45 25"

            ammototal "24"
            ammorate "1"

            contents "1"
            clipmask "1"
        }

Now it should look like this :
C++:
game_manager
{
    spawn
    {
        create
        {
            scriptname "scrf_health"
            targetname "scrf_health"
            origin "4037 -2683 146"
            classname "misc_cabinet_health"
            angle "180"
            mins "-20 -8 -25"
            maxs "20 8 25"
            modelscale "1"
            contents "1"
            clipmask "1"
            model "models/mapobjects/supplystands/stand_health.md3"
        }

        create
        {
            scriptname "scrf_healthtr"
            targetname "scrf_healthtr"
            classname "trigger_heal"
            target "scrf_health"
            origin "4037 -2683 146"
            mins "-45 -45 -25"
            maxs "45 45 25"

            healthtotal "12"
            healthrate "1"

            contents "1"
            clipmask "1"
        }

        create
        {
            scriptname "scrf_ammo"
            targetname "scrf_ammo"
            origin "4037 -2630 146"
            classname "misc_cabinet_supply"
            angle "180"
            mins "-20 -8 -25"
            maxs "20 8 25"
            modelscale "1"
            contents "1"
            clipmask "1"
            model "models/mapobjects/supplystands/stand_ammo.md3"
        }

        create
        {
            scriptname "scrf_ammotr"
            targetname "scrf_ammotr"
            classname "trigger_ammo"
            target "scrf_ammo"
            origin "4037 -2630 146"
            mins "-45 -45 -25"
            maxs "45 45 25"

            ammototal "24"
            ammorate "1"

            contents "1"
            clipmask "1"
        }

//REST OF THE SCRIPT

SHORT EXPLANATION :

C++:
create // Creates a new entity
{
            scriptname "scrf_ammo"                 // Scriptname to show the script here's something happening
            targetname "scrf_ammo"                // Declare a targetname
            origin "4037 -2630 146"                 // The position where your entity should be in the map
            classname "misc_cabinet_supply"  // the classname of the entity
            angle "180"                                    // In which direction the entity should look       
            mins "-20 -8 -25"                           // The origin-clip around the entity (leave it as it is)
            maxs "20 8 25"                              // The origin-box around the entity (leave it as it is)
            modelscale "1"                             // Size of the model (it's better you leave it as it is)
            contents "1"                                 // Enables collisions of the model
            clipmask "1"                                 // No idea but set this to 1 should be the best solution
            model "models/mapobjects/supplystands/stand_ammo.md3" // model of the ammo stand
}

create // Creates a new entity
{
            scriptname "scrf_ammotr"                  // Scriptname to show the script here's something happening
            targetname "scrf_ammotr"                 // Declare a targetname
            classname "trigger_ammo"                // Declare a trigger to say the game HERE IS AN AMMO SUPPLY
            target "scrf_ammo"                            // Enter the targetname you given in the part above ( targetname "scrf_ammo" )
            origin "4037 -2630 146"                    // The position where your entity should be in the map (must be the same like the value of the origin above)
            mins "-45 -45 -25"                            // The origin-clip around the entity (leave it as it is)
            maxs "45 45 25"

            ammototal "24"                                // How many seconds to respawn ammo packs
            ammorate "1"                                   // How many ammo packs are available

            contents "1"                                     // Enables collisions of the model
            clipmask "1"                                    // No idea but set this to 1 should be the best solution
}


4. Open Enemy Territory and load the map on which you would add the supplies.
5. Go to the position where you want to have the supplies , open your console and type "viewpos"
--this will show your current position ( Example: (4037 -2630 208) : 90 )
6. Enter the first three numbers under "origin"
!!!NOTE!!! Subtract the last number with 60 because the last number is the height of your eyes and not the height of your actual position.
7. Enter the fourth number under "angle"

viewpos output : 4037 -2630 208
origin value : 4037 -2630 146


8. Save your script and upload the mapname.script (not compressed) to your server (into the mapscripts folder you given in your mod.cfg)

etpro.cfg : set b_mapscriptdirectory "mapscripts"
nitmod.cfg : set g_mapScriptDirectory "mapscripts"


8.1 Off course you can also make an additional pk3 file , but then players have to download extra files. :/
9. Restart the map or your server ... That's it.



2021-04-28-100252-braundorf_final.jpg
 

mazak

New member
Hello!
Can you tell me why they don't add texture?
The script gives ammo and life.



Code:
// -- ALLIES -- //


            create
              {
            targetname "ammo"
            scriptname "ammo"
            origin "383 3073 -516"
            classname "misc_cabinet_supply"
            angle "20"
            mins "-45 -45 -25"
            maxs "45 45 25"
            ammototal "100"
            modelscale "1"
            contents "1"
            clipmask "1"
            model "models/mapobjects/supplystands/stand_ammo.md3"
              }

                create
              {
            target "ammo"
            ammototal "40"
            ammorate "1"
            origin "383 3073 -516"
            classname "trigger_ammo"
            targetname "ammoarea"
            scriptname "ammoarea"
            modelscale "1"
            contents "1"
            mins "-45 -45 -25"
            maxs "45 45 25"
            clipmask "1"
            }

                create
              {
            targetname "health"
            scriptname "health"
            origin "365 3120 -516"
            classname "misc_cabinet_health"
            angle "20"
            mins "-45 -45 -25"
            maxs "45 45 25"
            modelscale "1"
            contents "1"
            clipmask "1"
            model "models/mapobjects/supplystands/stand_ammo.md3"
              }

                create
              {
            target "health"
            scriptname "healtharea"
            targetname "healtharea"
            classname "trigger_heal"
            origin "365 3120 -516"
            healtotal "400"
            healrate "10"
            modelscale "1"
            contents "1"
            mins "-45 -45-25"
            maxs "45 45 25"
            clipmask "1"
              }

                create
              {
            classname "trigger_objective_info"
            target "help_marker_toi"
            scriptname "ammo_info_toi"
            track "Health and Ammo Cabinets"
            targetname "ammo_info_toi"
            shortname "Health and Ammo Cabinets"
            spawnflags "is_healthammocabinet"
            customimage "gfx/limbo/cm_healthammo"
            origin "383 3120 -516"
            modelscale "1"
            contents "1"
            mins "-45 -45-25"
            maxs "45 45 25"
            clipmask "1"
           }

                create
              {
            classname "misc_commandmap_marker"
            scriptname "help_marker_toi"
            targetname "help_marker_toi"
            contents "1"
            clipmask "1"
               origin "383 3120 -516"
              }

Everything works in axis. I changed in the script only origin and angle.

Code:
// -- AXIS -- //

            create
              {
            targetname "ammo"
            scriptname "ammo"
            origin "8135 4574 -480"
            classname "misc_cabinet_supply"
            angle "90"
            mins "-45 -45 -25"
            maxs "45 45 25"
            ammototal "100"
            modelscale "1"
            contents "1"
            clipmask "1"
            model "models/mapobjects/supplystands/stand_ammo.md3"
              }

                create
              {
            target "ammo"
            ammototal "40"
            ammorate "1"
            origin "8135 4574 -480"
            classname "trigger_ammo"
            targetname "ammoarea"
            scriptname "ammoarea"
            modelscale "1"
            contents "1"
            mins "-45 -45 -25"
            maxs "45 45 25"
            clipmask "1"
            }

                create
              {
            targetname "health"
            scriptname "health"
            origin "8128 4765 -473"
            classname "misc_cabinet_health"
            angle "-90"
            mins "-45 -45 -25"
            maxs "45 45 25"
            modelscale "1"
            contents "1"
            clipmask "1"
            model "models/mapobjects/supplystands/stand_ammo.md3"
              }

                create
              {
            target "health"
            scriptname "healtharea"
            targetname "healtharea"
            classname "trigger_heal"
            origin "8128 4765 -473"
            healtotal "400"
            healrate "10"
            modelscale "1"
            contents "1"
            mins "-45 -45-25"
            maxs "45 45 25"
            clipmask "1"
              }

                create
              {
            classname "trigger_objective_info"
            target "help_marker_toi"
            scriptname "ammo_info_toi"
            track "Health and Ammo Cabinets"
            targetname "ammo_info_toi"
            shortname "Health and Ammo Cabinets"
            spawnflags "is_healthammocabinet"
            customimage "gfx/limbo/cm_healthammo"
            origin "8128 4765 -473"
            modelscale "1"
            contents "1"
            mins "-45 -45-25"
            maxs "45 45 25"
            clipmask "1"
           }

                create
              {
            classname "misc_commandmap_marker"
            scriptname "help_marker_toi"
            targetname "help_marker_toi"
            contents "1"
            clipmask "1"
               origin "8128 4765 -473"
              }

 

d-luX

Member
Staff member
Super Administrator
Developer
That's weird.
I copied your code and for me it works fine.
Is somewhere in your code maybe a missing bracket?

2021-07-10-145746-oasis.jpg
 

mazak

New member
Most likely, the error is somewhere in the script name
I completely disabled the script AXIS
And everything works





As I have more time, I will check which definition is responsible for it and let others know

So that they do not have this problem
 
Status
Not open for further replies.
Top