Page 1 of 1

Teleport units to a special time

Posted: Thu Nov 26, 2009 2:29 pm
by [Skirata]Darman[M]
Hey GT, has someone of you an Idea or knows what the key code for the "teleport all units of team x " of the fakeconsole is? I would like to add it to a campaign if this is possible.

Re: Teleport units to a special time

Posted: Thu Nov 26, 2009 5:34 pm
by Fiodis
Look at the FAQ topic for the teleporter code, then just widen it to move all players of the proper team. Of course, instead of OnEnterRegion it'd be OnObjectiveComplete or whatever you need it to be.

Re: Teleport units to a special time

Posted: Fri Nov 27, 2009 12:46 pm
by [Skirata]Darman[M]
THANKS guy, I'll do this

EDIT
Alright but where should I put in the names of the units that should be teleported? I think that example only shows how it works for yourself. :? :? :?

Re: Teleport units to a special time

Posted: Fri Nov 27, 2009 5:41 pm
by [RDH]Zerted
The following code loops over all the team members of teams 1 and 2. Put your unit teleporting code after the comment saying to put it there.
Hidden/Spoiler:
[code]--the teams whos units will be iterated/looped over
local teams = {1, 2}

--loop vars
local team = nil
local size = nil
local player = nil
local unit = nil

--for each team,
for team = 1, table.getn(teams) do

--get the team's size
local size = GetTeamSize( teams[team] )

--for each team member,
local m
for m = 0, size-1 do

--get a team member's unit
player = GetTeamMember(teams[team], m)
unit = GetCharacterUnit(player)

--if the unit is alive,
if unit ~= null then
--TODO put the teleporting code here
end
end
end

[/code]

Re: Teleport units to a special time

Posted: Sat Nov 28, 2009 11:07 am
by [Skirata]Darman[M]
Thanks, could you give me this text passage in context? I don't know if you mean I should put it after the objectives or after the camerashots at the end of the script.

Re: Teleport units to a special time

Posted: Sat Nov 28, 2009 1:31 pm
by Fiodis
Insert it in the objectives, for example, on an objective completion. Don't put them in the ScriptInit section (which is where the camera shots are).