View unanswered posts | View active topics It is currently Fri Dec 27, 2024 9:35 am



Reply to topic  [ 67 posts ]  Go to page Previous  1, 2, 3, 4, 5
 Lua trails? 
Author Message
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Lua trails?
The only problem is that globals are completely global. Any script, ANYWHERE, can access them. So if you have multiple, say, factories, and you have a global on/off variable, if someone turns one off, they're all off. The teleporters get around this with global lists, which works pretty well.


Tue Aug 18, 2009 9:19 pm
Profile
User avatar

Joined: Wed Nov 22, 2006 3:19 pm
Posts: 2073
Reply with quote
Post Re: Lua trails?
Grif wrote:
The only problem is that globals are completely global. Any script, ANYWHERE, can access them. So if you have multiple, say, factories, and you have a global on/off variable, if someone turns one off, they're all off. The teleporters get around this with global lists, which works pretty well.


So I can do some copypasta of these 'global lists' from the teleporter code to get it all working like it should?


Tue Aug 18, 2009 9:27 pm
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Lua trails?
Depending on what you want, probably?


Tue Aug 18, 2009 9:27 pm
Profile
User avatar

Joined: Wed Nov 22, 2006 3:19 pm
Posts: 2073
Reply with quote
Post Re: Lua trails?
Grif wrote:
Depending on what you want, probably?


Instead of all the complicated ♥♥♥♥ with multiple proximity checks and all that BS, i'm gonna make one proximity check on the sensor (Checking for enemy actors, and if they are found, it would set 'Trigger' to 1), and then a 'if Trigger == 1 then blah blah blah end else blah blah end' on each of the 4 laser emitters.
And i'll copypasta them 'global lists' and change some stuff to see if it works.

I'm not sure how exactly them lists work but I guess i'll be needing this on the sensor (But with different names and all)
Code:
function Create(self)
    if teleporterlista == nil then
   teleporterlista = {};
    end
    if cantele == nil then
   cantele = {};
    end
end


And this on each of the lasers (Again, with different names)
Code:
teleporterlista[#teleporterlista + 1] = self;
    self.listnum = #teleporterlista;


Am I correct?

Anyway, i'm gonna try coding it, if I somewhat succeseed, i'll bump the other topic if I need anything else... Or if I fail.
The trail case is closed, i'll add a 'self.' to the global variables and see how that works out.
Maybe with enough ♥♥♥♥ around i'll actually get the results i'm after.

Just tell me what to change to decrease distance between created particles (I need something like 5px between every particle)


Tue Aug 18, 2009 9:43 pm
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Lua trails?
dist = (self.Vel.Y/math.sin(angle)) / numparticles;

if you need it smaller try adding a / 2 at the end of all that.


Tue Aug 18, 2009 9:45 pm
Profile
User avatar

Joined: Wed Nov 22, 2006 3:19 pm
Posts: 2073
Reply with quote
Post Re: Lua trails?
Grif wrote:
dist = (self.Vel.Y/math.sin(angle)) / numparticles;

if you need it smaller try adding a / 2 at the end of all that.


Ok, shouldn't be a problem.
Thanks. :D


Tue Aug 18, 2009 9:57 pm
Profile
User avatar

Joined: Fri May 11, 2007 4:30 pm
Posts: 1040
Location: England
Reply with quote
Post Re: Lua trails?
no all that will do is cramp them all together towards one end (so it will kind of look like it pulsates) increase the number of particles if you want more of them and closely spaced together. (numparticles in the create script was created for the sole purpose of easy editing)...

...so maxim did you add "self." to all the variables and does it now work properly?

grif I never said they were linked lists... I was talking about objects local handling of scripts... and the objects are presumably handled via linked lists, and presumably have a pointer to a script file. However the lua script engine/parser is embedded into the core of the game engine and I was foolishly only thinking about the scripts (which if interpreted by the C++ parser would essentially then be local), but they actually get parsed by the embedded lua parser which will be able to treat them globally... now you understand my reasoning behind my thinking?


Tue Aug 18, 2009 10:44 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 67 posts ]  Go to page Previous  1, 2, 3, 4, 5

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.052s | 14 Queries | GZIP : Off ]