Using SetClassProperty to define cp's ownership *SOLVED*
Moderator: Moderators
- lucasfart
- Sith

- Posts: 1440
- Joined: Tue Feb 24, 2009 5:32 am
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Australia
Using SetClassProperty to define cp's ownership *SOLVED*
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...... 
Last edited by lucasfart on Fri Jan 29, 2010 10:17 pm, edited 2 times in total.
- Fiodis
- 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
Actually, a minute's glance into GettingStarted.doc tells you you have to set the starting team in ZE.
- Maveritchell
- Jedi Admin

- Posts: 7366
- Joined: Mon Aug 21, 2006 11:03 pm
Re: Using SetClassProperty/SetProperty to define cp's ownership
Code: Select all
SetProperty("cpX", "Team", "#")- lucasfart
- Sith

- Posts: 1440
- Joined: Tue Feb 24, 2009 5:32 am
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Australia
Re: Using SetClassProperty/SetProperty to define cp's ownership
So are you saying that i should enter this into my lua??Maveritchell wrote:"Team" is not a variable. Variable "cpX" is CP name, and "#" is team number.Code: Select all
SetProperty("cpX", "Team", "#")
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??
- Maveritchell
- Jedi Admin

- Posts: 7366
- Joined: Mon Aug 21, 2006 11:03 pm
Re: Using SetClassProperty/SetProperty to define cp's ownership
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).lucasfart wrote:also does it go in scriptpostload or scriptinit??
- lucasfart
- Sith

- Posts: 1440
- Joined: Tue Feb 24, 2009 5:32 am
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Australia
Re: Using SetClassProperty/SetProperty to define cp's ownership
cool! thanks heaps for that Mav 
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
) on the last one? i needed to for the cp ownership....
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
- [RDH]Zerted
- Gametoast Staff

- Posts: 2982
- Joined: Sun Feb 26, 2006 7:36 am
- Projects :: Bos Wars AI - a RTS game
- xbox live or psn: No gamertag set
- Location: USA
- Contact:
Re: Using SetClassProperty to define cp's ownership NEW QUESTION
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.
Instead of changing the CPs in the Lua script, you can change all those CP properties/settings in ZeroEdit.
- lucasfart
- Sith

- Posts: 1440
- Joined: Tue Feb 24, 2009 5:32 am
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Australia
Re: Using SetClassProperty to define cp's ownership NEW QUESTION
ah ok. thanks for clearing that up Zerted.[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.
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

- 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
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.
- lucasfart
- Sith

- Posts: 1440
- Joined: Tue Feb 24, 2009 5:32 am
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Australia
Re: Using SetClassProperty to define cp's ownership NEW QUESTION
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 CommanderMercuryNoodles 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.
- Maveritchell
- Jedi Admin

- Posts: 7366
- Joined: Mon Aug 21, 2006 11:03 pm
Re: Using SetClassProperty to define cp's ownership NEW QUESTION
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).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
- lucasfart
- Sith

- Posts: 1440
- Joined: Tue Feb 24, 2009 5:32 am
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Australia
Re: Using SetClassProperty to define cp's ownership NEW QUESTION
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 sidedMaveritchell wrote: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).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
