Page 3 of 16 FirstFirst 1234513 ... LastLast
Results 31 to 45 of 236

Thread: Bad Company Manager (ApiMod for Servers)

  1. #31
    Colony Founder StompyNZ's Avatar
    Join Date
    Apr 2015
    Posts
    3,420
    Rep Power
    1
    Quote Originally Posted by BeatKidz View Post
    Don't attempt to spawn mobs from your heartbeat thread or any other thread besides the main.
    I tried many different ways but if i spawned mobs from a different thread I would always get a random crash.
    I had to have my heartbeat fire from API.GameUpdate().

    Did you have any luck pulling a particle list? Very interested in that
    Cool, was about to ask what the issues were but you updated

    Maybe I can add a spawn request to a queue then have a check in the api update method and execute them that way. The update method fires a LOT so would want it to be a very light bit of code in there if theres nothing to do.

    My heartbeat starts in the API constructor atm, will see what I can get working.

    Code:
          Dictionary<int, Transform> pe = new Dictionary<int, Transform>();
    
          object[] array = Resources.LoadAll("ParticleEffects", typeof(Transform));
          object[] array2 = array;
          for (int i = 0; i < array2.Length; i++)
          {
            object obj = array2[i];
            string text = ((Transform)obj).gameObject.name;
            if (!text.StartsWith("p_"))
            {
              continue;
            }
            else
            {
              Log.Out(text);
            }
          }
    Last edited by StompyNZ; 01-10-2017 at 09:52 PM.

  2. #32
    Colony Founder StompyNZ's Avatar
    Join Date
    Apr 2015
    Posts
    3,420
    Rep Power
    1
    One thing I was trying to do was create a new entity class object. I got past the first issue of how to reference it in the xml (had to add the assembly info after the class name) but when it trys to spawn says its an empty entity. If I can get that working I can then add unique entities with special abilities such as the resurect zombie MM mentioned, or do a proper suicide zombie rather than the hack one I currently use.

  3. #33
    Colony Founder StompyNZ's Avatar
    Join Date
    Apr 2015
    Posts
    3,420
    Rep Power
    1
    Could also just call the command to spawn via a netpackage I guess and then just call another console command

  4. #34
    Tracker BeatKidz's Avatar
    Join Date
    Oct 2015
    Location
    East Coast USA
    Posts
    230
    Rep Power
    1
    Quote Originally Posted by StompyNZ View Post
    Could also just call the command to spawn via a netpackage I guess and then just call another console command
    I tried calling /se and /sme and both had the same issue with random crashes when called from a separate thread.

    Also I made a resurrection Skill a few weeks ago before i saw madmole make that video. it just checks the defined radius for dead entities. when it finds them it removes them and respawns them in that location
    Last edited by BeatKidz; 01-11-2017 at 03:37 AM.

  5. #35
    Guppycurian Forum Whore Guppycur's Avatar
    Join Date
    Apr 2014
    Location
    Houston-ish, Texas
    Posts
    15,568
    Rep Power
    1
    Do you get the stand up animation when that happens? Can you mask the transition with a particle effect? The cop explosion would be kinda cool...

  6. #36
    Tracker BeatKidz's Avatar
    Join Date
    Oct 2015
    Location
    East Coast USA
    Posts
    230
    Rep Power
    1
    Quote Originally Posted by Guppycur View Post
    Do you get the stand up animation when that happens? Can you mask the transition with a particle effect? The cop explosion would be kinda cool...
    I'm still trying to figure out how to spawn a ParticleEffect at a location. Once that is figured out yes. They do spawn in laying down though

  7. #37
    Colony Founder StompyNZ's Avatar
    Join Date
    Apr 2015
    Posts
    3,420
    Rep Power
    1
    Did you try the GameManager.SpawnParticleEffectServer method? I'm in the middle of updating my persistent data system atm or I'd give it a whirl.

    Did the crash report give any meaningful info?

    Once I get this update sorted i'll have a go at spawning some stuff and see what happens

  8. #38
    Colony Founder StompyNZ's Avatar
    Join Date
    Apr 2015
    Posts
    3,420
    Rep Power
    1
    I've worked out how to read the skills data that was encoded in a memory stream so now I can get the skills (or any other var) for offline players without recording them in the persistent data

    PlayerDataReader for anyone that wants it for a mod

    Code:
          string steamid = "12341234123412345"; // insert steam id here :p
          PlayerDataReader pdr = new PlayerDataReader();
          pdr.GetData(steamid);
    
          foreach (Skill s in pdr.skills)
          {
            SdtdConsole.Instance.Output(s.Name + "\n");
          }
    Last edited by StompyNZ; 01-11-2017 at 11:22 AM.

  9. #39
    Refugee icedsun's Avatar
    Join Date
    Dec 2016
    Posts
    25
    Rep Power
    0
    Sorry to hijack a thread here, but you guys seem so knowledgeable with API mods. There must be some function I can call to load chunk data on my server, but I haven't been able to figure it out yet. Basically, I need to make some block changes in an area that likely won't have any players nearby, so I need the server to load that chunk (even if just temporarily). It must be possible but I have yet to figure out what to call to make it happen.

  10. #40
    Colony Founder StompyNZ's Avatar
    Join Date
    Apr 2015
    Posts
    3,420
    Rep Power
    1
    Quote Originally Posted by icedsun View Post
    Sorry to hijack a thread here, but you guys seem so knowledgeable with API mods. There must be some function I can call to load chunk data on my server, but I haven't been able to figure it out yet. Basically, I need to make some block changes in an area that likely won't have any players nearby, so I need the server to load that chunk (even if just temporarily). It must be possible but I have yet to figure out what to call to make it happen.
    I've been trying to work that out... but its being tricky.

    One idea i have is to spawn an entity with the chunk observer flag set to true to force it to load, but will need to test the idea.

  11. #41
    Refugee icedsun's Avatar
    Join Date
    Dec 2016
    Posts
    25
    Rep Power
    0
    I'm new to reverse-figuring these types of things out. I saw the WorldChunkCache.AddChunkSync() function, but I don't know what object to attach it to. (Tried everything I could think of under GameManager.Instance but couldn't figure out where it should go.) Maybe GameManager.Instance.World.m_ChunkManager has a function that would work?

    Can you spawn an entity into a chunk that's not loaded? I thought of that kind of workaround too, but wasn't sure if it would work.

  12. #42
    Guppycurian Forum Whore Guppycur's Avatar
    Join Date
    Apr 2014
    Location
    Houston-ish, Texas
    Posts
    15,568
    Rep Power
    1
    What's your end goal effect?

  13. #43
    Colony Founder StompyNZ's Avatar
    Join Date
    Apr 2015
    Posts
    3,420
    Rep Power
    1
    Quote Originally Posted by icedsun View Post
    I'm new to reverse-figuring these types of things out. I saw the WorldChunkCache.AddChunkSync() function, but I don't know what object to attach it to. (Tried everything I could think of under GameManager.Instance but couldn't figure out where it should go.) Maybe GameManager.Instance.World.m_ChunkManager has a function that would work?

    Can you spawn an entity into a chunk that's not loaded? I thought of that kind of workaround too, but wasn't sure if it would work.
    the loaded chunk cache is GameManager.Instance.World.ChunkCache

    you can get (i think) the chunk provider with this

    ChunkProviderGenerateWorldRandom2 _chunkProvider = new ChunkProviderGenerateWorldRandom2(GameManager.Inst ance.World.ChunkCache, GameManager.Instance.World.GetWorldCreationData(), GamePrefs.GetString(EnumGamePrefs.GameWorld));

    but I'm not really sure what to do with it after that yet. I was hoping RequestChunk would be what I was looking for but couldnt get it to work the way I wanted.

    GameManager.Instance.World.m_ChunkManager.AddChunk Observer might be something I can use, but didn't get as far as testing it yet.

  14. #44
    Tracker BeatKidz's Avatar
    Join Date
    Oct 2015
    Location
    East Coast USA
    Posts
    230
    Rep Power
    1
    Quote Originally Posted by StompyNZ View Post
    Did you try the GameManager.SpawnParticleEffectServer method? I'm in the middle of updating my persistent data system atm or I'd give it a whirl.

    Did the crash report give any meaningful info?

    Once I get this update sorted i'll have a go at spawning some stuff and see what happens
    Yes I see all the Particle Spawning methods in GameManager I just can't figure out which method to use to create a new ParticleEffect class. Making the ParticleEffect that will be spawned.

    And on the crash when spawning mobs. Nothing in the logs. It was the weirdest crash i have seen. The server just quit working and it asked me to send a report to developers. It took awhile to track what was causing it since it was so random. I'm guessing it has something to do with the main thread iterating over the entity list while i was changing it from a separate thread. not 100% sure though
    Last edited by BeatKidz; 01-11-2017 at 08:12 PM.

  15. #45
    Guppycurian Forum Whore Guppycur's Avatar
    Join Date
    Apr 2014
    Location
    Houston-ish, Texas
    Posts
    15,568
    Rep Power
    1
    Have y'all seen anything that would allow for an observer mode? Log in as an invisible whatever, who can attach themselves to another players 3rd person perspective?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •