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 → Force See a COG?
Force See a COG?
2004-03-13, 11:57 PM #1
Hi!
I'm making a new type of Force Seeing. When active, I want surfaces with a COG attached to change material. Something like:

Old=GetSurfaceMat(surface);
SetSurfaceMat(surface,New);
sleep(0.01);
SetSurfaceMat(surface,Old);
surface=NextSurfaceInView();

And also for the things that have a COG attached shall change their Geo Mode to 3. Something like:

Old=GetThingCurGeoMode(thing);
SetThingCurGeoMode(thing, 3);
sleep(0.01);
SetThingCurGeoMode(thing, Old);
thing=NextThingInView();

And... I have done something to the Force Seeing Tint so that there is no blue tint and I've set the first 3 values to 1. But, I feel it is too dark. Anyway I can fix that so that it is brighter?

/Edward
Edward's Cognative Hazards
2004-03-14, 11:18 AM #2
Find the EnableIRMode line in the cog. You'll have to change the first value.
EnableIRMode(flex level_light, flex thing_light);

Both verb values are ranged from 0.0 - 1.0, 1.0 being fully lit.

Hope this is what you need.

------------------
I am Darth Slaw.
The Dark Lord of the Sith,
And part of the Nightfire mod team
May the mass times acceleration be with you.
2004-03-14, 12:19 PM #3
OK, that sorted out the darkness. Now how do I go about finding the COG attached things and surfaces?

/Edward
Edward's Cognative Hazards
2004-03-16, 9:20 PM #4
Hello? Anyone with an answere to my first problem? Hello?
Edward's Cognative Hazards
2004-03-18, 5:27 PM #5
Force seeing is defined by special force seeing flags, so if you're talking being able to see things like cogs, then I most seriously doubt it.

------------------
-There are easier things in life than finding a good woman, like nailing Jello to a tree, for instance

-Tazz
-There are easier things in life than finding a good woman, like nailing Jello to a tree, for instance

Tazz
2004-03-18, 5:50 PM #6
If you're desperate, you might try applying an unknown/unused flag to those surfaces in the level and, in the force seeing cog, checking for those and doing your effect on them.

WARNING: This is the very untested, hypothetical, last resort method you will want to use.
On the upside, you might somehow discover a mystery flag's effect.

Other than this, I don't see any other way of doing it. Couldn't find any verbs to help you.

------------------
I am Darth Slaw.
The Dark Lord of the Sith,
And part of the Nightfire mod team
May the mass times acceleration be with you.
2004-03-18, 9:08 PM #7
Quote:
<font face="Verdana, Arial" size="2">Originally posted by Darth Slaw:
If you're desperate, you might try applying an unknown/unused flag to those surfaces in the level and, in the force seeing cog, checking for those and doing your effect on them.

WARNING: This is the very untested, hypothetical, last resort method you will want to use.
On the upside, you might somehow discover a mystery flag's effect.

Other than this, I don't see any other way of doing it. Couldn't find any verbs to help you.

</font>


One little problem with setting an unused flag to a surface with a COG. This is supposed to be a Mod, so I don't know what surfaces has a COG. And I don't only want it for a surface, but also thing. Hm... You said something there... Flags... This flags called "Used In Cogs", how does that work? Does it get enabled in-game? I haven't used this flag in my levels... Is it just another useless flag?

/Edward
Edward's Cognative Hazards
2004-03-19, 4:49 AM #8
Yes, if you look up datamasters surface flags you will find JK sets all surfaces used by a cog to 0x2 use this code to find it. (I also used a heap to store the orginal mat for when seeing wears off)

Code:
symbols
int i
message startup
message activated
message timer
material mat=00_base1.mat
end
code

startup:
HeapNew(0, getsurfacecount()+1); 
return;

activated:
for(i=0;i<=GetSurfaceCount();i=i+1)
{
heapset(i,getsurfacemat(i));
if(GetSurfaceFlags(i)==2){SetSurfaceMat(i, mat);}
}
settimer(5); //change this for the leanth of seeing
return;

timer:
for(i=0;i<=GetSurfaceCount();i=i+1)
{
SetSurfaceMat(i, heapget(i)); 
}
return;
end


you'll want to change the mat and add in the basic seeing code. but that SHOULD work, though its untested.
and amke shure the activated message run's at least one time before the timer is called or your screwed.

------------------
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?
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?
2004-03-19, 4:52 AM #9
yep, i still gotthe ownage within me [http://forums.massassi.net/html/biggrin.gif]

------------------
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?
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?
2004-03-19, 6:14 AM #10
Hm... It didn't work. I was in the first level, used force seeing, and the neon sign didn't shine. I thought this must be the work of MatAnim so I went on to the first switch. Nope, the switch still had its own texture... Maybe I implimated it wrong. :?
Code:
# Jedi Knight Cog Script
#
# FORCE_SEEING.COG
#
# FORCEPOWER Script - Seeing
#  Light Side Power
#  Bin 23
#
# [YB]
# [SF]pjb did Code Seeing.
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved


symbols

thing       player                           local

flex        cost=30.0                        local
flex        mana                             local

sound       seeingSound=ForceSee01.WAV       local
sound       seeingSound2=vibes2.wav      local
int         channel=-1                       local

int         rank=0                           local
int         flags=0                          local
int         old_flags=0                      local

int         effectHandle=-1                  local
material	greencode=00_base1.mat		local

int		i				local

message     startup
message     shutdown
message     activated
message     timer
message     pulse
message     newplayer
message     killed
message     selected

end

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

code

startup:
   player = GetLocalPlayerThing();
   old_flags = GetMapModeFlags();
sleep(0.1);
HeapNew(0, getsurfacecount()+1);
	for(i=0; i<=GetSurfaceCount(); i=i+1)
	{
		heapset(i,getsurfacemat(i));
		if(GetSurfaceFlags(i)==2){ SetSurfaceMat(i, greencode); }
	}
sleep(0.1);
	call stop_power;

   Return;

# ........................................................................................

shutdown:
   call stop_power;

   Return;

# ........................................................................................

activated:
   if(!IsInvActivated(player, 23))
   {
      mana = GetInv(player, 14);
      if(mana >= cost)
      {
         if(GetInv(player, 65) != 1) ChangeInv(player, 14, -cost);

         rank = GetInv(player, 23);
         if(rank == 1) flags = 0xc;          // players & actors
         else if(rank == 2) flags = 0xc;     // players & actors
         else if(rank == 3) flags = 0x1c;    // players & actors & items
         else if(rank == 4) flags = 0x4c;    // players & actors & items & projectiles

         PlayMode(player, 24);

         // Play activation sound
        channel = PlaySoundThing(seeingSound, player, 1.0, -1, -1, 0x80);
	if(GetDebugModeFlags() & 0x400)
		ChangeSoundPitch(channel,0.5,0.01);

         // Play loop sound at 0.0 volume and fade it in to 1.0 volume in 0.75 secs
         channel = PlaySoundThing(seeingSound2, player, 0.0, -1, -1, 0x81);
         ChangeSoundVol(channel, 1.0, 0.75);

         effectHandle = newColorEffect(.95, 1, .9, 0, 0, 0, 0, 0, 0, 1.0);
	for(i=0; i<=GetSurfaceCount(); i=i+1)
	{
		heapset(i,getsurfacemat(i));
		if(GetSurfaceFlags(i)==2){ SetSurfaceMat(i, greencode); }
	}
         EnableIRMode(1, 1);
         old_flags = GetMapModeFlags();
         SetMapModeFlags(flags);
         SetInvActivated(player, 23, 1);

         SetPulse(0.1);
      }
   }
	else { call stop_power; }

   Return;

# ........................................................................................

timer:
   call stop_power;

   Return;


# ........................................................................................

pulse:
   // check that the player didn't die
   if(GetThingHealth(player) < 1)
   {
      call stop_power;
   }
	if(GetActorFlags(player) & 0x200000)
	{
		call stop_power;
	}

   Return;

# ........................................................................................

selected:
   jkPrintUNIString(player, 23);
   Return;

# ........................................................................................

killed:
   if(GetSenderRef() != player) Return;

newplayer:
   call stop_power;

   Return;

# ........................................................................................

stop_power:
   SetPulse(0);
   KillTimerEx(1);
   if(channel != -1)
   {
      StopSound(channel, 0.1);
      channel = -1;
   }

   if(effectHandle!=-1)
   {
      freeColorEffect(effectHandle);
      effectHandle = -1;
   }

   // Don't disable IR mode if IR Goggles are on...
   if(!IsInvActivated(player, 41))
      DisableIRMode();
	for(i=0; i<=GetSurfaceCount(); i=i+1)
	{
		SetSurfaceMat(i, heapget(i));
	}
   // Clear the map mode flags
   ClearMapModeFlags(0xffff);

   // and reset them to what they were.
   SetMapModeFlags(old_flags);

   SetInvActivated(player, 23, 0);

   Return;

end

Find and help!

/Edward
Edward's Cognative Hazards
2004-03-19, 10:00 AM #11
Code:
for(i=0; i<=GetSurfaceCount(); i=i+1)
{
   heapset(i,getsurfacemat(i));
   if(GetSurfaceFlags(i)==2)
   { 
      SetSurfaceMat(i, greencode); 
   }
}

shouldn't that be if(GetSurfaceFlags(i) & 2)? This checks to see if "2" is one of the flags of the surface, as opposed to the only flag. (See the Datamaster's Operators section for more info on bitwise operators).

I don't think it should be "== 2", because you're asking if the only flag on the surface is the "2" flag. Thus, if one surface had flags "5" and another had "2", the "5" surface wouldn't be detected but the "2" surface would.

------------------
I am Darth Slaw.
The Dark Lord of the Sith,
And part of the Nightfire mod team

[This message has been edited by Darth Slaw (edited March 19, 2004).]
May the mass times acceleration be with you.
2004-03-19, 10:08 AM #12
Well, I copied from your example, so... Don't blame me for the fault, but do blame me for not having eyes open.
Edward's Cognative Hazards
2004-03-19, 10:11 AM #13
Does that mean it worked? [http://forums.massassi.net/html/confused.gif]

btw, I'm not blaming anyone. I get simple mistakes myself and don't notice right away..

------------------
I am Darth Slaw.
The Dark Lord of the Sith,
And part of the Nightfire mod team
May the mass times acceleration be with you.
2004-03-19, 10:20 AM #14
Yes! It waorks! Now to do the same to the things... How to get a new heap and not have it clash with the other one? And why I change the things Geo mode to Solid Color is because I don't think one can change the things textures through COGs, and it would be a lot of 3DOs to change.

/Edward
Edward's Cognative Hazards
2004-03-19, 10:34 PM #15
Eh, now this was wierd... No big problem, but just simply wierd... Level 4 in JK, the water that scrolls, in Force Seeing, it ain't the new material that scrolls. How come? The surfaces should be tied to a 00_conveyer.cog.

/Edward
Edward's Cognative Hazards
2004-03-20, 1:08 AM #16
Eeek. Newly discovered problem! In MP, all surfaces are set to one material.
Edward's Cognative Hazards
2004-03-22, 4:09 AM #17
the 3do's dont need aheap as tehy are.. things.. your jsut changeing the geo mode.. and you can jsut set them all to 3 and then back to 4

and sorry aobut the == & thing >_<

------------------
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?
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?
2004-03-22, 4:10 AM #18
All surfaces???

now i am totaly confused... ALL?

-ish beaten

------------------
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?
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?
2004-03-22, 7:29 AM #19
Yes! All surfaces to one mat!
And another has risen. When I was playing a custom level (fancy archi and big) some of the surfaces have been removed. And when I say removed, I mean HOM is there instead of MATs!
Tell me... Is there a limit to what you can store in a heap?

Quote:
<font face="Verdana, Arial" size="2">
the 3do's dont need aheap as tehy are.. things.. your jsut changeing the geo mode.. and you can jsut set them all to 3 and then back to 4
</font>

What are you trying to say..? That in a pulse I should turn them on and off?

setpulse(0.2);
pulse:
for(i=0; i<=GetThingNum(); i=i+1)
{
if(ThingIsUsedByCOG(i))
{
SetThingGeoMode(i,3);
}
}
sleep(0.1);
for(i=0; i<=GetThingNum(); i=i+1)
{
if(ThingIsUsedByCOG(i))
{
SetThingGeoMode(i,4);
}
}

Something like that?

And this COG flag. Is it enabled for Class COGs as well?
Edward's Cognative Hazards

↑ Up to the top!