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 → I need help with a cog
I need help with a cog
2004-08-23, 11:55 AM #1
first off I am a complete idiot with cog. anyway I am using the one cog form the cog section that makes a ghost into a lightning bolt thingy and plays an ambient sound, and i was wondering if somebody could edit it to make it so that the ghost would stay where it is but rotate and spin on it's axisis, and if at all possible i need it before Spiral's cutoff date for the lab entries, August 26. well here is the cog...

Code:
# Jedi Knight Cog Script
#
# Energyribbon.COG
#
# standard Lighting script with customizable sound, pulserate and template (not recommended
# changing template), lighting goes in the direction of thing (supports 1 thing).
#
# (c) 2000 Sven Solo
#
# Originaly created for one of my levels

symbols

message startup
message pulse

thing ghost0

flex pulserate=0.25

int dummy                              local

template ribbon=+force_lightning       

sound    energy=forcepersuas02.wav

end

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

code

startup:
     SetPulse(pulserate);
    return;

Pulse:
  dummy=CreateThing(ribbon, ghost0);
  dummy=PlaySoundThing(energy, ghost0, 0.5, -1, -1, 0);
# ........................................................................................

end


------------------
~vegiemaster~
Naked Feet are Happy Feet
:omgkroko:
2004-08-24, 6:30 AM #2
Rotate the ghost0 during the pulse to a random pyr.

------------------
Life of Grismath
and
Rites of Xanthus
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2004-08-24, 11:32 AM #3
I'm sorry but i have no idea how to do that could you please just do if it's not to hard? thanks.

------------------
~vegiemaster~
Naked Feet are Happy Feet
:omgkroko:
2004-08-25, 11:26 AM #4
I added in the code for a randomizing rotation thingie.
You may also notice that there is a new, optional mode: random pulse. With this mode on (by setting its value to 1 in Jed), the pulse will be set at a random percentage of the value of the pulserate variable (plus 0.1, so it doesn't go too fast [http://forums.massassi.net/html/smile.gif] ). Just wanted to try to spice up the cog a little [http://forums.massassi.net/html/wink.gif]

Code:
# Jedi Knight Cog Script
#
# Energyribbon.COG
#
# standard Lighting script with customizable sound, pulserate and template (not recommended
# changing template), lighting goes in the direction of thing (supports 1 thing).
#
# (c) 2000 Sven Solo
#
# Originaly created for one of my levels

symbols

message		startup
message		pulse

thing		ghost0

flex		pulserate=0.25

int		random_pulse=1			# 0 = steady pulserate ; 1 = random pulserate
int		counter=3			# how many bolts to fire before changing Rotation (keep it low)
int		i=0				local

template	ribbon=+force_lightning       

sound		energy=forcepersuas02.wav

end

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

code

startup:
	SetThingRotVel(ghost0, VectorSet((rand() - 0.5) * 720, (rand() - 0.5) * 720, (rand() - 0.5) * 720));
	if(random_pulse) SetPulse(pulserate * rand() + 0.1);
	else SetPulse(pulserate);

return;

Pulse:
	i = i + 1;
	if(i >= counter)
	{
		i = 0;
		SetThingRotVel(ghost0, VectorSet((rand() - 0.5) * 720, (rand() - 0.5) * 720, (rand() - 0.5) * 720));
	}       
	CreateThing(ribbon, ghost0);
	PlaySoundThing(energy, ghost0, 0.5, -1, -1, 0);
	if(random_pulse) SetPulse(pulserate * rand() + 0.1);

return;
# ........................................................................................

end

[edit]
Updated slightly more -- bolt counter to reduce random calculating, after that many bolts, the ghost will change direction (keep it low or else a "pattern" will show).

Also, you need to make a new template. Open the Q&D Template Creator, set the name to something (like "ghost2"), the parent to "ghost", and in the big white box, add "move=physics". Save. Change the template of the ghost thing you were using to the new template you just made.
You have to do this because things can only have a rotational velocity if they have the move parameter set to "physics" (ghosts have move set to "path")

------------------
nytfyre m0d || f33l t3h p0w3r || t3h l0st c0gz || OMF > *

[This message has been edited by Darth Slaw (edited August 25, 2004).]
May the mass times acceleration be with you.
2004-08-25, 12:15 PM #5
thanks um is it ready for use now? cuz it needs to be done tomorrow [http://forums.massassi.net/html/redface.gif] the new feature is a good idea thatnks again

------------------
~vegiemaster~
Naked Feet are Happy Feet
:omgkroko:
2004-08-25, 1:14 PM #6
Quote:
<font face="Verdana, Arial" size="2">Originally posted by vegiemaster:
thanks um is it ready for use now? cuz it needs to be done tomorrow [http://forums.massassi.net/html/redface.gif] the new feature is a good idea thatnks again</font>


Yep. So long as you make that template, of course [http://forums.massassi.net/html/smile.gif]
[http://www.massassi.net/ec/images/14797.jpg]

Good luck.

------------------
nytfyre m0d || f33l t3h p0w3r || t3h l0st c0gz || OMF > *

[This message has been edited by Darth Slaw (edited August 25, 2004).]
May the mass times acceleration be with you.

↑ Up to the top!