Help with some Scripting Stuff.

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
Ace_Azzameen_5
Jedi
Jedi
Posts: 1119
Joined: Sat Apr 23, 2005 8:52 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Help with some Scripting Stuff.

Post by Ace_Azzameen_5 »

Well, I got fed up a while ago with trying to guess the proper syntax of some script stuff in my map and gave up. Now, I'm willing to be spoon fed th answers. So, could someone please type and donate me a block of code that can detect the destruction of two destroyable cps and do something when they are both dead?

More specidically, just post it with "CP1NAME' and a "CP2NAme" for me to replace and a "PUT FUNCTIONS HERE" outling where to put all my respawn obj's etc?

Without this victory dector to trigger the next series of events, I lost all motivation to finish my campaign mode.

Thanks ahead of time. Oh, and if you could throw in a bit of code that will play an animation on a region entrance by a playercharacter, that would be great to. Also, Zerted, if you're reading this, is it possible that you could tell me how you were planning on doing a race mode?

This is all for my map that was temprarily release here]

Credit will be given where credit is due. Jeez, I might erect a monument in
you're honours and hide it somewhere. ..
Qdin
Old School Staff
Posts: 2059
Joined: Wed Feb 23, 2005 9:54 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

RE: Help with some Scripting Stuff.

Post by Qdin »

is the animation you're talking about made in ZE, or made in XSI in .msh format? :P like a prop-animation triggered when entering a region; remidns me of the trapdoor in Jabba's. but don't use that as refference: Fred told me it was a way to cheat the engine, and isn't the most trusted way :roll: but first step and question is: ZE or prop-animations we're talking about? :D
Ace_Azzameen_5
Jedi
Jedi
Posts: 1119
Joined: Sat Apr 23, 2005 8:52 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

RE: Help with some Scripting Stuff.

Post by Ace_Azzameen_5 »

No, it's ZE and lua scripting.
Big_rich

Post by Big_rich »

First you need to give your cp's a name in ZE: Like CP1_Name, CP2_Name,

then you'd use this block of code:

OnObjectKillName(function1, "CP1_Name");
OnObjectKillName(function2, "CP2_Name");
KillObject("NameOfObject")

then go onto setting up what happens when the CP gets destroyed:

Example:
--In this exapmle when it performs function (function1), i.e. when the CP1_name object gets destroyed it will spawn another object.

function function1()
RespawnObject("NameOfObject")
end

--this will work if you want the position of the spawned object to stay the same. Cause you will kill the object when the level first starts, then respawn once the CP1_Name object gets destroyed.



Work for you?

Regions are here:
--Turn on the region
ActivateRegion("NameOfRegion")

--Then You need to use the region

region1 = OnEnterRegion(
function(region, player)
if IsCharacterHuman(player) then

PauseAnimation("NameOfAnimation")
RewindAnimation("NameOfAnimation")
PlayAnimation("NameOfAnimation")
end
end,
"NameOfRegion"
)
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: Help with some Scripting Stuff.

Post by [RDH]Zerted »

Ace_Azzameen_5 wrote:...Zerted... is it possible that you could tell me how you were planning on doing a race mode?
No, because I'm not really sure at the moment. The requirments where listed once somewhere but I haven't found them yet. I think the CPs will be like checkpoints. You move along in vehicles and/or by running.
Ace_Azzameen_5
Jedi
Jedi
Posts: 1119
Joined: Sat Apr 23, 2005 8:52 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

RE: Re: Help with some Scripting Stuff.

Post by Ace_Azzameen_5 »

What about finish line regions that deactivate when there passed over? And give victory to one playeR? You said that you could switch players to a new team once they spawned. CAn teams over 2 be awarded victory? just sayin. Will test out you're code later, BIg_Rich. Thanks. Hmmm, oh yeah, the statue will probably be a lego poster with the creditees names. . .maybe some temple props. . .secret entrance blocked by destroyables, you get the idea. . .
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: Re: Help with some Scripting Stuff.

Post by [RDH]Zerted »

There are already a few topics (4-5) about the Racing mode. Can we please just pick one and put all the information in there?
Ace_Azzameen_5
Jedi
Jedi
Posts: 1119
Joined: Sat Apr 23, 2005 8:52 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

RE: Re: Help with some Scripting Stuff.

Post by Ace_Azzameen_5 »

lol, ok Zert. Maybe someone should go on a copy paste hunt then make a DEFINITIVE RACE MODE TOPIC :P
Rich, I set it up like this, but that causes function 2 when either one of the cp's get destroyed, not when both are dead.

OnObjectKillName(function2, "mtttur");
OnObjectKillName(function2, "mtttur1");

function function2()
RespawnObject("cp6cam")
RespawnObject("cp7cam")
RespawnObject("cp4cam")
KillObject("cp2cam")
end

TFTH, Ace.

P.S. That boulder crushing is gonna kick Diet Dr. Pepper in race mode. Now for sound/rumble regions!
Last edited by Ace_Azzameen_5 on Sat Sep 23, 2006 6:40 pm, edited 1 time in total.
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: Re: Help with some Scripting Stuff.

Post by [RDH]Zerted »

You need to add a check somewhere. When a mtttur is destroyed, change a variable (lets say isAtLeastOneMtturDestroyed) to true (or to whatever you want to set it as).

In the functions add something like: if isAtLeastOneMtturDestroyed is true then respawn the objects. If it is not true, then set isAtLeastOneMtturDestroyed to true.
Big_rich

Post by Big_rich »

Let me get you the thread topic on how to create rumble regions:

http://www.gametoast.com/index.php?name ... le+regions



OnObjectKillName(function2, "mtttur");
OnObjectKillName(function2, "mtttur1");

function function2()
if mtt == 2 then
RespawnObject("cp6cam")
RespawnObject("cp7cam")
RespawnObject("cp4cam")
KillObject("cp2cam")
else
mtt = 2
end
end

I think this is what zerted means?
Ace_Azzameen_5
Jedi
Jedi
Posts: 1119
Joined: Sat Apr 23, 2005 8:52 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Post by Ace_Azzameen_5 »

Ah, so the destruction of the MTT's needs to switch a variable so that when the second one goes, the REp is able to continue on it's rampage. Will Try.

Edit: I formatted the Events like OntimerElapses, since thjey didn't seem to be working as they were. THe Trigger now works. Thanks!
Post Reply