Using SetClassProperty to define cp's ownership *SOLVED*

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
lucasfart
Sith
Sith
Posts: 1440
Joined: Tue Feb 24, 2009 5:32 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Australia

Using SetClassProperty to define cp's ownership *SOLVED*

Post by lucasfart »

Being a hopeless lua scripter, i was wondering if someone could tell me what code i have to write into my lua to set the team for a cp.....this is because i am using the default conquest cp's for my xl mode but i wanted the cp ownership at the start to be different. should be pretty simple for all you crazy scripters out there...... :wink:
Last edited by lucasfart on Fri Jan 29, 2010 10:17 pm, edited 2 times in total.
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Re: Using SetClassProperty/SetProperty to define cp's ownership

Post by Fiodis »

Actually, a minute's glance into GettingStarted.doc tells you you have to set the starting team in ZE.
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Using SetClassProperty/SetProperty to define cp's ownership

Post by Maveritchell »

Code: Select all

SetProperty("cpX", "Team", "#")
"Team" is not a variable. Variable "cpX" is CP name, and "#" is team number.
User avatar
lucasfart
Sith
Sith
Posts: 1440
Joined: Tue Feb 24, 2009 5:32 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Australia

Re: Using SetClassProperty/SetProperty to define cp's ownership

Post by lucasfart »

Maveritchell wrote:

Code: Select all

SetProperty("cpX", "Team", "#")
"Team" is not a variable. Variable "cpX" is CP name, and "#" is team number.
So are you saying that i should enter this into my lua??

SetProperty("cp2", "Team", "1")

i actually tried that but i didn't do " around the last one....

also does it go in scriptpostload or scriptinit??
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Using SetClassProperty/SetProperty to define cp's ownership

Post by Maveritchell »

lucasfart wrote:also does it go in scriptpostload or scriptinit??
It can go wherever you want as long as it comes after the world's .lvl file is loaded. It is usually best to put any code into ScriptPostLoad (not that it won't work in ScriptInit, but it cuts down on the margin of error).
User avatar
lucasfart
Sith
Sith
Posts: 1440
Joined: Tue Feb 24, 2009 5:32 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Australia

Re: Using SetClassProperty/SetProperty to define cp's ownership

Post by lucasfart »

cool! thanks heaps for that Mav :D

EDIT: It worked perfectly!
If i wanted to do the same for which capture region a cp loads would this work??
SetProperty("cp#", "CaptureRegion", "[NAME HERE]")
also if i wanted the cp to load no region at all (be uncaptureable) would i just leave the last one blank or make a name that doesnt exist?

also i wanted to raise the health of Mav's Wookiee Defender from DT so i added this text in but it didn't work:
SetClassProperty("all_inf_wookieedef", "MaxHealth", "300")
also tried it with SetProperty..

EDIT: Looked at the old FAQ and saw that i should try this:
SetClassProperty("all_inf_wookieedef", "MaxHealth", 300)
do i add "(are they called parenthesis?-can't remember :roll: ) on the last one? i needed to for the cp ownership....
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: Using SetClassProperty to define cp's ownership NEW QUESTION

Post by [RDH]Zerted »

The " character is called a quotation mark. In programming, you put them around characters to turn them into strings. "300" is not a number, but 300 is a number. You want the MaxHealth to be a number, so just use 300.

Instead of changing the CPs in the Lua script, you can change all those CP properties/settings in ZeroEdit.
User avatar
lucasfart
Sith
Sith
Posts: 1440
Joined: Tue Feb 24, 2009 5:32 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Australia

Re: Using SetClassProperty to define cp's ownership NEW QUESTION

Post by lucasfart »

[RDH]Zerted wrote:The " character is called a quotation mark. In programming, you put them around characters to turn them into strings. "300" is not a number, but 300 is a number. You want the MaxHealth to be a number, so just use 300.

Instead of changing the CPs in the Lua script, you can change all those CP properties/settings in ZeroEdit.
ah ok. thanks for clearing that up Zerted.

I know i can change them in ZE but i'm using the conquest layer for both conquest and xl so i don't have to redo everything. if there's a perfectly good code out there that'll let me fix it in a matter of seconds it'd make things a lot easier.
MercuryNoodles
Jedi
Jedi
Posts: 1003
Joined: Sun Mar 12, 2006 7:16 pm
Projects :: Space - Boarding Action
xbox live or psn: No gamertag set

Re: Using SetClassProperty to define cp's ownership NEW QUESTION

Post by MercuryNoodles »

Are you sure you want to use a MaxHealth value of 300 for the Wookiee Defender? That's actually less health than a normal trooper, which is 400, and the all side's wookiee is at 800. I mean, I don't what its health is normally, and it's your call, but it just seems odd for 300 to be an increase in health for what is, aside from the locals version, among the most armored units in the game.
User avatar
lucasfart
Sith
Sith
Posts: 1440
Joined: Tue Feb 24, 2009 5:32 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Australia

Re: Using SetClassProperty to define cp's ownership NEW QUESTION

Post by lucasfart »

MercuryNoodles wrote:Are you sure you want to use a MaxHealth value of 300 for the Wookiee Defender? That's actually less health than a normal trooper, which is 400, and the all side's wookiee is at 800. I mean, I don't what its health is normally, and it's your call, but it just seems odd for 300 to be an increase in health for what is, aside from the locals version, among the most armored units in the game.
After i got it working i realised that it gave them less health so i changed it around. i didn't realise how much health they had ....... and how much one bullet takes for that matter. they were getting mowed down by Mav's Stormtrooper Commander :?
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Using SetClassProperty to define cp's ownership NEW QUESTION

Post by Maveritchell »

lucasfart wrote:After i got it working i realised that it gave them less health so i changed it around. i didn't realise how much health they had ....... and how much one bullet takes for that matter. they were getting mowed down by Mav's Stormtrooper Commander :?
They are normally set to 500 health, and DT units by default have the same default health as standard units - 400. The number they are set at is best for balance, since they have a strong melee attack as well (in addition to a ranged attack).
User avatar
lucasfart
Sith
Sith
Posts: 1440
Joined: Tue Feb 24, 2009 5:32 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Australia

Re: Using SetClassProperty to define cp's ownership NEW QUESTION

Post by lucasfart »

Maveritchell wrote:
lucasfart wrote:After i got it working i realised that it gave them less health so i changed it around. i didn't realise how much health they had ....... and how much one bullet takes for that matter. they were getting mowed down by Mav's Stormtrooper Commander :?
They are normally set to 500 health, and DT units by default have the same default health as standard units - 400. The number they are set at is best for balance, since they have a strong melee attack as well (in addition to a ranged attack).
yeah, but i made a hunt mode with wookiees vs Stormtrooper commanders........the wookiees would get mowed down in about 1 second of repeated blaster fire before they could even get close....it's actually pretty fun to play but a little bit one sided :D
Post Reply