Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Donate
Collapse

Plutonium

  1. Home
  2. BO2 Modding Support & Discussion
  3. Getting Coordinates of Spawned Craftable Parts

Getting Coordinates of Spawned Craftable Parts

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
7 Posts 2 Posters 147 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Jason_undefined Offline
    Jason_undefined Offline
    Jason_
    wrote on last edited by
    #1

    Any idea on how to do this on MOTD?

    Tried to loop through level.zombies_craftablestubs but that array is empty. I've been looking through the T6 stock scripts for ages and i cant find the logic for where the parts are randomly spawned either. Any help would be great.

    1 Reply Last reply
    0
    • Resxtundefined Offline
      Resxtundefined Offline
      Resxt Plutonium Staff
      wrote on last edited by
      #2

      It seems to do some quite complex work with arrays, I think it duplicates one too + it might use unitrigger dynamically spawned so it's hard to get the right target. I never got to make what I wanted work with parts too.

      If I ever get it I'll let you know
      If you do lmk too

      Jason_undefined 1 Reply Last reply
      0
      • Jason_undefined Offline
        Jason_undefined Offline
        Jason_
        replied to Resxt on last edited by
        #3

        Resxt Sure thing, it just doesn't make any sense how the parts can only spawn in certain locations but when you search through the stock scripts there's literally 0 coordinates anywhere for any parts. Very confusing 😧

        1 Reply Last reply
        0
        • Resxtundefined Offline
          Resxtundefined Offline
          Resxt Plutonium Staff
          wrote on last edited by
          #4

          You could take a look at the _zm_craftables.gsc script
          It has functions (or array) you could try to check (.size and IsDefined(piece))

          For example this
          https://github.com/plutoniummod/t6-scripts/blob/d8e72bcb38d041dcd63a9447ec52dbb8bbeaeb0d/ZM/Maps/Origins/maps/mp/zombies/_zm_craftables.gsc#L2875

          1 Reply Last reply
          0
          • Jason_undefined Offline
            Jason_undefined Offline
            Jason_
            wrote on last edited by
            #5

            Hi again, it seems that array is still empty. Could it be because the parts aren't spawned immediately? Still trying this on MOTD. Tried looking for a waittill flag for parts being spawned but i can't seem to find anything. Still very new to GSC so not too sure what's going on here.

            #include common_scripts\utility;
            #include maps\mp\_utility;
            #include maps\mp\zombies\_zm_utility;
            #include maps\mp\gametypes_zm\_hud_util;
            #include maps\mp\zombies\_zm_laststand;
            #include maps\mp\zombies\_zm_equipment;
            #include maps\mp\zombies\_zm_unitrigger;
            #include maps\mp\zombies\_zm_craftables;
            #include maps\mp\zombies\_zm_stats;
            #include maps\mp\zombies\_zm_weapons;
            #include maps\mp\_demo;
            
            init()
            {
                level thread onplayerconnect();
            }
            
            onplayerconnect()
            {
                for(;;) {
                    level waittill ("connecting", player);
                    player thread onplayerspawned();
                }
            }
            
            onplayerspawned()
            {
                self endon("disconnect");
            	level endon("end_game");
                for (;;) {
                    self waittill("spawned_player");
                    if (isdefined(level.a_uts_craftables)) {
                        println(level.a_uts_craftables.size);
                    }
                }
            }
            
            Resxtundefined 1 Reply Last reply
            0
            • Resxtundefined Offline
              Resxtundefined Offline
              Resxt Plutonium Staff
              replied to Jason_ on last edited by
              #6

              Jason_ I would wait for initial_blackscreen_passed or a long time or something like you reloading

              1 Reply Last reply
              1
              • Jason_undefined Offline
                Jason_undefined Offline
                Jason_
                wrote on last edited by Jason_
                #7

                Got it to work! The function I was looking for was get_craftable_piece_model. I also checked if the parts had a delay to being spawned in which turned out to be true so there's a check for that too when the player spawns.

                Heres the code and a link to the function:

                #include common_scripts\utility;
                #include maps\mp\_utility;
                #include maps\mp\zombies\_zm_utility;
                #include maps\mp\gametypes_zm\_hud_util;
                #include maps\mp\zombies\_zm_laststand;
                #include maps\mp\zombies\_zm_equipment;
                #include maps\mp\zombies\_zm_unitrigger;
                #include maps\mp\zombies\_zm_craftables;
                #include maps\mp\zombies\_zm_stats;
                #include maps\mp\zombies\_zm_weapons;
                #include maps\mp\_demo;
                
                init()
                {
                    level thread onplayerconnect();
                }
                
                onplayerconnect()
                {
                    for(;;) {
                        level waittill ("connecting", player);
                        player thread onplayerspawned();
                    }
                }
                
                onplayerspawned()
                {
                    self endon("disconnect");
                	level endon("end_game");
                    for (;;) {
                        self waittill("spawned_player");
                        while ( level.a_uts_craftables.size == 0 ){
                            wait 1;
                        }
                        dolly = get_craftable_piece_model("alcatraz_shield_zm", "dolly");
                        teleportPlayer(self, dolly.origin, dolly.angles);
                        
                    }
                }
                
                teleportPlayer(player, origin, angles)
                {
                    player setOrigin(origin);
                    player setPlayerAngles(angles);
                }
                

                https://github.com/plutoniummod/t6-scripts/blob/d8e72bcb38d041dcd63a9447ec52dbb8bbeaeb0d/ZM/Maps/Origins/maps/mp/zombies/_zm_craftables.gsc#L2902

                Thanks for your help, i would have been looking about for the function for ages 😊

                1 Reply Last reply
                2

                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Donate