Page 1 of 1

Allies take CPs Problem

Posted: Sat Aug 29, 2009 8:21 pm
by darthvatrayen
Hello again. I need help. (as usual Q.Q)
Anyway. I am making a new map that involves both ATT and DEF to be allies. I set them as friends but they still took each other's cps. :runaway: Thanks for the help in advance. :bowdown:

Re: Allies take CPs Problem

Posted: Sat Aug 29, 2009 10:34 pm
by Tourny
Are you ready for some scripting? This is this code's objective:

Team 2 Player: *spawns*
Game: Hey, you're on team 2!
Game: *turns him into a team 1 player*

Follow these steps:

1. Open you're lua.
2. Place this code over this (<EDIT) part of the lua:
Hidden/Spoiler:
[code]end



---------------------------------------------------------------------------
-- FUNCTION: ScriptInit
-- PURPOSE: This function is only run once
-- INPUT:
-- OUTPUT:
-- NOTES: The name, 'ScriptInit' is a chosen convention, and each
-- mission script must contain a version of this function, as
-- it is called from C to start the mission.
---------------------------------------------------------------------------
[/code]
Code:
Hidden/Spoiler:
[code]OnCharacterSpawn(
function(player)
if GetCharacterTeam(player) == "%TeamYouWantToChangeFrom%" then
local %MakeUpAVariable% = GetEntityName(player)
SetProperty(%samevariable%, Team, %TeamToChangeTo%)
end
end
)
[/code]
Try this code and see what happens. The Team variables can be ATT or DEF, or also 1, 2, etc, I think.

3. Save your lua.
4. Munge.
5. Play your map.