Welcome to Open Carnage

A resource for Halo 1 modding and tech, with unique means of rewarding individual content creation and support. Have a wander to see why we're worth the time! EST. 2012

Sign in to follow this  
Followers 0

Disable Weapon Despawn

Sorry if I sound like a broken record with this, but I can't seem to get any definitive answers.



Is there a way to disable the automatic despawn of weapons, or to increase the amount of time the default is? Currently the issue I'm having occurs at 30 seconds with the spawn_object API function, but anything over about 150 seconds would be fine as well. Is there a specific portion of memory that can be altered to that effect? I've browsed through every offset script and object structure doc I can find, but haven't come across anything useful like that.


Here is a link to the Phasor documentation for its createobject API function, which can disable "respawn" with a boolean parameter - I guess that would work, but I think just changing the default as a global setting would be easier and still provide the complete functionality I'm looking for.


Makes me wonder if this particular section of memory per object would be useful in this 


obj_existance_time = readdword(m_object + 0xC) -- Confirmed. (1 second = 30 ticks)

....my first reaction is to continually write 0 here to every object I want to control, but if this exists then there is also a number somewhere that it is compared against. That's the number I want to find/edit.



Smiley also posted the obj. structure with this:

unsigned long timer; // 0x0014

Which I found corresponds to this

obj_marker_id = readdword(m_object + 0x14) -- Tested. Continually counts up from like 89000...

Not really sure what to make of that. The description doesn't really say anything useful, and the name "marker_id" could refer to all sorts of things. *shrug*

WaeV likes this


Share this post

Link to post
Share on other sites

Members of Open Carnage never see off-site ads.

I just wrote this on the SAPP forum, but you're looking for read_dword(Weapon + 0x204). Halo compares this value with the tick counter minus 0x384 (900 ticks or 30 seconds). While a player is holding the weapon, Halo sets it to the tick counter, so it never despawns when the player is holding it. When the weapon is dropped, it does not increase anymore.


You could disable automatic respawning for this weapon by setting it to 2147483647 I guess? I cannot find 0x384 anywhere in the object struct, so it may be in Halo's code. I probably could go and look at objects spawned through item collections and see how they do stuff.

WaeV and NeX like this

Share this post

Link to post
Share on other sites

interesting. That's basically what I was proposing on the SAPP forum. 


If when the weapon is not held by player, its tick value isn't being written to each time with the current tick counter, then I would only have to set the custom value once. 


I'm planning on using this with your itemc script, so despawns/destroys and player interactions are already taken care of - plus once a player picks it up, that giant number I force feed into its last-interacted-with slot should be overwritten by the current tick counter, causing it to despawn after 30 seconds from a drop - which is correct anyway.


I just need to get in between that process for the first time an object spawns, really. 


Worst case I can add it to the onEventTick to keep overwriting it until a player picks it up, and after someone interacts with it just leave halo to its normal duties.


Does that logic sound....sound?


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0
  • Recently Browsing   0 members

    No registered users viewing this page.