Page 1 of 1

How do i change the team of a turret when cp is captured?

Posted: Fri Aug 26, 2011 5:02 pm
by linksith
Hi, I want a certain CP to control the team number of a group of turrets. Say if team 1 starts with cp5 then the turrets would start as team 5 turrets but if team 2 takes the CP then the turrets would change to team 2. I have already attempted to accomplish such but my code (shown below) failed.

Code: Select all

OnTeamChange(
function(object)
if GetEntityName(object) == "cp5" then
SetObjectTeam(tur_bldg_chaingun_roof,GetObjectTeam("cp5")
)
end
end
)
Does anybody have any suggestions that might help? thanks

Re: How do i change the team of a turret when cp is captured

Posted: Fri Aug 26, 2011 5:56 pm
by DarthD.U.C.K.
you will have to use the specific objects name (you cna set in ZE) in order to change its team. "tur_bldg_chaingun_roof" is only the class.

Re: How do i change the team of a turret when cp is captured

Posted: Mon Aug 29, 2011 10:17 am
by linksith
I read the scripting document and it said "name or object" I hoght that would work.

Re: How do i change the team of a turret when cp is captured

Posted: Mon Aug 29, 2011 10:19 am
by DarthD.U.C.K.
both the name (you set in ZE) and the object (the name+number in the right list) work because they both refer to one certain object. a class however refers to.. a class of objects.