Page 1 of 1
Help with some Scripting Stuff.
Posted: Sat Sep 23, 2006 9:37 am
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. ..
RE: Help with some Scripting Stuff.
Posted: Sat Sep 23, 2006 10:25 am
by Qdin
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?

RE: Help with some Scripting Stuff.
Posted: Sat Sep 23, 2006 11:39 am
by Ace_Azzameen_5
No, it's ZE and lua scripting.
Posted: Sat Sep 23, 2006 2:12 pm
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"
)
Re: Help with some Scripting Stuff.
Posted: Sat Sep 23, 2006 3:49 pm
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.
RE: Re: Help with some Scripting Stuff.
Posted: Sat Sep 23, 2006 4:45 pm
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. . .
RE: Re: Help with some Scripting Stuff.
Posted: Sat Sep 23, 2006 5:26 pm
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?
RE: Re: Help with some Scripting Stuff.
Posted: Sat Sep 23, 2006 5:47 pm
by Ace_Azzameen_5
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!
RE: Re: Help with some Scripting Stuff.
Posted: Sat Sep 23, 2006 6:11 pm
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.
Posted: Sat Sep 23, 2006 10:03 pm
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?
Posted: Sat Sep 23, 2006 10:20 pm
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!