Teleport units to a special time

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
[Skirata]Darman[M]
Rebel Sergeant
Rebel Sergeant
Posts: 190
Joined: Mon Aug 10, 2009 8:47 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Imperial Center, Coruscant
Contact:

Teleport units to a special time

Post 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.
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Re: Teleport units to a special time

Post 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.
User avatar
[Skirata]Darman[M]
Rebel Sergeant
Rebel Sergeant
Posts: 190
Joined: Mon Aug 10, 2009 8:47 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Imperial Center, Coruscant
Contact:

Re: Teleport units to a special time

Post 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. :? :? :?
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: Teleport units to a special time

Post 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]
User avatar
[Skirata]Darman[M]
Rebel Sergeant
Rebel Sergeant
Posts: 190
Joined: Mon Aug 10, 2009 8:47 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Imperial Center, Coruscant
Contact:

Re: Teleport units to a special time

Post 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.
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Re: Teleport units to a special time

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