Jump to content

NoFoodAfterMidnight

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by NoFoodAfterMidnight

  1. Specifically, I'm looking to add a script to a torpedo when it's created, but to do that I need the entityId of the torpedo, not just it's torpedoId that the callback OnTorpedoLaunched() gives. Entity(torpedoId) doesn't return the correct Entity. Kinda solved it by checking for the entity.type Enum using OnEntityCreated() instead, if it checks out as Torpedo it returns the correct value. However it appears torpedoes can't be given scripts, I guess.
  2. I made a script that destroys blocks when hit, but sometimes when an AI ship loses a block ALL it's turrets are destroyed. I'm using: onBlockDamaged(objectIndex, blockIndex, inflictorId, damage, damageType) Plan():destroy(blockIndex) blockindex returns an obj ID, it's not the BlockIndex, so it's not that no that's not the whole script the whole thing is long, but i've isolated it to the destruction of the block and nothing else changes the issue. Everything works correctly, but for some reason, sometimes, when an AI ship first loses a block from this script ALL of it's turrets are destroyed. I'm not really sure what causes it, it's really bizarre. It's linked to the specific ship and not the blocks being destroyed, it either happens immediately when a ship first loses a block or never. It seems to occur more often on larger ships. It never happens on player owned ships. Adding more turrets to the AI ship just makes those turrets be destroyed immediately when the next block is destroyed. I haven't been able to find a single thing that differs between ships that this happens to and ships it doesn't happen to. Anyone have any clue why this might be happening? Is it just some issue with the hardcoded parts of the game? Solved: AI ships are sometimes generated with turrets that are a higher level material than the blocks they're on, and when the ship's plan changes, I guess it checks the turret's compatibility with the blocks they're on and just destroys them.
  3. I'm a long time coder/modder and have recently started to get into modding avorion. I want to do some interesting stuff but can't seem to figure out how to use callbacks correctly. If someone can give me a working example of RegisterCallback() working, I can figure the rest out myself.
×
×
  • Create New...