How to get cp spawn names

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

How to get cp spawn names

Post by Anakin »

Hey,

i need to get the cp spawn names. I know that there are ways via hexedit or looking into the source, but i need to get the names within lua code.
So is there any function that returns the the spawn path name of an cp? I already know the cp's name. Maybe there is a standard function that is always called to initialize the cp or something like that. So i can wrap that function and grep the name.
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: How to get cp spawn names

Post by Marth8880 »

Nope, there are no Lua functions that return a CP's spawn path name. With that said though, at one point during MEU's development I had to get all the stock maps' CP spawn path names, which you can find here: https://github.com/marth8880/MEUScripts ... tCPs&type=
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: How to get cp spawn names

Post by Anakin »

Any idea on how to find the cp spawn names for custom maps? I know the cp names and i can get the object's pointer. Isn't there any function that manages the spawning, that can be wrapped?

Or we'd need to rewrite the ai hero support script, so it does no longer need the cps.
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: How to get cp spawn names

Post by Marth8880 »

>Isn't there any function that manages the spawning, that can be wrapped?

No, not really. The AI Hero Support script uses the built-in 'SpawnCharacter' function, which spawns a specified unit (by its character index) at the specified spawn point (returned from 'GetPathPoint'), but that's the only spawning-related function that's exposed to Lua. See here: https://github.com/marth8880/MEUScripts ... t.lua#L254

What exactly are you trying to do here specifically?
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: How to get cp spawn names

Post by Anakin »

i want to write a user script that enables ai hero for every map and mod. I can insert/wrap everything i need, but the problem are the cp path names. Since in conquest mods there is the conqest:newCP function that needs to be called it's easy to catch the names of the cps here, but i still need the path names.

==EDIT==

what about this? http://www.gametoast.com/viewtopic.php?p=126047#p126047

Is there a way to get ANY character from a specified team? We just let the hero spawn next to him. Best would be if we can catch a unit that recently spawned.


==EDIT==

or can we maybe use GetCommandPostCaputreRegion and then get the matrix from that region and spawn at that place? Or we take the matrix of the Command Post itself
ARCTroopaNate
Jedi
Jedi
Posts: 1161
Joined: Mon Mar 21, 2011 8:12 pm
Projects :: Star Wars Battlefront - Tides of War
Games I'm Playing :: SWBF2 RC EAW
xbox live or psn: I have ps4
Location: STALKER!
Contact:

Re: How to get cp spawn names

Post by ARCTroopaNate »

Bit of a bump, but just wanted to thank you for posting those Marth. Been struggling with the zeroeditor runtime error but really just needed it to look these up, now I don't have to.
Post Reply