Page 1 of 1

Using SetClassProperty to define cp's ownership *SOLVED*

Posted: Wed Jan 27, 2010 7:25 pm
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:

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

Posted: Wed Jan 27, 2010 7:30 pm
by Fiodis
Actually, a minute's glance into GettingStarted.doc tells you you have to set the starting team in ZE.

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

Posted: Wed Jan 27, 2010 7:32 pm
by Maveritchell

Code: Select all

SetProperty("cpX", "Team", "#")
"Team" is not a variable. Variable "cpX" is CP name, and "#" is team number.

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

Posted: Wed Jan 27, 2010 7:41 pm
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??

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

Posted: Wed Jan 27, 2010 8:09 pm
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).

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

Posted: Wed Jan 27, 2010 8:10 pm
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....

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

Posted: Thu Jan 28, 2010 3:46 am
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.

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

Posted: Thu Jan 28, 2010 6:36 am
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.

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

Posted: Thu Jan 28, 2010 3:55 pm
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.

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

Posted: Thu Jan 28, 2010 9:14 pm
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 :?

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

Posted: Thu Jan 28, 2010 9:39 pm
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).

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

Posted: Thu Jan 28, 2010 9:53 pm
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