Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Running an array to find walkplayers?
Running an array to find walkplayers?
2002-02-27, 8:34 AM #1
To this day I still don't understand arrays. But, I figured there are tons of teleporter cogs out there, and all of them require ghost positions. So I thought to myself, "Self, I bet there's a way to find all of the walkplayers on any given level." So I figured an array would work. I guess I could just copy/paste an array and then modify it, but if they could be explained, I'd be much better off. Oh, any ideas (though I have my own) for capturing walkplayers would be great!

------------------
-There are easier things in life than finding a good woman, like nailing Jello to a tree, for instance

-Tazz
-There are easier things in life than finding a good woman, like nailing Jello to a tree, for instance

Tazz
2002-02-27, 9:19 AM #2
If you youve read the tutorials on arrays, and still dont get it, I wont bother explaining them. BUT, an array would be able to find players...

For(I=0;I<=Getthingtemplatecount(JKgetlocalplayer());I=I+1) { Player_0 = I; }

That will build an 'array' if Ints,

Player_0, Player_1, Player_2, and on and on, for however many walkplayers there are in the level.

------------------
Success is the inverse relationship between effort, gain, and loss.

JK editing resources.

[This message has been edited by GBK (edited February 27, 2002).]
And when the moment is right, I'm gonna fly a kite.
2002-02-27, 9:44 AM #3
sabermaster's datamaster has a tutorial on arrays that could help, it took me a long time to understand jk arrays i wish i had that resource when i tried figuring them out
roses are red, violets are blue, I am schizophrenic, and I am too!
2002-02-27, 2:22 PM #4
GBK,

It would have to be an array of ints or can it be an array of things? Then I could just teleport the person randomly to one of the things.

------------------
-There are easier things in life than finding a good woman, like nailing Jello to a tree, for instance

-Tazz
-There are easier things in life than finding a good woman, like nailing Jello to a tree, for instance

Tazz
2002-02-27, 4:52 PM #5
A thing IS an int.

------------------
Success is the inverse relationship between effort, gain, and loss.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.
2002-02-27, 5:16 PM #6
Here's a snippet from Rbots. It searches through all 'things' in a level looking for walkplayers. It then creates ghost objects at those places. Rbots uses this to determine where to spawn bots.

Code:
// Create respawn locations from walkplayers
maxthings = GetThingCount();
maxrespawn=0;
for (index=0;index<maxthings;index=index+1)
{
  if (GetThingTemplate(index) ==walkplayer_template)
  {
    respawn00[maxrespawn]=CreateThing(ghost_template,index);
    maxrespawn=maxrespawn+1;
  }
}


Raynar


------------------
... the Jedi I admire the most, met up with Darth Maul, now he's toast ...
Rbots - a project to develop a working Bot for Jedi Knight... download the latest development version here
Pagewizard_YKS: "making your own lightsaber doesn't make you a nerd... "
Raynar - the man with a 10.75" ePenis
2002-02-27, 9:28 PM #7
Arrays in cog are not real arrays. The array index is simply the offset from the "array name" variable. For instance, if our array is:

thing Tazz
thing GBK
thing Han5678
thing Raynar

Tazz[1] is GBK. GBK[2] is Raynar.
Dreams of a dreamer from afar to a fardreamer.
2002-02-27, 11:14 PM #8
Raynar, --Mind if I swipe that code from you for a simple teleporter?

-Tazz
-There are easier things in life than finding a good woman, like nailing Jello to a tree, for instance

Tazz
2002-02-28, 5:39 AM #9
Fardreamer - thats been known for some time. But only by a few... [http://forums.massassi.net/html/frown.gif]

Snippets of a recent cog of mine:


Code:
...
 
Flex Move_easy=1.0
Flex Move_med=2.0
Flex Move_hard=4.
 
...
 
Move = Move_easy[Getdifficulty()];


A simple way to perform an operation, and simplifies the symbols section.

------------------
Success is the inverse relationship between effort, gain, and loss.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.
2002-02-28, 9:06 AM #10
Geh, I'd much rather have my Thing0 - Thing9 thank you very much. [http://forums.massassi.net/html/biggrin.gif]
-Hell Raiser
2002-02-28, 1:37 PM #11
Tazz: you are welcome to use the code for whatever you like. In fact all the Rbots code is public domain - anyone can use any of it for whatever purpose they want.

Raynar


------------------
... the Jedi I admire the most, met up with Darth Maul, now he's toast ...
Rbots - a project to develop a working Bot for Jedi Knight... download the latest development version here
Pagewizard_YKS: "making your own lightsaber doesn't make you a nerd... "
Raynar - the man with a 10.75" ePenis

↑ Up to the top!