Author Topic: old school nade-kit and med-kit spawns  (Read 4443 times)

0 Members and 1 Guest are viewing this topic.

Offline ginn

  • Camper
  • ***
  • Posts: 479
old school nade-kit and med-kit spawns
« on: August 27, 2023, 08:32:48 am »
A script that restore how nade/med-kits were supposed to be spawned.

It'll gather all the spawn points, and then assign team based on shortest distance to whichever flag.
Then it'll only spawn nades/meds kits at your own teams spawn points, that you pick up.
It'll also not allow a med/nade kit to be spawned to the closest spawn location to where it was picked up from.

So it should work with all maps, but if you do something weird with the kit spawns (they fall down into the same place) they might only spawn at one of the valid points.
This uses legacy, there isn't sufficient documentation on SC3 to only use it.

The larger kits.pas has removed a couple of useless variables, and uses just temp := nades/meds instead of manual copying values. Not entirely sure  if it works as it should (seems to), I don't know how pascal works with value/reference.
It also has a const num that decided the size of the arrays, 4-6 is probably enough but set to 12 now (older is 32).
It takes in admin command or tcpmessage, with '/kitsON', '/kitsOFF', and '/kitsToggle', where it'll turn the script on/off/toggle. If it's Off it'll still be "active", but there's a boolean check wheter to do special kit spawning, and if it should use special kit spawning at the start of map change.
Whenever it's turned on it'll remove all kits in the game and replace it with new ones, basically resetting all kits.
« Last Edit: August 27, 2023, 12:55:09 pm by ginn »

Offline ginn

  • Camper
  • ***
  • Posts: 479
Re: old school nade-kit and med-kit spawns
« Reply #1 on: August 28, 2023, 07:05:02 am »
Made an update.

Previous each time a new kit was gonna spawn, it'd do a distance check to all the med kits to see which one the player was closest to, and then try to not spawn on that spawn point. I also removed a bias in spawn location decision, in case there are 3 more more spawns for a team.
Now instead of looping through each spawn with distance checks it'll just iterate through a list of the spawn points to see if the item spawned from it. This is much faster, takes a tiny bit more memory though (but with num=12 it's may, it shouldn't be more than 500 bytes).
I'm still not sure how reference vs value works in pascal, so I've made some pretty ugly workarounds....

This one is faster than the previous one, but I haven't tested this as much.
« Last Edit: August 28, 2023, 10:01:57 am by ginn »