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 → ok, why cant cog be............. DARNED SIMPLE? (help!)
ok, why cant cog be............. DARNED SIMPLE? (help!)
2003-05-04, 9:24 AM #1
ok, if you read this pleas also fix my erlyer cutseen cog, its still not working.

problem. day never comes! (or night or dusk or dawn, heck it wont evan add the light.) i need it fast. my projects are both behind sedule. and it sux.
Code:
# Jedi Knight Cog Script
#
# default.cog
#
# Description
# 
#
# This Cog is Not supported by LucasArts Entertainment Co

symbols
message      startup                                                          
flex         daynight=32400                                                   
flex         dawndusktime=5400                                                
flex         addlight=0.5                                                     
sector       I                                  local                         
surface      X                                  local                         
material     mat                               local                         
material     day=day.mat                                                      
material     dusk=dusk.mat                                                    
material     dawn=dawn.mat                                                    
material     night=night.mat                                                  
material     cloud=clouds.mat                                                 
int daya=0	local
end                                                                           
# ========================================================================================
code

boo:
sleep(daynight+dawndusktime);
call calulate;
return;

startup:
sleep(daynight);
call calulate;
return;

calulate:
For(I=0;I<=GetSectorCount();I=I+1)
if(daya==1)
{
If(Getsectorflags(I) & 100)SetSectorLight(I, addlight, dawndusktime); 
}
if(daya==0)
{
If(Getsectorflags(I) & 100)SetSectorLight(I, 0-addlight, dawndusktime); 
}
For(X=0;X<=GetSurfaceCount();X=X+1)
If(Getsurfaceflags(X) & 204) 
{
mat=GetSurfaceMat(X); 
if (mat==day)
{
SetSurfaceMat(X, dusk); 
return;
}
if(mat==dusk)
{
SetSurfaceMat(X, night); 
return;
}
if(mat==night)
{
SetSurfaceMat(X, dawn); 
return;
}
if(mat==dawn)
{
SetSurfaceMat(X, day); 
return;
}
}
call boo;
return;
# ........................................................................................
end


------------------
I am pjb.
Another post......
another moment of my life wasted.....

[This message has been edited by [SF]pjb (edited May 04, 2003).]
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2003-05-05, 4:10 AM #2
Try this.
relpace
Code:
If(Getsectorflags(I) & 100)

with
Code:
If(Getsectorflags(I) == 100)


Do that at each spot you put the & sign. The & doesn't check whether or not it is equal. So you were pretty much saying, "If get sector flags(i) and 100." That doesn't make sense. The new version says, "If get sector flags(i) equal 100." Doesn't that make more sense [http://forums.massassi.net/html/wink.gif]

------------------
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"
2003-05-05, 6:56 AM #3
hey, ill try that thanks SG.
p.s.did you ever get that flying cog to work without bugs? coz i could relay use it, evan if its just for source code.

------------------
I am pjb.
Another post......
another moment of my life wasted.....
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2003-05-05, 7:09 AM #4
oh darn, its not working. all i want to do is find all the sectors that have the 8th flag and all the sky surfaces, and messa round with them.

i need a better coger than me [http://forums.massassi.net/html/frown.gif].

------------------
I am pjb.
Another post......
another moment of my life wasted.....
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2003-05-05, 8:42 AM #5
Code:
# Jedi Knight Cog Script
#
# default.cog
#
# Description
#
# This Cog is Not supported by LucasArts Entertainment Co
#=====
symbols
#-----
message   startup
message   timer
flex      daynight=10.0
flex      addlight=0.8
sector    i=0     local
surface   x=0     local
material  mat     local
material  day
material  dusk
material  dawn
material  night
int       daya=0     local
int       debug=0
flex      sec_lite=0.0     local
#-----
end
#=====
code
#-----
startup:
  if((IsServer()) || (!IsMulti()))
    {
    //-Make it DAY...
    for(i=0; i<GetSectorCount(); i=i+1)
      //-look for the special sector flag...
      if(GetSectorFlags(i) & 0x100)
        {
        sec_lite = GetSectorLight(i);
        sec_lite = sec_lite + addlight;
        SetSectorLight(i, sec_lite, 0.0);
        }
    //-Set the sky to DAY...
    for(x=0; x<GetSurfaceCount(); x=x+1)
      //-look for the two types of sky flags...
      if((GetSurfaceFlags(x) & 0x200) || (GetSurfaceFlags(x) & 0x400))
        SetSurfaceMat(x, day);
    daya = 0;
    SetTimerEx((daynight / 2), 1, 0, 0);
    SetTimerEx(daynight, 2, 0, 0);
    }
return;
#-----
timer:
  if(GetSenderID() == 1)
    {
    //-Start the light fade...
    if(daya == 0)
      daya = 1;
    else
    if(daya == 1)
      daya = 0;
    for(i=0; i<GetSectorCount(); i=i+1)
      //-look for the special sector flag...
      if(GetSectorFlags(i) & 0x100)
        {
        if(daya == 0)
          {
          if(debug == 1)
            Print("going to day...");
          sec_lite = GetSectorLight(i);
          sec_lite = sec_lite + addlight;
          SetSectorLight(i, sec_lite, (daynight * 1.75));
          }
        else
        if(daya == 1)
          {
          if(debug == 1)
            Print("going to night...");
          sec_lite = GetSectorLight(i);
          sec_lite = sec_lite - addlight;
          SetSectorLight(i, sec_lite, (daynight * 1.75));
          }
        }
    return;
    }
  else
  if(GetSenderID() == 2)
    {
    //-Change the sky...
    for(x=0; x<GetSurfaceCount(); x=x+1)
      //-look for the two types of sky flags...
      if((GetSurfaceFlags(x) & 0x200) || (GetSurfaceFlags(x) & 0x400))
        {
        mat = GetSurfaceMat(x);
        if(mat == day)
          SetSurfaceMat(x, dusk); 
        else
        if(mat == dusk)
          {
          SetSurfaceMat(x, night);
          SetTimerEx((daynight / 2), 1, 0, 0); 
          }
        else
        if(mat == night)
          SetSurfaceMat(x, dawn); 
        else
        if(mat == dawn)
          {
          SetSurfaceMat(x, day);
          SetTimerEx((daynight / 2), 1, 0, 0);
          }
        }
    SetTimerEx(daynight, 2, 0, 0);
    return;
    }
return;
#=====
end

that cog will do what it sounds like you want.
i took the cog you posted and modified it alot.
i dont know the reasons why your cog didnt work, i just took what you gave and started playing around with it until it worked.
i made it so it only takes the 'daynight' flex, bigger the number the longer the days.
i put a 'debug' int in too so you can see when the sector light is starting to change. 1 is on 0 is off.
see if its what you need, change it if you need to.

------------------
Famous last words - "It seemed like a good idea at the time."

[This message has been edited by DSLS_DeathSythe (edited May 05, 2003).]
Famous last words - "It seemed like a good idea at the time."
2003-05-05, 9:04 AM #6
thanks! woohoo!!

thanks deathsythle, [http://forums.massassi.net/html/biggrin.gif] if you need any textures or 3DO's jsut ask, i would be glad to return the favior.

------------------
I am pjb.
Another post......
another moment of my life wasted.....
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?

↑ Up to the top!