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 → Objective Cogs for SP
Objective Cogs for SP
2002-01-04, 3:19 PM #1
GBK these are the Objective Cogs I need for my next segment in my levels,
1. A cog that when u kill all enimies objective is complete
2. A cog that when u pickup a certain item objective is complete
3. A cog that when u enter a certain sector The level ends THANKS!~
Cha cha cha CHIA!!
2002-01-04, 4:47 PM #2
Can Someone at ALL plz help?? Im getting frustrated!
Cha cha cha CHIA!!
2002-01-04, 4:52 PM #3
Ill post them in a few mins.


 


BTW, if you want ME to write a cog, email me. Dont post private messages on the forum.

------------------
Success is the inverse relationship between effort, gain, and loss.
And when the moment is right, I'm gonna fly a kite.
2002-01-04, 5:02 PM #4
ok, I have another question, for an SP level do u need an objective for the level to work>>??
Cha cha cha CHIA!!
2002-01-04, 5:47 PM #5
No, you dont NEED objectives for a level to work. But they do help with the reviews... [http://forums.massassi.net/html/wink.gif]


 

I thought it was kinda silly to have 3 cogs when you could have 1 to do them all. So, here ya go.

Code:
# A cog that when u kill all enimies objective is complete.
# A cog that when u pickup a certain item objective is complete.
# A cog that when u enter a certain sector The level ends.
#
#01/2002 GBK
Symbols
Message Startup
Message Killed
Message Taken
Message Entered
Thing Player				Local
Int Goal_num0=0		#Goal number for the first goal:  Kill all enemies.
Int Goal_num1=1		#Goal number for the second goal: Get certain item.
Int Goal_num2=2		#Goal number for the thrid goal:  Endgame.
Int Goal_bin0=100		#Bin values for the respective goals.
Int Goal_bin0=101		#If you have more goals inlevel,
Int Goal_bin0=102		#dont forget to update these values.
Int Goal_uni0=10100		#UNI string numbers for the message to display upon
Int Goal_uni1=10101		#completing respective goals.
Int Goal_uni2=10102		#If no message to display, put -1 in this variable.
Sound Accomplish		#Sound to play upon completing goal.
Int Ene_flag0=536871968	#Integer equivs of thingflags for enemies.  Default is 0x20000420.
Int Ene_flag1=536871968	#Can handle 3 thingflags.  If you use the default, just leave these as is.
Int Ene_flag2=536871968	#Else, convert the hex flag into int and input here.
Int Count=0				Local
Int Kills=0				Local
Thing Item_			#Item to pickup.
Sector Endgame_		#Sector to enter to end level.
Int Allow_exit=0		#Allow the endgame even if all objectives are not complete?   0 = no.
Sound Not_yet			#Sound to play if entered Endgame when not all objectived complete.
Int Not_yet_uni		#UNI string number of message to display if, (Read above comment..).
Flex End_wait=1.0		#How long to wait before ending level after entering Endgame.
Int I=0				Local
Int I2=0				Local
Int Obj=0				Local
End
Code
Startup:
Player = JKgetlocalplayer();
For(I=0;I<=Getthingcount();I=I+1) {
For(I2=0;I2<=2;I2=I2+1) {
If(Getthingflags(I) == Ene_flag0) {
Capturething(I); Count = Count + 1; } } }
For(I=0;I<=2;I=I+1) { 
Setinv(Player, Goal_bin0, 1000);
Setgoalflags(Player, I, 0x1); } Stop;
Killed: If(Getsenderref() == Player) Stop;
Kills = Kills + 1;
If(Kills == Count) {
Setgoalflags(Player, Goal_num0, 0x2);
Playsoundlocal(Accomplish, 1.0, 0.0, 0);
If(Goal_uni0 != -1) {
JKprintunistring(Player, Goal_uni0); }
Obj = Obj + 1; } Stop;
Taken: If(Getsenderref() != Item_) Stop;
Setgoalflags(Player, Goal_num1, 0x2);
Playsoundlocal(Accomplish, 1.0, 0.0, 0);
If(Goal_uni1 != -1) {
JKprintunistring(Player, Goal_uni1); }
Obj = Obj + 1; Stop;
Entered: If(Getsenderref() != Endgame) Stop;
If(Obj != 2 && Allow_exit == 0) {
Playsoundlocal(Not_yet, 1.0, 0.0, 0);
If(Not_yet_uni != -1) {
JKprintunistring(Player, Not_yet_uni); } }
Else { Setgoalflags(Player, Goal_num2, 0x2);
Playsoundlocal(Accomplish, 1.0, 0.0, 0);
If(Goal_uni2 != -1) {
JKprintunistring(Player, Goal_uni2); }
Setactorflags(Player, 0xa00000);
Stopthing(Player); Sleep(End_wait);
JKendlevel(1); } Stop;
End



 

I didnt test it, but it should work.

 

Credit me... [http://forums.massassi.net/html/biggrin.gif]

------------------
Success is the inverse relationship between effort, gain, and loss.
And when the moment is right, I'm gonna fly a kite.
2002-01-04, 5:55 PM #6
So should I have to set any of anything in the cog? (besides sound and thing numbers) or am I all set? THANKS though [http://forums.massassi.net/html/tongue.gif], Oh and my level will not LOAD [http://forums.massassi.net/html/smile.gif] god, pleaze help me GBK, Im st00pid [http://forums.massassi.net/html/frown.gif]

[This message has been edited by Chia_Pet (edited January 04, 2002).]
Cha cha cha CHIA!!
2002-01-04, 6:05 PM #7
Carefully read through the commenting in the symbols section. Most of the things that have pre-set values, you should be able to leave alone. But some things, like the UNI strings, you will customize for your level. When you set up the UNI strings, just remimber to update these variables.


I used the 'Thingflag' method for the enemies, because it would be a pain in the *ss to input all of the enemies thing numbers manually. So, simply input thier thingflags (Actully, the integer evquivelent..) into the 'Ene_flag' variables. By default, the flag is 0x20000420, but Im sure youll want to use something else. Just be sure to convert & update...


And about the 'level not loading', check your post in the Main editing forum.


------------------
Success is the inverse relationship between effort, gain, and loss.
And when the moment is right, I'm gonna fly a kite.
2002-01-04, 6:19 PM #8
uhhhhh.... :| Did I mention I was stupid?
Cha cha cha CHIA!!
2002-01-05, 2:27 PM #9
Hmm, I just realized a small bug. Dont put all 3 'Ene_flag's as the same thing. If you do, itll screw up the internal enemie count, and youll never be able to achieve that objective.

------------------
Success is the inverse relationship between effort, gain, and loss.
And when the moment is right, I'm gonna fly a kite.
2002-01-06, 9:09 AM #10
gosh im confused
Should I send you the level??
and u can work the bugs out?? its just a test level to test my skillz
Cha cha cha CHIA!!
2002-01-06, 9:37 AM #11
Sure, go ahead.

------------------
Success is the inverse relationship between effort, gain, and loss.
And when the moment is right, I'm gonna fly a kite.

↑ Up to the top!