Not logged in

Please login with username, password and session length or register.


Advanced search  

Author Topic: weapon spawns  (Read 18395 times)

reborn

  • Engineer
  • **
  • Offline
  • Posts: 51
weapon spawns
« on: March 12, 2009, 12:08:24 pm »

I wrote a weapon spawn manager for cnc_reborn, it emulated the Black-cell weapon spawn system where the spawner changed model every x seconds to signify that the weapon given would be random. This was fine as I created the power-up and then granted the random weapon on the ::Custom. However, I was writing a plug-in for SSGM that did the same thing, but without the manager creating the weapon spawns. I was trying to use the Object Create hook to attach a script to the weapon spawn (meaning that I diddn't have to add positions for weapon spawns, just change the existing ones), then found that the weapon spawn isn't actually a power-up at all after the model wasn't changing... Then it turned out that the ObjectCreateHook doesn't even pick up the weapon spawner at all. Period.
Can anyone think of a way to hook it?
I mean, I could probably just attach a script to it in level edit, but that's not the way I wanted to do it, I just wanted to distribute it as a .dll. Needing a modified objects file is pretty crappy, as allot of server owners will already have a modified version.
I can think of otherways to attach the script to the weapon spawn, but it would mean iterating through all the objects with a string comparision every x time. Which is obviously shockingly crap.

So, anyone got any ideas?
Logged

StealthEye

  • Founder
  • Staff
  • Medium Tank driver
  • ******
  • Offline
  • Posts: 939
Re: weapon spawns
« Reply #1 on: March 12, 2009, 03:02:26 pm »

Fix the object create hook to hook all objects (what type is the weapon thing? PowerupGameObj?)... Otherwise you'll indeed have to scan the list every time.

Isn't there another script already attached that you can replace? That's how the SSGM crates work afaik.
Logged

reborn

  • Engineer
  • **
  • Offline
  • Posts: 51
Re: weapon spawns
« Reply #2 on: March 12, 2009, 04:36:22 pm »

Fix the object create hook to hook all objects (what type is the weapon thing? PowerupGameObj?)... Otherwise you'll indeed have to scan the list every time.

Isn't there another script already attached that you can replace? That's how the SSGM crates work afaik.

Nope, there isn't any script already attached.
The crates are included in the object hook, the SSGM_Crate script is attached to them by checking if the object in the objecthookcall is a power-up, then there is a string comparison using the isin function.
The annoying thing about it, is it doesn't actually create the "CnC_Spawner_Crate_Weapon", this is just a preset that spawns other objects, such as "POW_Flamethrower_Player".
These objects are all "As_PhysicalGameObj".
I have attached a script to the weapon spawn in level edit and using that at the moment to continue working on it, but I really don't want to reply on this method. :-(
Logged

StealthEye

  • Founder
  • Staff
  • Medium Tank driver
  • ******
  • Offline
  • Posts: 939
Re: weapon spawns
« Reply #3 on: March 13, 2009, 12:05:58 pm »

You can perhaps find the spawner right after the map loads and attach a script to that?
Logged
 

March 28, 2024, 11:12:52 pm