PDA

View Full Version : I have tried, but just can't get it! -cog needed



Brad S
10-04-2003, 02:58 PM
like i said, i have tried writing one, but i can't get it..
i need a cog that will display random sprites at random locations(ghost)
can this be done? if so, could someone PLEASE help me out here?

------------------
"Everyone Dies..."
-Fett

My Website (http://24.45.190.154:81/brad_s/)
Brad's Highschool Level (http://24.45.190.154:81/brad_s/highschool.htm)
Unfinished Levels For Download (http://24.45.190.154:81/brad_s/incompletelevels.htm)

gbk
10-04-2003, 04:14 PM
*cracks knuckles*



# "a cog that will display random sprites at random locations(ghost)"
#
# 10/2003 gbk - gbk@insightbb.com
Symbols
Message Startup
Message Pulse
Message Timer

Thing Ghost0=-1 #If a ghost is unused, make SURE
Thing Ghost1=-1 #it is set to -1.
Thing Ghost2=-1
Thing Ghost3=-1
Thing Ghost4=-1
Thing Ghost5=-1
Thing Ghost6=-1
Thing Ghost7=-1
Thing Ghost8=-1
Thing Ghost9=-1

Template Type0 #If templates go unused, just fill the rest with the same one.
Template Type1
Template Type2
Template Type3
Template Type4
Template Type5
Template Type6
Template Type7
Template Type8
Template Type9

Flex Rate #How often, in seconds, a new sprite is created.
Flex Halflife=1 #How long the sprite will live. Set to -1 to disable.

Int d=-1 Local
Int r0=0 Local
Int r1=0 Local

End
Code
Startup:
Sleep(1);
Setpulse(Rate);
Stop;

Pulse:
r0 = Rand()*10;
r1 = Rand()*10;
While(r0 == 1) r0 = Rand()*10;
While(r1 == 1) r1 = Rand()*10;
While(Ghost0[r0] == -1) r0 = Rand()*10;
d = Creatething(Type0[r1], Ghost0[r0]);
If(d == -1) Print("Sprite creation failure.");
If(Halflife != -1 && d != -1) Settimerex(Halflife, 6535, d, 0);
Stop;

Timer:
If(Getthingsignature(Getparam(0)) != -1) Destroything(Getparam(0));
Stop;
End



It *should* work. I didnt test it. Didnt see the point, really.


Oh, and, do be more descriptive the next time you request a cog. I almost didnt write this one because your request is, shall we say, a bit vague.

------------------
Back in Black...

Brad S
10-04-2003, 04:28 PM
thnks sorry http://forums.massassi.net/html/smile.gif

------------------
"Everyone Dies..."
-Fett

My Website (http://24.45.190.154:81/brad_s/)
Brad's Highschool Level (http://24.45.190.154:81/brad_s/highschool.htm)
Unfinished Levels For Download (http://24.45.190.154:81/brad_s/incompletelevels.htm)

Brad S
10-04-2003, 04:47 PM
hmm not working.. i set everything up correctly, but no sprites show.. i know the sprites work cuz i used them with a cog that just repeats them over and over
http://67.87.115.203:81/brad_s/warehouse_ex.jpg
see!
well thnks for writing it, i appreciated it, but if you could fix it, it would be sweet

------------------
"Everyone Dies..."
-Fett

My Website (http://24.45.190.154:81/brad_s/)
Brad's Highschool Level (http://24.45.190.154:81/brad_s/highschool.htm)
Unfinished Levels For Download (http://24.45.190.154:81/brad_s/incompletelevels.htm)

Brad S
10-04-2003, 04:58 PM
well, i just thought of a problem.. i dont know how to fix it...
it may be that you have to list the mats that are used to animate the sprite?

------------------
"Everyone Dies..."
-Fett

My Website (http://24.45.190.154:81/brad_s/)
Brad's Highschool Level (http://24.45.190.154:81/brad_s/highschool.htm)
Unfinished Levels For Download (http://24.45.190.154:81/brad_s/incompletelevels.htm)

gbk
10-04-2003, 06:20 PM
The cog works fine for me. Check your implementation.

------------------
Back in Black...

Brad S
10-06-2003, 04:20 PM
I checked implementation.. it still dont work.. could it be im using animated mats for sprites?

------------------
"Everyone Dies..."
-Fett

My Website (http://24.45.190.154:81/brad_s/)
Brad's Highschool Level (http://24.45.190.154:81/brad_s/highschool.htm)
Unfinished Levels For Download (http://24.45.190.154:81/brad_s/incompletelevels.htm)

gbk
10-06-2003, 08:25 PM
Mats? Lol. No, you need real sprites - objects, things. Just mats wont do the trick.

------------------
Back in Black...

Brad S
10-06-2003, 08:39 PM
No, no, i know. filename.spr contains the info, you put the name of the animated mat in there. I discovered that you can only use sprites with about 14 frames or less.. bigger ones just dont work. bummer :P


------------------
"Everyone Dies..."
-Fett

My Website (http://24.45.190.154:81/brad_s/)
Brad's Highschool Level (http://24.45.190.154:81/brad_s/highschool.htm)
Unfinished Levels For Download (http://24.45.190.154:81/brad_s/incompletelevels.htm)

gbk
10-06-2003, 10:05 PM
I thought the limit was 16 cels. http://forums.massassi.net/html/confused.gif


But is it working, yes?

------------------
Back in Black...

Edward
10-07-2003, 12:16 AM
<font face="Verdana, Arial" size="2">Originally posted by Brad S:
No, no, i know. filename.spr contains the info, you put the name of the animated mat in there. I discovered that you can only use sprites with about 14 frames or less.. bigger ones just dont work. bummer :P


</font>

Say, when you added something to Template Type1, did you add a spr file there? *shaking head* In the JED's COG placement window, double click in the blank space next to the Template and select something with a + infront of it. Explotions have exp in them, so mask after "+*exp". Sparking particles have other stuff. Click around a try out stuff.

Brad S
10-07-2003, 04:50 AM
Listen, im pretty sure i did everything right, look:

<font face="Verdana, Arial" size="2">
#material type width height geo light tex extralight xoff yoff zoff
explosiontest.mat 0 2.0 2.0 4 0 0 0.0 0.0 0.0 0.0

</font>

and in the master.tpl:

<font face="Verdana, Arial" size="2">
# DESC:
# BBOX: 0 0 0 0 0 0
+explosiontest3 none orient=(0.000000/0.000000/0.000000) type=cog move=physics thingflags=0x10000000 sprite=explosiontest3.spr mass=0.050000 physflags=0x200 vel=(0.000000/0.000000/0.000000)
</font>

these sprites work with another cog, but not with this one, thats what im saying

------------------
"Everyone Dies..."
-Fett

My Website (http://24.45.190.154:81/brad_s/)
Brad's Highschool Level (http://24.45.190.154:81/brad_s/highschool.htm)
Unfinished Levels For Download (http://24.45.190.154:81/brad_s/incompletelevels.htm)

Edward
10-07-2003, 05:40 AM
Oh, sorry. When I read it once, I thought you were... noob... and thought that when you add a spr file to template, you'll get a spr file.

OK. I don't see any problems in GBK's code. So I'll make a new one:


# Create random at random.
#
# By Edward
symbols

message startup
message pulse

thing ghost0
thing ghost1
thing ghost2
thing ghost3
thing ghost4
thing ghost5
thing ghost6
thing ghost7
thing ghost8
thing ghost9
thing ghost10
thing ghost11
thing ghost12
thing ghost13
thing ghost14
thing ghost15

template boom0
template boom1
template boom2
template boom3
template boom4
template boom5
template boom6
template boom7
template boom8
template boom9
template boom10
template boom11
template boom12
template boom13
template boom14
template boom15
# Feel free to take away a few.
int ghosts_in_use=15
int booms_in_use=15

int i local

flex delay_between

end
#
code
startup:
SetPulse(delay_between);
return;
pulse:
CreateThing(boom0[rand()*booms_in_use],ghost0[rand()*ghosts_in_use]);
return;
end

This should work. And VERY easy! If no work, then Parsec the 2 codes.

/Edward

gbk
10-07-2003, 11:03 AM
I like to shy away from using 'used' variables, because n00bs never know what to put in there, so the cog ends up fudging.

------------------
Back in Black (http://12.220.251.111/ol/cogpad/cogpad.html)...

Brad S
10-07-2003, 07:15 PM
Not to sound snobby, or self praising, but im no noob, i have been editing for... 4 yrs now.. i just still have a little trouble cogging

------------------
"Everyone Dies..."
-Fett

My Website (http://24.45.190.154:81/brad_s/)
Brad's Highschool Level (http://24.45.190.154:81/brad_s/highschool.htm)
Unfinished Levels For Download (http://24.45.190.154:81/brad_s/incompletelevels.htm)

gbk
10-07-2003, 07:44 PM
No offense intended. I mean cog n00b. I lived and breathed cogs for years. I could think in cog at one point or another. Alot of that is gone now, but I can still code!! http://forums.massassi.net/html/frown.gif

------------------
Back in Black (http://12.220.251.111/ol/cogpad/cogpad.html)...