Sign in to follow this  
Followers 0
Kavawuvi

Item spawner

45 posts in this topic

This script respawns items (weapons/equipment) at a certain interval, deleting them if they have not already been picked up. This script is from the script request section, though modified a bit.

 

Download (SAPP): itmc.lua

 

EDIT: There is a much more improved version of this script by @NeX which you can find here.

Takka, WaeV and HAN-105 like this

Share this post


Link to post
Share on other sites

Tiddy-bits:

I would like to use this as part of a patch for rev maps, since some of the maps have weapons which I forgot to explicitly change the item_collection respawn time -

 

but in the script, the time units aren't specified (or if they are I can't find them).

 

All it says is the format follows:

{"weap","weapons\\rocket launcher\\rocket launcher",5.355,-21.471,-1.749,"ratrace",10.0}

where 10.0 is the "respawntime"....but there's no way it's 10 seconds, and no way it's 10 minutes, so I really don't know how to meaningfully edit these values for other items (and I'm too lazy to sit around and time it)

 

I see references to ticks and the OS clock, but it just provides reference back to checking against this mysterious "respawn time" or desctruction_time later on, so what's going on?


KsqHutE.png

Share this post


Link to post
Share on other sites

Should be seconds. That's what os.clock() reports with. I don't use ticks in here, though SAPP's EVENT_TICK function works every tick.

NeX likes this

Share this post


Link to post
Share on other sites

Alrighty. Now out of curiosity, are those just placeholder values, or is the RL really supposed to respawn every 10 seconds?


KsqHutE.png

Share this post


Link to post
Share on other sites

It's supposed to actually respawn every 10 seconds. I'll look at it later to see if it's doing something funky, but I don't see anything right away that would make it take longer than 10 seconds. I've only gotten a few hours of sleep last night, and I'm barely awake right now, so I might catch something later, or not.

NeX likes this

Share this post


Link to post
Share on other sites

So what causes the discrepancy between the value in seconds within the item_collection tag and how long it actually takes for it to spawn?

 

For instance:

Battle Creek

 

RL itemc tag:  120 seconds

actual time   :  120 seconds

 

camo tag   :  60 seconds

actual time:  66 seconds

 

what causes one item to spawn at a different interval? 

is that the root cause for making this script in the first place? (and if so, is there a simpler way to specify a tag than to require each individual x/y/z coord? That's very tedious).


KsqHutE.png

Share this post


Link to post
Share on other sites

what causes one item to spawn at a different interval? 

is that the root cause for making this script in the first place? (and if so, is there a simpler way to specify a tag than to require each individual x/y/z coord? That's very tedious).

The itmc tag has a base spawn timer. The scenario tag can add or remove additional time. Two good examples are the sniper rifles on Blood Gulch.

 

As for the active camouflage, I got 1 minute + 9 seconds on a client server, counting the time twice, once using a screen recording program and the other with a stopwatch app. Not sure what the deal is, because the scenario tag doesn't add any additional time here.

 

Though on a dedicated server, I got a different time, 1 minute + 7 seconds.

Share this post


Link to post
Share on other sites

The itmc tag has a base spawn timer. The scenario tag can add or remove additional time. Two good examples are the sniper rifles on Blood Gulch.

 

As for the active camouflage, I got 1 minute + 9 seconds on a client server, counting the time twice, once using a screen recording program and the other with a stopwatch app. Not sure what the deal is, because the scenario tag doesn't add any additional time here.

 

Though on a dedicated server, I got a different time, 1 minute + 7 seconds.

 

 

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? 


KsqHutE.png

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.