Ok, I'm about out of ideas on this one -
I'm attempting to replicate the way item_collections (netgame_equipment) levitate, but with the actual equipment or weapon tag.
I've got a tiny test script that spawns a few items to try and get it working as a proof of concept, but I can't seem to get anything solid worked out.
Here's what I've tried and the results:
Teleport the item every tick:
- Lags up the rendering, showing the weapon flying up repeatedly from the spawn point. Completely unusable.
Teleport the item once after it "settles" on the ground:
- Closer to what I need, the weapon teleports up to the new "hovering" location and stays there as if on an invisible shelf. However, only an explosion seems capable of getting it down from this spot. Shooting it just causes the weapon to rotate as if it were on the ground. This is the closest behavior to what I need, but not falling after being shot makes it unusable in its current state.
Playing with the "Ignores Gravity" bit. I messed with this a few different ways:
- Write the bit to 1 immediately after spawn - this does nothing. The weapon falls to the ground as normal and has normal gravity behavior afterwards.
- Write the bit to 1 in the actual tag (not the object instance) before spawning. This should act as though the map were modified with eschaton or HMT, however it also seems to have no effect.
- Write the bit to 1 every tick. Still no effect.
For reference, I used Wizard's giant Lua file for offsets and memory mapping, and found that the "ignores gravity" bit is offset of (object_memory + 0x10), bit 2.
I have written and confirmed with a read that it stays the correct value, which makes it even more puzzling. From these results and the fact that I have played with that bitmask flag before, I have a hunch that the offset may be incorrect in its documentation. I'm burned out on this at the moment, but my next step will be to go over the weap/equip entities to see if this is the case.
I really am at wits end here - does anyone have any idea how to accomplish this, or has anyone ever seen it done before in an actual weapon/equipment item, not just using the "levitate" bitmask flag inside the item_collection tag?
This is the last hurdle to getting a complete dynamic spawning timer system working :/
EDIT: I looked at the entity, and found this:
<bitmask16 name="Item.Flags" note="" info="" info_img="" offset="0x17C" visible="true">;
<option name="Always Mantains Z Up" value="15"/>;
<option name="Destroyed by Explosions" value="14"/>;
<option name="Unaffected by Gravity" value="13"/>;
</bitmask16>;
so I tried a write_bit(map_tag_memory + 0x17C, 13, 1)
Still no luck. It's not in a struct, so it should be straightforward (and it didn't crash the server, so that's nice). This should affect all instances of the sniper rifle weapon, since I'm editing the actual weapon tag, not the instance of the object.
Halp plz
Edited by NeX on Jan 1, 2016 at 07:29 PM