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 → this cog does what I want it to, but...
this cog does what I want it to, but...
2002-03-01, 7:08 AM #1
is there a way to make it more efficient?

# Jedi Knight Cog Script
#
# selectgen.COG
#
# in this cog the player flip's through the cels of a mat till they find the enemy they want to fight
# then they press a different switch to generate that enemy
#
# Matthew P. Grimshaw aka PPCThug@yahoo.com
#
# This Cog is Not supported by LucasArts Entertainment Co

symbols

surface switch0
surface switch1
message activated
sound wav0
sound wav1
material select07a
material select07b
thing ghost0
thing ghost1
thing ghost2
thing ghost3

template target0
template target1
template target2
template target3
template target4
template target5
template target6
template target7
template target8
template target9
template target10
template target11
template target12
template target13
template target14
template target15
template target16
template target17
template target18
template target19
template target20
template target21
template target22
template target23
template target24
template target25
template target26
template target27
template target28
template target29


end

# ========================================================================================

code
activated:
if ( GetSenderRef() == switch0 )
{
if ( GetWallCel(switch0) == 14)
{
if ( GetSurfaceMat(switch0) == select07a)
{
SetSurfaceMat(switch0, select07b);
SetWallCel(switch0, 0);
PlaySoundPos(wav0, GetSurfaceCenter(switch0), 0.5, -1, -1, 0);
return;
}
else if (GetSurfaceMat(switch0) == select07b)
{
SetSurfaceMat(switch0, select07a);
SetWallCel(switch0, 0);
PlaySoundPos(wav0, GetSurfaceCenter(switch0), 0.5, -1, -1, 0);
return;
}
else
{
return;
}

}
SetWallCel(switch0, GetWallCel(switch0) + 1 );
PlaySoundPos(wav0, SurfaceCenter(switch0), 0.5, -1, -1, 0);
return;
}

else if ( GetSenderRef() == switch1)
{
if ( GetWallCel(switch1) == 1) return;
SetWallCel(switch1, 1);
PlaySoundPos(wav1, SurfaceCenter(switch1), 0.5, -1, -1, 0);

if ( GetSurfaceMat(switch0) == select07a)
{

if ( GetWallCel(switch0) == 0)
{
CreateThing(target0, ghost0);
CreateThing(target0, ghost1);
CreateThing(target0, ghost2);
CreateThing(target0, ghost3);
}

else if ( GetWallCel(switch0) == 1)
{
CreateThing(target1, ghost0);
CreateThing(target1, ghost1);
CreateThing(target1, ghost2);
CreateThing(target1, ghost3);

}

else if ( GetWallCel(switch0) == 2)
{
CreateThing(target2, ghost0);
CreateThing(target2, ghost1);
CreateThing(target2, ghost2);
CreateThing(target2, ghost3);

}

else if ( GetWallCel(switch0) == 3)
{
CreateThing(target3, ghost0) ;
CreateThing(target3, ghost1);
CreateThing(target3, ghost2);
CreateThing(target3, ghost3);

}

else if ( GetWallCel(switch0) == 4)
{
CreateThing(target4, ghost0) ;
CreateThing(target4, ghost1);
CreateThing(target4, ghost2);
CreateThing(target4, ghost3);

}

else if ( GetWallCel(switch0) == 5)
{
CreateThing(target5, ghost0) ;
CreateThing(target5, ghost1);
CreateThing(target5, ghost2);
CreateThing(target5, ghost3);

}

else if ( GetWallCel(switch0) == 6)
{
CreateThing(target6, ghost0) ;
CreateThing(target6, ghost1);
CreateThing(target6, ghost2);
CreateThing(target6, ghost3);

}

else if ( GetWallCel(switch0) == 7)
{
CreateThing(target7, ghost0) ;
CreateThing(target7, ghost1);
CreateThing(target7, ghost2);
CreateThing(target7, ghost3);

}

else if ( GetWallCel(switch0) == 8)
{
CreateThing(target8, ghost0) ;
CreateThing(target8, ghost1);
CreateThing(target8, ghost2);
CreateThing(target8, ghost3);

}

else if ( GetWallCel(switch0) == 9)
{
CreateThing(target9, ghost0) ;
CreateThing(target9, ghost1);
CreateThing(target9, ghost2);
CreateThing(target9, ghost3);

}

else if ( GetWallCel(switch0) == 10)
{
CreateThing(target10, ghost0) ;
CreateThing(target10, ghost1);
CreateThing(target10, ghost2);
CreateThing(target10, ghost3);

}

else if ( GetWallCel(switch0) == 11)
{
CreateThing(target11, ghost0) ;
CreateThing(target11, ghost1);
CreateThing(target11, ghost2);
CreateThing(target11, ghost3);

}

else if ( GetWallCel(switch0) == 12)
{
CreateThing(target12, ghost0) ;
CreateThing(target12, ghost1);
CreateThing(target12, ghost2);
CreateThing(target12, ghost3);

}

else if ( GetWallCel(switch0) == 13)
{
CreateThing(target13, ghost0) ;
CreateThing(target13, ghost1);
CreateThing(target13, ghost2);
CreateThing(target13, ghost3);

}

else if ( GetWallCel(switch0) == 14)
{
CreateThing(target14, ghost0) ;
CreateThing(target14, ghost1);
CreateThing(target14, ghost2);
CreateThing(target14, ghost3);

}

}

else if ( GetSurfaceMat(switch0) == select07b)
{

if ( GetWallCel(switch0) == 0)
{
CreateThing(target15, ghost0) ;
CreateThing(target15, ghost1);
CreateThing(target15, ghost2);
CreateThing(target15, ghost3);
}

else if ( GetWallCel(switch0) == 1)
{
CreateThing(target16, ghost0) ;
CreateThing(target16, ghost1);
CreateThing(target16, ghost2);
CreateThing(target16, ghost3);

}

else if ( GetWallCel(switch0) == 2)
{
CreateThing(target17, ghost0) ;
CreateThing(target17, ghost1);
CreateThing(target17, ghost2);
CreateThing(target17, ghost3);

}

else if ( GetWallCel(switch0) == 3)
{
CreateThing(target18, ghost0) ;
CreateThing(target18, ghost1);
CreateThing(target18, ghost2);
CreateThing(target18, ghost3);

}

else if ( GetWallCel(switch0) == 4)
{
CreateThing(target19, ghost0) ;
CreateThing(target19, ghost1);
CreateThing(target19, ghost2);
CreateThing(target19, ghost3);

}

else if ( GetWallCel(switch0) == 5)
{
CreateThing(target20, ghost0) ;
CreateThing(target20, ghost1);
CreateThing(target20, ghost2);
CreateThing(target20, ghost3);

}

else if ( GetWallCel(switch0) == 6)
{
CreateThing(target21, ghost0) ;
CreateThing(target21, ghost1);
CreateThing(target21, ghost2);
CreateThing(target21, ghost3);

}

else if ( GetWallCel(switch0) == 7)
{
CreateThing(target22, ghost0) ;
CreateThing(target22, ghost1);
CreateThing(target22, ghost2);
CreateThing(target22, ghost3);

}

else if ( GetWallCel(switch0) == 8)
{
CreateThing(target23, ghost0) ;
CreateThing(target23, ghost1);
CreateThing(target23, ghost2);
CreateThing(target23, ghost3);

}

else if ( GetWallCel(switch0) == 9)
{
CreateThing(target24, ghost0) ;
CreateThing(target24, ghost1);
CreateThing(target24, ghost2);
CreateThing(target24, ghost3);

}

else if ( GetWallCel(switch0) == 10)
{
CreateThing(target25, ghost0) ;
CreateThing(target25, ghost1);
CreateThing(target25, ghost2);
CreateThing(target25, ghost3);

}

else if ( GetWallCel(switch0) == 11)
{
CreateThing(target26, ghost0) ;
CreateThing(target26, ghost1);
CreateThing(target26, ghost2);
CreateThing(target26, ghost3);

}

else if ( GetWallCel(switch0) == 12)
{
CreateThing(target27, ghost0) ;
CreateThing(target27, ghost1);
CreateThing(target27, ghost2);
CreateThing(target27, ghost3);

}

else if ( GetWallCel(switch0) == 13)
{
CreateThing(target28, ghost0) ;
CreateThing(target28, ghost1);
CreateThing(target28, ghost2);
CreateThing(target28, ghost3);

}

else if ( GetWallCel(switch0) == 14)
{
CreateThing(target29, ghost0) ;
CreateThing(target29, ghost1);
CreateThing(target29, ghost2);
CreateThing(target29, ghost3);

}

}
else
{
return;
}

Sleep(.5);
SetWallCel(switch1, 0);
return;
}
else return;

# ........................................................................................

end



------------------

I lost a mine! do you have it?(BOOM!)
I droped a trip mine around here, could you help me look for it?
2002-03-01, 8:21 AM #2
USE ARRAYS FOR PETES SAKE!!

 

Oh, right. That whole "no arrays in cog" thing. Sorry. There isnt anything you can do to improve that cog.


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

JK editing resources.

[This message has been edited by GBK (edited March 01, 2002).]
And when the moment is right, I'm gonna fly a kite.
2002-03-01, 10:13 AM #3
I know what C language arrays are but until recently I'd never heard of cog arrays.

------------------

I lost a mine! do you have it?(BOOM!)
I droped a trip mine around here, could you help me look for it?
2002-03-01, 10:43 AM #4
I was being sarecastic. Arrays in JK are actully quite easy to impliment. SM's 'Datamaster' has a good array tutorial.

------------------
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-03-01, 12:58 PM #5
but remember GBK jon C says "NO to arrays!!!"
roses are red, violets are blue, I am schizophrenic, and I am too!
2002-03-01, 1:05 PM #6
It's stupid to use arrays for 2-3 things; in a situation like this, however, they're very useful.
2002-03-01, 1:43 PM #7
Quote:
<font face="Verdana, Arial" size="2">Originally posted by GBK:
I was being sarecastic. Arrays in JK are actully quite easy to impliment. SM's 'Datamaster' has a good array tutorial.

</font>


I looked in the tut section on massassi and I didn't see a Datamaster tut, is it some where else or did I mis it?

------------------

I lost a mine! do you have it?(BOOM!)
I droped a trip mine around here, could you help me look for it?
2002-03-01, 1:47 PM #8
Click me.

------------------
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-03-01, 1:56 PM #9
Quote:
<font face="Verdana, Arial" size="2">Originally posted by Jipe:
It's stupid to use arrays for 2-3 things...</font>


Are you calling me stupid? [http://forums.massassi.net/html/mad.gif]

------------------
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-03-01, 3:59 PM #10
this seems to work...

# Jedi Knight Cog Script
#
# selectgen.COG
#
# in this cog the player flip's through the cels of a mat till they find the enemy they want to fight
# then they press a different switch to generate that enemy
#
# Matthew P. Grimshaw aka PPCThug@yahoo.com
#
# This Cog is Not supported by LucasArts Entertainment Co

symbols

surface switch0
surface switch1
message activated
sound wav0=bcchargeup.wav
sound wav1=activate02.wav
material select07a
material select07b
thing ghost0
thing ghost1
thing ghost2
thing ghost3

int celnumber

template target0=atatpilot
template target1=atst_newdrvr
template target2=bossk
template target3=darkundead
template target4=gammorean
template target5=greedo
template target6=icommando
template target7=iofficer
template target8=ithorian
template target9=mynok
template target10=noghri
template target11=pirateped1
template target12=pirateraider3
template target13=preeyees
template target14=preeyeesgun
template target15=rancor
template target16=rcommando
template target17=rofficer
template target18=scouttrooper
template target19=statue0
template target20=statue1
template target21=stormtroop4_m
template target22=tiepilot_m
template target23=tuskan
template target24=vornskr
template target25=wampaswamp
template target26=weequay
template target27=assassindroid
template target28=probedroid
template target29=torturedroid


end

# ========================================================================================

code
activated:
if ( GetSenderRef() == switch0 )
{
if ( GetWallCel(switch0) == 14)
{
if ( GetSurfaceMat(switch0) == select07a)
{
SetSurfaceMat(switch0, select07b);
SetWallCel(switch0, 0);
PlaySoundPos(wav0, GetSurfaceCenter(switch0), 0.5, -1, -1, 0);
return;
}
else if (GetSurfaceMat(switch0) == select07b)
{
SetSurfaceMat(switch0, select07a);
SetWallCel(switch0, 0);
PlaySoundPos(wav0, GetSurfaceCenter(switch0), 0.5, -1, -1, 0);
return;
}
else
{
return;
}

}
SetWallCel(switch0, GetWallCel(switch0) + 1 );
PlaySoundPos(wav0, SurfaceCenter(switch0), 0.5, -1, -1, 0);
return;
}

else if ( GetSenderRef() == switch1)
{
if ( GetWallCel(switch1) == 1) return;
SetWallCel(switch1, 1);
PlaySoundPos(wav1, SurfaceCenter(switch1), 0.5, -1, -1, 0);

if ( GetSurfaceMat(switch0) == select07a)
{

celnumber = GetWallCel(switch0);
CreateThing(target0[0+celnumber], ghost0);
CreateThing(target0[0+celnumber], ghost1);
CreateThing(target0[0+celnumber], ghost2);
CreateThing(target0[0+celnumber], ghost3);


}

else if ( GetSurfaceMat(switch0) == select07b)
{

celnumber = GetWallCel(switch0);
CreateThing(target0[15+celnumber], ghost0);
CreateThing(target0[15+celnumber], ghost1);
CreateThing(target0[15+celnumber], ghost2);
CreateThing(target0[15+celnumber], ghost3);


}
else
{
return;
}

Sleep(.5);
SetWallCel(switch1, 0);
return;
}
else return;

# ........................................................................................

end




------------------

I lost a mine! do you have it?(BOOM!)
I droped a trip mine around here, could you help me look for it?

↑ Up to the top!