Help with some Scripting Stuff.
Moderator: Moderators
-
Ace_Azzameen_5
- Jedi

- Posts: 1119
- Joined: Sat Apr 23, 2005 8:52 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
Help with some Scripting Stuff.
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. ..
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.
- xbox live or psn: No gamertag set
RE: Help with some Scripting Stuff.
is the animation you're talking about made in ZE, or made in XSI in .msh format?
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
but first step and question is: ZE or prop-animations we're talking about? 
-
Ace_Azzameen_5
- Jedi

- Posts: 1119
- Joined: Sat Apr 23, 2005 8:52 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
RE: Help with some Scripting Stuff.
No, it's ZE and lua scripting.
-
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"
)
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"
)
- [RDH]Zerted
- Gametoast Staff

- Posts: 2982
- Joined: Sun Feb 26, 2006 7:36 am
- Projects :: Bos Wars AI - a RTS game
- xbox live or psn: No gamertag set
- Location: USA
- Contact:
Re: Help with some Scripting Stuff.
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 wrote:...Zerted... is it possible that you could tell me how you were planning on doing a race mode?
-
Ace_Azzameen_5
- Jedi

- Posts: 1119
- Joined: Sat Apr 23, 2005 8:52 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
RE: Re: Help with some Scripting Stuff.
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. . .
- [RDH]Zerted
- Gametoast Staff

- Posts: 2982
- Joined: Sun Feb 26, 2006 7:36 am
- Projects :: Bos Wars AI - a RTS game
- xbox live or psn: No gamertag set
- Location: USA
- Contact:
RE: Re: Help with some Scripting Stuff.
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

- Posts: 1119
- Joined: Sat Apr 23, 2005 8:52 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
RE: Re: Help with some Scripting Stuff.
lol, ok Zert. Maybe someone should go on a copy paste hunt then make a DEFINITIVE RACE MODE TOPIC
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!
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.
- [RDH]Zerted
- Gametoast Staff

- Posts: 2982
- Joined: Sun Feb 26, 2006 7:36 am
- Projects :: Bos Wars AI - a RTS game
- xbox live or psn: No gamertag set
- Location: USA
- Contact:
RE: Re: Help with some Scripting Stuff.
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.
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
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?
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

- Posts: 1119
- Joined: Sat Apr 23, 2005 8:52 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
