Search returned few relavent topics so....
Here's the situation:
I have an object that I want to switch between team 1 and team 2. I want this to occur based on the destruction of a nearby panel. If a member of Team 1 destroys the panel than the object should change to team 1. If a member of team 2 destroys the panel than the object should change to team 2.
Is this possible through LUA? If so, where does the code go? I want to solve this mainly by myself but a few tips (like functions to enter) would be great.
I found these, but since I'm not familiar with LUA syntax, I don't know how to implement them:
GetCharacterTeam
GetTeamMember
SetObjectTeam
EDIT: These lines from the dea1c_con LUA look helpful:
OnObjectRespawnName(PlayAnimExtend, "Panel-Chasm");
OnObjectKillName(PlayAnimRetract, "Panel-Chasm");
If I'm right, then OnObjectKillName(SetProperty("bridgeturret_1", Team, 1), "bridgeconsole1")
would set bridge turret #1 to team 1 on the destruction of bridgeconsole 1.
But, how to make this change depend on the team of the killer?
I think it would be easy if I knew how the syntax.
Change object's team through LUA [Solved]
Moderator: Moderators
-
CressAlbane
- Master Bounty Hunter

- Posts: 1519
- Joined: Fri Dec 18, 2009 8:02 am
- Projects :: CTF Arenas
- Location: ¿uoıʇɐɔoן ʎɯ sıɥʇ sı
Change object's team through LUA [Solved]
Last edited by CressAlbane on Mon Jan 03, 2011 3:54 pm, edited 1 time in total.
- asleeponduty
- Private First Class
- Posts: 77
- Joined: Tue Jul 22, 2008 3:05 pm
- xbox live or psn: No gamertag set
- Location: Illinois
Re: Change object's team through LUA
Try something like this:
Set the objects team to 0 initially
Set the objects team to 0 initially
Code: Select all
-- In the code put this here
SetProperty ("object","Team",2)
OnObjectKill(
function(object,killer)
if GetEntityName(object) == "thethingyoukill" then
SetProperty ("object","Team",1)
end
end
)- Firefang
- Major

- Posts: 518
- Joined: Mon Nov 15, 2010 8:55 pm
- Location: California
Re: Change object's team through LUA
That doesn't specify the killer's team.
That ensures that the killer is on team 1
Code: Select all
SetProperty ("object","Team",2)
OnObjectKill(
function(object,killer)
if GetEntityName(object) == "object" and GetCharacterTeam(killer) == 1 then
SetProperty ("object","Team",1)
end
end
)-
CressAlbane
- Master Bounty Hunter

- Posts: 1519
- Joined: Fri Dec 18, 2009 8:02 am
- Projects :: CTF Arenas
- Location: ¿uoıʇɐɔoן ʎɯ sıɥʇ sı
Re: Change object's team through LUA
This script returned an error, "=" expected near Object.
Looking through it now...
Ok, something I added to the script had an extra space.
It works now, thanks!
Looking through it now...
Ok, something I added to the script had an extra space.
It works now, thanks!
