Data Realms Fan Forums
http://forums.datarealms.com/

Cortex Command Lua Scripting Tutorial
http://forums.datarealms.com/viewtopic.php?f=73&t=17955
Page 3 of 3

Author:  adwuga [ Tue Apr 26, 2011 10:09 pm ]
Post subject:  Re: Cortex Command Lua Scripting Tutorial

I haven't tried it yet but that's probably it. Strangely enough there were no console errors. Thanks for all the help.

EDIT: It worked thanks, but is there any way to disable a teleporter until self.Killcomplete = true? If you kill the brain before killing all the humans then the game freezes.

Author:  Abdul Alhazred [ Wed Apr 27, 2011 9:08 am ]
Post subject:  Re: Cortex Command Lua Scripting Tutorial

The game wasn't really made to be played without a brain, so it does not make much sense to have to kill all units controlled by a brain before being able to kill the brain. But I guess you could hide the real brain and then make a fake brain that is the target.

If you want to disable teleporters I think you must implement them in the activity script. Define areas with the area editor and if self.Killcomplete is true check if any actor is inside that area with the IsInside function (self.MyArea1:IsInside(Act.Pos)) and just move it to the destination (Act.Pos = self.MyArea2:GetCenterPoint()).

Author:  adwuga [ Wed Apr 27, 2011 12:57 pm ]
Post subject:  Re: Cortex Command Lua Scripting Tutorial

Abdul Alhazred wrote:
The game wasn't really made to be played without a brain, so it does not make much sense to have to kill all units controlled by a brain before being able to kill the brain.

The story of my level is that you are an old abandoned experiment left running, and the coalition was your scripted target, so your goal is to kill everyone. I'll Try the Teleporter, but it might be confusing. maybe I could make a fake objective there and then say "Its a trap!."

Author:  Joesycop [ Thu Aug 25, 2011 3:17 pm ]
Post subject:  Re: Cortex Command Lua Scripting Tutorial

I read this whole thing once, Going to read it a 2nd time soon but so far I understand literally nothing. It explains what each thing does pretty well but even seeing the examples I have no clue how I would set the stuff up for what I wanted to try...

Author:  Friendofafriend [ Mon Dec 26, 2011 11:22 am ]
Post subject:  Re: Cortex Command Lua Scripting Tutorial

Ok so i downloaded a template for a rocket launcher, then tried to connect its Emitter to the Lua code, but when the loader gets to
"Index on line 8 includes:
Rocket Launcher.ini on line 1"

Cortex command stops working, and suggestions?

Author:  Sly-UX1XN [ Wed Jan 25, 2012 10:18 pm ]
Post subject:  Re: Cortex Command Lua Scripting Tutorial

I dont understand the bit about the two types of variable global and local (I thought you already told us the types E.g. vectors ''text'' boolean ect.) and I also do not understand your explanation on global and local it has confused me to the depths of my mind and has nearly caused me to go insane from reading those two paragraphs OVER AND OVER :roll:

Author:  Asklar [ Wed Jan 25, 2012 10:29 pm ]
Post subject:  Re: Cortex Command Lua Scripting Tutorial

A global variable is one that can be read from any script, a local variable can only be read in the script it was created.
So, let's suppose I've got script "A.lua" and script "B.lua".

In script A I create the local variable X, which is a boolean (true or false) set to true.
In script B, I have an if that goes "if X == true then".

The if in B won't work because the X variable in A is a local variable and will only work for the script A.

Author:  Sly-UX1XN [ Wed Jan 25, 2012 10:36 pm ]
Post subject:  Re: Cortex Command Lua Scripting Tutorial

thank you asklar :grin: can you explain pointers and why you should use them?

Author:  Asklar [ Wed Jan 25, 2012 10:51 pm ]
Post subject:  Re: Cortex Command Lua Scripting Tutorial

This is what I understand, and it's probably not a 100% accurate.

When you store an object (Any MO in Cortex Command, from MOPixels to Actors or Items) in a variable, that variable is the pointer of said object.

The most easy example is self.

When you attach a script to a MO, the variable "self" has stored the MO which has the script attached. For example, if you attach a script that doubles the mass of a MOPixel, the variable "self" would refer to said MOPixel.

Now, when you have a pointer you can access it's properties by using a period (.) and then the name of the proprety. For example, if you want to double the mass of a MOPixel, you would first have to get into the mass of the MOPixel with self.Mass (Mass is a property of the MOPixel, and the MOPixel is stored in the pointer "self").

Author:  Sly-UX1XN [ Wed Jan 25, 2012 11:09 pm ]
Post subject:  Re: Cortex Command Lua Scripting Tutorial

That has shed a little light tommorow asklar will you have time for a basic lesson on things just sum things up shortly *to not waste your time*....? please say no if you have no time because I have a very long time and am patient.

Author:  Asklar [ Wed Jan 25, 2012 11:12 pm ]
Post subject:  Re: Cortex Command Lua Scripting Tutorial

Me too.

Well, tomorrow is some sort of "free day" for me, because even though I'm on holidays, I'm still studying.

And we can continue in this thread.

Author:  Sly-UX1XN [ Wed Jan 25, 2012 11:22 pm ]
Post subject:  Re: Cortex Command Lua Scripting Tutorial

Sadly it is.., however embarrasing, inevitably my bed time. :(

Author:  Stipe [ Wed Feb 01, 2012 10:13 am ]
Post subject:  Re: Cortex Command Lua Scripting Tutorial

Too complicated for me, I am only 14 :/

Author:  Sly-UX1XN [ Thu Feb 02, 2012 6:31 pm ]
Post subject:  Re: Cortex Command Lua Scripting Tutorial

Haha non :')

Page 3 of 3 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/