PDA

View Full Version : I need help with a cog



Vegiemaster
08-23-2004, 02:55 PM
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...



# 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~

Lord_Grismath
08-24-2004, 09:30 AM
Rotate the ghost0 during the pulse to a random pyr.

------------------
L (http://www.massassi.net/levels/files/2923.shtml)i (http://www.massassi.net/levels/files/2971.shtml)f (http://www.massassi.net/levels/files/2971.shtml)e of Grismath
and
Rites (http://www.massassi.net/levels/files/2300.shtml) of (http://www.massassi.net/levels/files/2302.shtml) Xanthus (http://www.massassi.net/levels/files/2311.shtml)

Vegiemaster
08-24-2004, 02:32 PM
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~

darthslaw
08-25-2004, 02:26 PM
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



# 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 (http://www.nightfire.uni.cc/site/page.php) || f33l t3h p0w3r (http://www.geocities.com/qrphome/pwp3/) || t3h l0st c0gz (http://www.tbns.net/GBK/ol/index.htm) || OMF > * (http://www.bkkbazaar.com/omf/)

[This message has been edited by Darth Slaw (edited August 25, 2004).]

Vegiemaster
08-25-2004, 03:15 PM
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~

darthslaw
08-25-2004, 04:14 PM
<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 (http://www.nightfire.uni.cc/site/page.php) &#0124;&#0124; f33l t3h p0w3r (http://www.geocities.com/qrphome/pwp3/) &#0124;&#0124; t3h l0st c0gz (http://www.tbns.net/GBK/ol/index.htm) &#0124;&#0124; OMF &gt; * (http://www.bkkbazaar.com/omf/)

[This message has been edited by Darth Slaw (edited August 25, 2004).]