Sign in to follow this  
Followers 0
Kavawuvi

Item spawner

45 posts in this topic

So the vibe I'm getting is that item_collections aren't going to be the solution using purely tag-based changes.

 

[bask on topic]

That being said, there has to be a better way of doing this - rather than manually setting each weapon to respawn on an interval, couldn't the spawn time field be read from the item_collection tags, and then translated into seconds to be used for respawning all of them at once, rather than on an individual basis?

Or at least using the existing item_collection locations to save the time for manually reading them in geurilla/sapien and inputting them into a bunch of copy-pasted lines? 

 

Not all equipment have item collection tags. The gravity rifle does not, as well as weapon magazines and the crashy double speed powerup.

 

Also, I found that the client and server may operate at slightly less than 30 ticks per second. This could be the source of the additional time added. Unlocking the framerate may improve it slightly.

Share this post


Link to post
Share on other sites

Tiddy-bits:

How does this work with gametypes? Would i need a seperate customized script for each gametype option and configuration for every map? Or will having extraneous entries work just fine? 

 

for instance - if I have the rocket launcher on Creek set to spawn on that arch every 2 minutes, and I decide to play a game of shotguns only, is it going to still spawn a rocket launcher up there, since it is just using weapon tags?


Seems to delete weapons even after they are picked up.


KsqHutE.png

Share this post


Link to post
Share on other sites

for instance - if I have the rocket launcher on Creek set to spawn on that arch every 2 minutes, and I decide to play a game of shotguns only, is it going to still spawn a rocket launcher up there, since it is just using weapon tags?

 

Halo overrides the spawning of any weapon using whatever is set in the matg tag, which you can see if you use cheat_all_weapons in a weapon-specific gametype. It'll be replaced by a shotgun, or whatever the shotgun slot in the matg tag is set to.

 

This CAN be bypassed by modifying the matg tag before spawning then changing it back immediately after.

Share this post


Link to post
Share on other sites

Halo overrides the spawning of any weapon using whatever is set in the matg tag, which you can see if you use cheat_all_weapons in a weapon-specific gametype. It'll be replaced by a shotgun, or whatever the shotgun slot in the matg tag is set to.

 

This CAN be bypassed by modifying the matg tag before spawning then changing it back immediately after.

 

Ok. I knew it was based on the globals weapon list, but I didn't know if all weapons were changed, good to know.

 

What about the deletion of weapons from the timer?

 

I made a test on creek where I spawn a rocket launcher every 10 seconds, and if I pick it up, it is removed from my hands when the new one spawns, despite code in the script that supposedly removes it from the list of weapons to delete.


KsqHutE.png

Share this post


Link to post
Share on other sites

seems like this script good for arcade gametype you made. but i guess, i am kind of who dont want to delete the weapon on player's hand even the time is over

NeX likes this

Share this post


Link to post
Share on other sites

seems like this script good for arcade gametype you made. but i guess, i am kind of who dont want to delete the weapon on player's hand even the time is over

 

From the code and comments I don't think this is intentional - and knowing 002 it likely worked at the last post. May have been a SAPP update that broke it, or perhaps there are certain circumstances that cause it sometimes.

 

Problem is I don't have the time right now to debug it myself :/


KsqHutE.png

Share this post


Link to post
Share on other sites

FIxed the code.

WeaponType was not correct, which borked the object_id to not correspond to the correct weapon, causing it to delete it (it thought you had just picked up your other weapon, not the spawned weapon).

 

Also, anyone using the script should be using api version 1.9.0.0 now, instead of 1.6.0.0, which was the api when this script was originally written.

function WeaponPickup(PlayerIndex,WeaponType,WeaponSlot)
    -- Check if it was a weapon (2)
    if(WeaponType == "2") then
        -- Weapon was picked up. We need to scan the player's inventory for the object ID.
        local player_dyn = get_dynamic_player(PlayerIndex)
        local object_id = read_dword(player_dyn + 0x2F8 + (tonumber(WeaponSlot)) * 0x4)
        -- Iterate through all valid items.
        for k,v in pairs(items_to_use) do
		cprint("in pairs")
            if(v.item ~= nil) then
				cprint("not nil")
				cprint(v.item.object_id)
				cprint(object_id)
                if(v.item.object_id == object_id) then
                    -- Player has picked up a spawned weapon. No longer keep track of it.
                    v.item.object_id = nil
                end
            end
        end
    end
end

just wanted you to see this in notifications :P

 

Is there an easy way to alter the rotation of the spawned weapon? 

Edited by NeX

KsqHutE.png

Share this post


Link to post
Share on other sites

Is there an easy way to alter the rotation of the spawned weapon? 

 

sehé°° says it's not possible with the spawn_object function, as it will only set rotation for vehicles.

NeX likes this

Share this post


Link to post
Share on other sites

sehé°° says it's not possible with the spawn_object function, as it will only set rotation for vehicles.

 

Fair enough. Just an aesthetics thing anyway.

Here's a good question for ya: is there a way to prevent regular item_collection spawns globally? I am trying to replace all existing spawns with these timers, and I'm getting the double-spawns from the script-based spawns on top of the standard spawns.

If I could just turn off the standard spawns that would be good


KsqHutE.png

Share this post


Link to post
Share on other sites

Here's a good question for ya: is there a way to prevent regular item_collection spawns globally? I am trying to replace all existing spawns with these timers, and I'm getting the double-spawns from the script-based spawns on top of the standard spawns.

 

You can just go into the scenario tag and set the number of netgame equipment to 0 and use sv_map_reset immediately afterwards. It could be done without sv_map_reset, but it's a bit trickier.

 

Example script:

api_version = "1.9.0.0"
function OnScriptLoad() register_callback(cb['EVENT_GAME_START'],"OnGameStart") end
function OnScriptUnload() end
function OnGameStart()
    local scenario_tag_id = read_dword(0x40440004)
    local scenario_tag = lookup_tag(scenario_tag_id)
    local scenario_tag_data = read_dword(scenario_tag + 0x14)
    write_dword(scenario_tag_data + 0x384, 0)
    execute_command("sv_map_reset")
end

This will remove all equipment and weapons from the map that are spawned through an item collection tag other than starting equipment.

NeX likes this

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0
  • Recently Browsing   0 members

    No registered users viewing this page.