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

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
linksith
Command Sergeant Major
Command Sergeant Major
Posts: 284
Joined: Mon Jul 12, 2010 12:19 pm
Projects :: Waaay too many projects
Games I'm Playing :: too many
xbox live or psn: me has no xbox
Location: looking for a wifi connection

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

Post 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
User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

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

Post 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.
User avatar
linksith
Command Sergeant Major
Command Sergeant Major
Posts: 284
Joined: Mon Jul 12, 2010 12:19 pm
Projects :: Waaay too many projects
Games I'm Playing :: too many
xbox live or psn: me has no xbox
Location: looking for a wifi connection

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

Post by linksith »

I read the scripting document and it said "name or object" I hoght that would work.
User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

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

Post 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.
Post Reply