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 → ships cog, with a poblem
ships cog, with a poblem
2004-01-09, 8:34 AM #1
i am makeing a coruscant level, and i amde this cog useing arrays (so simple i thoguht) but parsec tells me the lanespeed variables arent assighened, but the array thingy up top did that. also when i tested it... nothing happened. not one fo teh ships moved... i dunno whats wong..

Code:
#	JK cogscript
#	
#	PJ_coru_traffic.cog
#	
#	cotroles the differet types of 
#	traffic on the coruscant level 
#	Beta Vertion, dunno what its gonna
#	do quite yet.
#
#	??/jan/2004
#
#	[PJB]

flags=0x240 # local only cog, no sync

symbols
int	lanespeed0	local
thing	lane0ship0
thing	lane0ship1
thing	lane0ship2
thing	lane0ship3
thing	lane0ship4
thing	lane0ship5
int	lanespeed1	local
thing	lane1ship0
thing	lane1ship1
thing	lane1ship2
thing	lane1ship3
thing	lane1ship4
thing	lane1ship5
int	lanespeed2	local
thing	lane2ship0
thing	lane2ship1
thing	lane2ship2
thing	lane2ship3
thing	lane2ship4
thing	lane2ship5
int	lanespeed3	local
thing	lane3ship0
thing	lane3ship1
thing	lane3ship2
thing	lane3ship3
thing	lane3ship4
thing	lane3ship5
int	lanespeed4	local
thing	lane4ship0
thing	lane4ship1
thing	lane4ship2
thing	lane4ship3
thing	lane4ship4
thing	lane4ship5
int	lanespeed5	local
thing	lane5ship0
thing	lane5ship1
thing	lane5ship2
thing	lane5ship3
thing	lane5ship4
thing	lane5ship5
int	i=0	local
int	a=0	local
int	shipnum=6
int	lanenum=6
int	maxlanespeed=20
int	minlanespeed=10
int	framenum=3
message	startup
message	arrived
end
code
startup:
// as we are controleing three lanes of traffic over two rows
// eatch lane needs to move at a different speed,uses frame. 
for(i=0;i < lanenum; i=i+1)
{
lanespeed0=(rand()*(maxlanespeed-minlanespeed))+minlanespeed;
}

// i am gonna try and use an array here, prehaps it will 
// controle the ships like AI, prehaps not, adding key's
// is a possobillity, if i do, they will be for movement
// not the actual flying.
for(a=0;a < lanenum; a=a+2)
{
for(i=0;i < shipnum; i=i+2)
{
if(a==0){ movetoframe(lane0ship0,framenum,lanespeed0[a]); return;}
if(a==1){ movetoframe(lane1ship0,framenum,lanespeed0[a]); return;}
if(a==2){ movetoframe(lane2ship0,framenum,lanespeed0[a]); return;}
if(a==3){ movetoframe(lane3ship0,framenum,lanespeed0[a]); return;}
if(a==4){ movetoframe(lane4ship0,framenum,lanespeed0[a]); return;}
if(a==5){ movetoframe(lane5ship0,framenum,lanespeed0[a]); return;}
}
}
return;
arrived:
for(a=0;a < lanenum; a=a+2)
{
for(i=0;i < shipnum; i=i+2)
{
if(a==0)if(getsenderref()==lane0ship0)if(GetCurFrame(getsenderref())==framenum) movetoframe(getsenderref(),0,lanespeed0);
if(a==1)if(getsenderref()==lane1ship0)if(GetCurFrame(getsenderref())==framenum) movetoframe(getsenderref(),0,lanespeed1);
if(a==2)if(getsenderref()==lane2ship0)if(GetCurFrame(getsenderref())==framenum) movetoframe(getsenderref(),0,lanespeed2);
if(a==3)if(getsenderref()==lane3ship0)if(GetCurFrame(getsenderref())==framenum) movetoframe(getsenderref(),0,lanespeed3);
if(a==4)if(getsenderref()==lane4ship0)if(GetCurFrame(getsenderref())==framenum) movetoframe(getsenderref(),0,lanespeed4);
if(a==5)if(getsenderref()==lane5ship0)if(GetCurFrame(getsenderref())==framenum) movetoframe(getsenderref(),0,lanespeed5);

if(a==0)if(getsenderref()==lane0ship0)if(GetCurFrame(getsenderref())==0) movetoframe(getsenderref(),framenum,lanespeed0);
if(a==1)if(getsenderref()==lane1ship0)if(GetCurFrame(getsenderref())==0) movetoframe(getsenderref(),framenum,lanespeed1);
if(a==2)if(getsenderref()==lane2ship0)if(GetCurFrame(getsenderref())==0) movetoframe(getsenderref(),framenum,lanespeed2);
if(a==3)if(getsenderref()==lane3ship0)if(GetCurFrame(getsenderref())==0) movetoframe(getsenderref(),framenum,lanespeed3);
if(a==4)if(getsenderref()==lane4ship0)if(GetCurFrame(getsenderref())==0) movetoframe(getsenderref(),framenum,lanespeed4);
if(a==5)if(getsenderref()==lane5ship0)if(GetCurFrame(getsenderref())==0) movetoframe(getsenderref(),framenum,lanespeed5);
}
}
return;
end


------------------
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2004-01-09, 9:03 AM #2
Your arrays are screwed up. Go back and re-read the tutoral on Arrays.... [http://forums.massassi.net/html/wink.gif]

Code:
# Clone of PJB's ship cog.
#
# 01/2004 gbk

Message Startup
Message Arrived

Flex Speed0=0	Local
Flex Speed1=0	Local
Flex Speed2=0	Local
Flex Speed3=0	Local
Flex Speed4=0	Local
Flex Speed5=0	Local

Thing Lane0Ship0	LinkID=0
Thing Lane0Ship1	LinkID=0
Thing Lane0Ship2	LinkID=0
Thing Lane0Ship3	LinkID=0
Thing Lane0Ship4	LinkID=0
Thing Lane0Ship5	LinkID=0

Thing Lane1Ship0	LinkID=1
Thing Lane1Ship1	LinkID=1
Thing Lane1Ship2	LinkID=1
Thing Lane1Ship3	LinkID=1
Thing Lane1Ship4	LinkID=1
Thing Lane1Ship5	LinkID=1

Thing Lane2Ship0	LinkID=2
Thing Lane2Ship1	LinkID=2
Thing Lane2Ship2	LinkID=2
Thing Lane2Ship3	LinkID=2
Thing Lane2Ship4	LinkID=2
Thing Lane2Ship5	LinkID=2

Thing Lane3Ship0	LinkID=3
Thing Lane3Ship1	LinkID=3
Thing Lane3Ship2	LinkID=3
Thing Lane3Ship3	LinkID=3
Thing Lane3Ship4	LinkID=3
Thing Lane3Ship5	LinkID=3

Thing Lane4Ship0	LinkID=4
Thing Lane4Ship1	LinkID=4
Thing Lane4Ship2	LinkID=4
Thing Lane4Ship3	LinkID=4
Thing Lane4Ship4	LinkID=4
Thing Lane4Ship5	LinkID=4

Thing Lane5Ship0	LinkID=5
Thing Lane5Ship1	LinkID=5
Thing Lane5Ship2	LinkID=5
Thing Lane5Ship3	LinkID=5
Thing Lane5Ship4	LinkID=5
Thing Lane5Ship5	LinkID=5

Int I=0		Local

Flex MaxLaneSpeed=20
Flex MinLaneSpeed=10

int GoalFrame=3

End
Code
Startup:
	Sleep(1);

	For(I=0:I<=5;I=I+1)
	{
		Speed0=(rand() * (MaxLaneSpeed - MinLaneSpeed)) + MinLaneSpeed;
	}

	For(I=0:I<=5;I=I+1)
	{
		MoveToFrame(Lane0Ship0,GoalFrame, Speed0);
		MoveToFrame(Lane1Ship0,GoalFrame, Speed0);
		MoveToFrame(Lane2Ship0,GoalFrame, Speed0);
		MoveToFrame(Lane3Ship0,GoalFrame, Speed0);
		MoveToFrame(Lane4Ship0,GoalFrame, Speed0);
		MoveToFrame(Lane5Ship0,GoalFrame, Speed0);
	}

Stop;
Arrived:
	If(GetCurFrame(GetSenderRef()) == GoalFrame) MoveToFrame(GetSenderRef(), 0, Speed0[GetSenderID()]);
	Else If(GetCurFrame(GetSenderRed()) == 0) MoveToFrame(GetSenderRef(), GoalFrame, Speed0[GetSenderID()]);
Stop;
End


That should do the trick...

------------------
The future is here, and all bets are off.
And when the moment is right, I'm gonna fly a kite.
2004-01-09, 9:44 AM #3
All you did is reorder the things in the symbols area, right? Man, it took me freakin HOURS to figure that out. I was so pissed off, testing my cog over and over and i couldn't seem to fix it. Then i lined up my arrays in the symbols area for no real rason, and it worked. I didn't even know there was a tutorial on Arrays. I didn't think massassi had any cog tutorials.

------------------
One day, after everybody else quits, I'll be the best.
Sith Mercenaries
^My site.
One day, after everybody else quits, I'll be the best.
Sith Mercenaries
^My site.
2004-01-09, 10:30 AM #4
hmm.. if you making corrustant, your way of cog thinking is.. hmm .. wrong :/ You will get tons of cogs and you will hit thing limit soon. I maked those flyning ships with materials that scrools (ships up and down player), and .. it looks hmm cool [http://forums.massassi.net/html/smile.gif] It also can handle bigger fleet of fighters and ofcourse no limits (adjoin SICK [http://forums.massassi.net/html/wink.gif] ) Think on it.

------------------
The miners of Kiith Somtaaw sacificed much, and risked all. For their efforts they were brought into the inner most circle of Hiigaren power. Naabal, S'jet, and Sobanii bowed before them. And from that day to this, Somtaaw's children have been known to one and all as Beastslayers..
2004-01-09, 10:43 AM #5
I have two ideas, provided the ships only need to fly straight.

1) A bullet shaped like a ship. Shoot them a bunch.

2) Several bullets, each shaped like a group of ships. Shoot a few of these.

Either way you can modify the speed in a fireprojectile line.

If you needed them to curve or something, I don't know what to tell you.

------------------
Duel Zero : Released the beta. Probably the end of it. Not to worry though, I'm working on Randsaber, which is a lot better.
2004-01-09, 11:12 AM #6
Really?!? Wow! Can you please tell me where it is? I can't find it. [http://forums.massassi.net/html/confused.gif] (the arrays tutorial)

------------------
- Darth Slaw -
Confused Person

[This message has been edited by Darth Slaw (edited January 09, 2004).]
May the mass times acceleration be with you.
2004-01-10, 1:21 AM #7
i cant find any tutor on it either!

any way, after getting the cog to go through parsec (not to hard after i added the symbols section and so on) i put it in the level, added the things, set the goalframe.. and.... nothing, my ships aint moveing a inch

so, can some one no write a new cog from scratch but show me whats wong with my cog or fix my cog? (hopefully the first)why do i need my orginal or the information to fix?

well you see its a multiplayer level, and i am looking to make this rather close to the player, so you can (if you want :|) escape from the police or such by jumping about ON the traffic, much like EP2 with anakin jumping from way high up and landing on the bad girls car. and also my ships cog is using several ships conbined into one 3do, later i am going to add some keys so it can move around corners smoothly, and also i am thinking of using a nice trigger to set each of the five ships 3do's off at intervals, so basically each 3do has 5 ships, and timed perfectly they SHOULD move out in a perfect stream, when all the lanes are done i have used 25-50 3DO's and accomplished something rather cool.

(also you may not the local flags in the cog, i am planning to create a duplicate of the thing, then delete the original, as its happening locally you will then have all the ships on each players computer, and allthough with a bit of lag you might look a bit odd running about in thin air, i hope to solve that using triggers, so the ships always start at the same time on each PC but that might add a pulsing effect to the traffic, i dunno the main idea is as i believe every thing is synched, by making it local, those 25 ships will make no added lag for the player's, as a AOL user (dont even start) my ping is around 700ms on oasis, and 20,000 on a large level, by using triggers and cogs i am going to make every non actor/player 3do in my level unsynced, and so reduce the lag as much as possibly also i might rewrite the weapon cogs to be local but removed via a trigger.

so you see, i need to be able to change my cog afterwards, and... if i dotn really understand how it works. how can i add all the cool stuff?

------------------
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?

[This message has been edited by [SF]pjb (edited January 10, 2004).]

[This message has been edited by [SF]pjb (edited January 10, 2004).]
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2004-01-10, 1:24 AM #8
The arrays tutorial is in datamaster.

------------------
Team Battle.
Team Battle.
2004-01-10, 1:37 AM #9
oh, gawd, i forgot about those..

-pjb runs off for a look-

------------------
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2004-01-10, 1:50 AM #10
i dont see any errors in my arrays, yet...

------------------
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2004-01-11, 10:02 AM #11
i aint giveing up
are you?

------------------
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2004-01-11, 11:58 PM #12
Now come on you budding coggers [http://forums.massassi.net/html/smile.gif] ... here's a hint from GBK's script - with his array setup, consider the "linkid" values assigned in the "Symbols" section... [http://forums.massassi.net/html/rolleyes.gif] [http://forums.massassi.net/html/wink.gif]

Hope this gets the old cogs whirring (no pun intended [http://forums.massassi.net/html/wink.gif]) [http://forums.massassi.net/html/biggrin.gif]

-Jackpot

------------------
"lucky_jackpot is the smily god..." - gothicX

"Life is mostly froth and bubble,
But two things stand in stone,
Kindness in another's trouble,
Courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2004-01-13, 7:28 AM #13
-very blank look-

are you saying i need linkids? i never did before.

explain this

------------------
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2004-01-13, 12:54 PM #14
I'm not saying that you have to use linkids (don't use linkids if you don't want to, but you're creating more lines of code than is efficiently required - personally, I find them to be fantastic and totally invaluable! [http://forums.massassi.net/html/biggrin.gif]) - more that I was hinting at how GBK's implementation of his lane traffic cog script works... [http://forums.massassi.net/html/wink.gif] [http://forums.massassi.net/html/smile.gif]

Well here are another few points (related to GBK's implementation:
1) Array Inialisation + linkid
2) "For" loops
3) linkid used as array reference within "for" loops...

Keep the cogs whirring (pun intended this time [http://forums.massassi.net/html/rolleyes.gif] [http://forums.massassi.net/html/wink.gif] )

Hope this helps [http://forums.massassi.net/html/biggrin.gif]

-Jackpot

------------------
"lucky_jackpot is the smily god..." - gothicX

"Life is mostly froth and bubble,
But two things stand in stone,
Kindness in another's trouble,
Courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2004-01-14, 11:48 PM #15
... but GBK's cog did not work!

------------------
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2004-01-15, 1:08 PM #16
*looks at GBK... [http://forums.massassi.net/html/rolleyes.gif] - of course you did check that your code worked ... didn't you GBK !?! ... [http://forums.massassi.net/html/wink.gif]

Geez - debugging time here we go... [http://forums.massassi.net/html/redface.gif] [http://forums.massassi.net/html/rolleyes.gif]

-Jackpot

------------------
"lucky_jackpot is the smily god..." - gothicX

"Life is mostly froth and bubble,
But two things stand in stone,
Kindness in another's trouble,
Courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2004-01-20, 5:28 AM #17
-pjb is nearing the unbelivably annoyed mark-

still no action on either GBK's or my cogs, nither seems to work for me, i have tryed at least three templates so its not that, i have tryed useing linkid's in my code. its not that either... unless someone has a answer soon i am gonna get a shotgun and start blowing things up..

------------------
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2004-01-20, 1:34 PM #18
Just had a quick look at GBK's code (I was going to tackle this one over the weekend when I had time to test it with that many number of "things" in a level, when it suddenly dawned on me why GBK's code doesn't work...

It's because in the "Arrived" message on the second line, there is a spelling error [http://forums.massassi.net/html/wink.gif] - "GetSenderRed()" rather than GetSenderRef().

Give that a whirl and if there's still no luck, I'll sit down this weekend and work something out (this puzzle was bothering me as to why it wasn't working - the logic used in the script was sound enough - I just happened to overlook that typo [http://forums.massassi.net/html/wink.gif] )

Hope this helps [http://forums.massassi.net/html/biggrin.gif]

-Jackpot

------------------
"lucky_jackpot is the smily god..." - gothicX

"Life is mostly froth and bubble,
But two things stand in stone,
Kindness in another's trouble,
Courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2004-01-21, 6:52 AM #19
Quote:
<font face="Verdana, Arial" size="2">
any way, after getting the cog to go through parsec (not to hard after i added the symbols section and so on) i put it in the level, added the things, set the goalframe.. and.... nothing, my ships aint moveing a inch
</font>


i know abut teh line, it went thru parsec fine.. it wont work :@

------------------
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2004-01-22, 6:35 AM #20
Quote:
<font face="Verdana, Arial" size="2">Originally posted by Checksum:

1) A bullet shaped like a ship. Shoot them a bunch.

2) Several bullets, each shaped like a group of ships. Shoot a few of these.
</font>


Did you even read this? I scrolled over a bit, but unless you said your ships needed to curve, why are you still using things? Heck, depending on where the ships are, you could stretigically place adjoins and have the projectile bounce... assuming nothing gets in it's way.

JediKirby

------------------
"I was driving along listening to the radio, when Judas Priest comes on. It was 'You've got another thing coming.' All of a sudden, I enter 'VICE CITY RAMAGE MODE' and nearly ran some guy over"
- ]-[ellequin
ᵗʰᵉᵇˢᵍ๒ᵍᵐᵃᶥᶫ∙ᶜᵒᵐ
ᴸᶥᵛᵉ ᴼᵑ ᴬᵈᵃᵐ
2004-01-22, 11:42 AM #21
note the fact i have about 20 frames per ship, thease things are going all over the palce <_<

------------------
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2004-01-27, 4:53 AM #22
well, i made a simple frame cog and i now have to do eatch ship indvidualy, but i manged to unsync them so.. sorted :P

------------------
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?

↑ Up to the top!