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 → Problems with Thing Flags.
Problems with Thing Flags.
2003-11-28, 10:24 AM #1
Hi!
I have 3 COGs that test and assign stuff.
I'm making a coop level where you can choose to be the hero, or badguy, and when you die, you are respawned to your respective HQs.
Code:
# Enter this place and you are assigned that species. (Human)
#
# By Edward
symbols

message		entered

sector		thisplace

end
#
code
entered:
	If(GetSenderRef()!=thisplace) return;
	SetThingFlags(GetSourceRef(),536870912*20);
return;
end

Good guys get a flag so that when dead, they return to the respawn chambers at the good HQ. Will make bad guys MUCH later.
Code:
# Thing Teleport
#
# By Edward
symbols

message		activated

thing		place

thing		switch

sound		teleport

int		room

template	woosh

end
#
code
activated:
	If(GetSenderRef()!=switch) return;
	PlaySoundThing(teleport,GetSourceRef(),1,-1,10,0x0);
	CreateThing(woosh,GetSourceRef());
	TeleportThing(GetSourceRef(),place);
	CreateThing(woosh,GetSourceRef());
	PlaySoundThing(teleport,GetSourceRef(),1,-1,10,0x0);
	SetThingFlags(GetSourceRef(),536870912*room);
return;
end

Now this teleports Special People to their respective HQs, within the same community. Basically, server owners. I've set 3 of these COGs where the room(int)s are 2, 3 & 4. The 3 owners are:
ME! The server starter.
Hawk, the story teller and Vice boss (under me)
Danne, the weapons expert (weapon vender, together with misc).
Code:
# Test owners. If there is one, give hime the apropriet key!
#
# By Edward
flags=0x240
symbols

message		startup
message		pulse
message		newplayer

thing		owner1
thing		owner2

thing		hrespawn0
thing		hrespawn1
thing		hrespawn2
thing		hrespawn3
thing		hrespawn4
thing		hrespawn5
thing		hrespawn6
thing		hrespawn7
thing		hrespawn8

thing		arespawn0
thing		arespawn1
thing		arespawn2
thing		arespawn3
thing		arespawn4
thing		arespawn5
thing		arespawn6
thing		arespawn7
thing		arespawn8

end
#
code
startup:
	SetPulse(1);
return;
pulse:
	if(GetThingFlags(GetLocalPlayerThing())==536870912*2)
	{
		SetInvAvailable(GetLocalPlayerThing(),46,1);
	}
	else if(GetThingFlags(GetLocalPlayerThing())==536870912*3)
	{
		SetInvAvailable(GetLocalPlayerThing(),48,1);
	}
	else if(GetThingFlags(GetLocalPlayerThing())==536870912*4)
	{
		SetInvAvailable(GetLocalPlayerThing(),46,1);
		SetInvAvailable(GetLocalPlayerThing(),48,1);
	}
return;
newplayer:
	If(GetThingFlags(GetSenderRef())==536870912*2)
	{
		TeleportThing(GetSenderRef(),hrespawn0[rand()*8]);
	}
	else If(GetThingFlags(GetSenderRef())==536870912*20)
	{
		TeleportThing(GetSenderRef(),hrespawn0[rand()*8]);
	}
	else If(GetThingFlags(GetSenderRef())==536870912*30)
	{
		TeleportThing(GetSenderRef(),arespawn0[rand()*8]);
	}
	else If(GetThingFlags(GetSenderRef())==536870912*3)
	{
		TeleportThing(GetSenderRef(),owner2);
	}
	else If(GetThingFlags(GetSenderRef())==536870912*4)
	{
		TeleportThing(GetSenderRef(),owner1);
	}
return;
end

Now of course, the owners need keys so that they can... No, not leave the crew stranded while they watch them being slawtered... The HQs are actually homes to the owners, and so there are these private doors like, bathrooms, kitchens, wardrobe, stuff...

The problem being is that when I go to one of these places, I don't get keys, nor do we respawn in the appropriate places. We go back to the start where we choose sides...

Oh, and one more thing... Could you make sure that these COGs will work on Local Players, but the teleport is shown to all players.

/Edward
Edward's Cognative Hazards
2003-11-30, 9:18 PM #2
*Meeow?*
Edward's Cognative Hazards
2003-12-01, 1:49 AM #3
errrrm 536870912*20 ????????? This isnt valing flag anymore (i think)

------------------
The miners of Kiith Somtaaw sacificed much, and risked all. For their efforts they were brought into the inner most circle of Hiigaren power. Naabal, S'jet, and Sobanii bowed before them. And from that day to this, Somtaaw's children have been known to one and all as Beastslayers..
2003-12-01, 2:10 AM #4
Then what do I use to give the player an ID value identifying if he is Good, bad, or one of the owners?

/Edward
Edward's Cognative Hazards
2003-12-01, 6:15 AM #5
userdata. Duh.

------------------
Duel Zero key count: Zero! Down to guns and forces. Expect a release soon.
2003-12-01, 6:34 AM #6
I see... Should I use it? I'm a bit doubtfull because of its description by DataMaster.
Quote:
<font face="Verdana, Arial" size="2">DataMaster:
All things have a user data assigned to them. By default it is 0. The user data was created so that the "user" could store values with a thing. It can be very useful for attaching values to players. Since the user data is often used by patches, the author recommends that level authors abstain from using the user data of common things like the player.
</font>

/Edward
------------------
I can never stick to one project!
Do I get sympethy for this? [http://forums.massassi.net/html/smile.gif]

[This message has been edited by Edward (edited December 01, 2003).]
Edward's Cognative Hazards
2003-12-01, 7:12 AM #7
well, if you made a mini mod with it, or compiled the lot together and reliced it as a levle that has to be run like a mod (the dark things is a example of this, the bat runs it liek a mod) then you can use items.dat to add a bin, then you can give eatch palyer a number in taht bin, also you could add cash to you level. not that hard if you think about it..

i tend o use bins way to mutch since i discoverd them, but they can be VERY handy.

------------------
I am pjb.
Another post......
another moment of my life wasted.....
at least i made a level.
PJB's JK page's

-the PJB jedi rule book-
rule one, "never trust a bartender with bad grammar"-kyle katarn in JO

Rule Two, "Gravity is a crule misstress" -kyle katarn in MotS, and the alternatior MK I in AJTD

rule three, "asprines good, but it hasent got the kick of morphine. and its not gonna stop the hurting in my arm, the ones thats on the otherside of the room i mean" -the alternatior
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-12-01, 7:14 AM #8
well, if you made a mini mod with it, or compiled the lot together and reliced it as a levle that has to be run like a mod (the dark things is a example of this, the bat runs it liek a mod) then you can use items.dat to add a bin, then you can give eatch palyer a number in taht bin, also you could add cash to you level. not that hard if you think about it..

i tend o use bins way to mutch since i discoverd them, but they can be VERY handy.

but then again, if you do that, you may not be able to use some mods with it. but as datamaster says, some mods may muck up the level if you use userdata anyway..

of corse, you could use a allready existing bin for a key or something, liek i dunno, the red key. if its not in your level that is..


------------------
I am pjb.
Another post......
another moment of my life wasted.....
at least i made a level.
PJB's JK page's

-the PJB jedi rule book-
rule one, "never trust a bartender with bad grammar"-kyle katarn in JO

Rule Two, "Gravity is a crule misstress" -kyle katarn in MotS, and the alternatior MK I in AJTD

rule three, "asprines good, but it hasent got the kick of morphine. and its not gonna stop the hurting in my arm, the ones thats on the otherside of the room i mean" -the alternatior
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-12-01, 10:00 AM #9
[http://forums.massassi.net/html/eek.gif] [http://edward.leuf.org/ATARIfont/CHR_69.GIF] [http://edward.leuf.org/ATARIfont/CHR_69.GIF] [http://edward.leuf.org/ATARIfont/CHR_75.GIF] [http://forums.massassi.net/html/eek.gif]
DOUBLE POST!!!

But thanks! I think MOD it is!
Edward's Cognative Hazards
2003-12-01, 11:16 AM #10
Hm... There seems to be a problem with the Test owners COG. Every pulse I give the owners their respective keys, but there's a problem. The inventory flashes and I can read Field Light, Red key, and Yellow key, but none of them fit the doors! HELP!

/Edward
Edward's Cognative Hazards
2003-12-02, 4:54 AM #11
To stop the inventory bms from flashing, SetInvAvailable(bin, 1);

You might as well create an array and stick values using the player number as the index.

MyVal[GetPlayerNum(player)]=NewVal;

------------------
-Blessed Be-
I know it's the last day on earth,
We'll be together while the planet dies.

DBZ: The Destruction is Real
-Hell Raiser
2003-12-05, 12:58 AM #12
Well, this array is nice if I had 32 individual people spawning at individual posts, or have chosen individual type of men (fireman, gunman, tank, etc.) but it is left vs right, any guns available in your backpack, and 3 owners. AND I realised my fault (no player in SetInvAvailable(bin,1) [http://forums.massassi.net/html/wink.gif] but the keys weren't available. Here's a piece of the code where the keys are given:
Code:
pulse:
	if(GetThingUserData(GetLocalPlayerThing())==4000*2)
	{
		SetInvAvailable(46,1);
	}
	else if(GetThingUserData(GetLocalPlayerThing())==4000*3)
	{
		SetInvAvailable(48,1);
	}
	else if(GetThingUserData(GetLocalPlayerThing())==4000*4)
	{
		SetInvAvailable(46,1);
		SetInvAvailable(48,1);
	}
return;


/Edward
PS.
sorry for the big absence, I had a little head ache right above my eyes, and you know... Eye-ache + Screen = Blä...

[This message has been edited by Edward (edited December 05, 2003).]
Edward's Cognative Hazards
2003-12-08, 12:40 AM #13
Moof?
Edward's Cognative Hazards
2003-12-11, 12:52 AM #14
BELCH!
Edward's Cognative Hazards
2003-12-11, 2:41 AM #15
if your hot keys aren availible... and i think thats what you mean.. you have proebly set them wong in the items.dat file or jkstrings uni..

post the respective parts of the above files.

------------------
I am pjb.
Another post......
another moment of my life wasted.....
at least i made a level.
PJB's JK page's

-the PJB jedi rule book-
rule one, "never trust a bartender with bad grammar"-kyle katarn in JO

Rule Two, "Gravity is a crule misstress" -kyle katarn in MotS, and the alternatior MK I in AJTD

rule three, "asprines good, but it hasent got the kick of morphine. and its not gonna stop the hurting in my arm, the ones thats on the otherside of the room i mean" -the alternatior
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-12-11, 9:25 AM #16
Not Hot Keys!
Keys! The kind of thing you have to unlock locked doors with!
Update on the whole testing COG.
Code:
# Test owners. If there is one, give hime the apropriet key!
#
# By Edward
flags=0x240
symbols

message		startup
message		pulse
message		newplayer

thing		owner1
thing		owner2

thing		hrespawn0
thing		hrespawn1
thing		hrespawn2
thing		hrespawn3
thing		hrespawn4
thing		hrespawn5
thing		hrespawn6
thing		hrespawn7
thing		hrespawn8

thing		arespawn0
thing		arespawn1
thing		arespawn2
thing		arespawn3
thing		arespawn4
thing		arespawn5
thing		arespawn6
thing		arespawn7
thing		arespawn8

end
#
code
startup:
	SetPulse(1);
return;
pulse:
	if(GetThingUserData(GetLocalPlayerThing())==4000*2)
	{
		SetInvAvailable(GetLocalPlayerThing(),46,1);
	}
	else if(GetThingUserData(GetLocalPlayerThing())==4000*3)
	{
		SetInvAvailable(GetLocalPlayerThing(),48,1);
	}
	else if(GetThingUserData(GetLocalPlayerThing())==4000*4)
	{
		SetInvAvailable(GetLocalPlayerThing(),46,1);
		SetInvAvailable(GetLocalPlayerThing(),48,1);
	}
return;
newplayer:
	If(GetThingUserData(GetSenderRef())==4000*2)
	{
		TeleportThing(GetSenderRef(),hrespawn0[rand()*8]);
	}
	else If(GetThingUserData(GetSenderRef())==4000*20)
	{
		TeleportThing(GetSenderRef(),hrespawn0[rand()*8]);
	}
	else If(GetThingUserData(GetSenderRef())==4000*30)
	{
		TeleportThing(GetSenderRef(),arespawn0[rand()*8]);
	}
	else If(GetThingUserData(GetSenderRef())==4000*3)
	{
		TeleportThing(GetSenderRef(),owner2);
	}
	else If(GetThingUserData(GetSenderRef())==4000*4)
	{
		TeleportThing(GetSenderRef(),owner1);
	}
return;
end

Now please... I want this 100% fixed!
[For those people who don't wish to search the forum for what the problem is:]
I activate the teleporter, the teleporter is fine. I die, I respawn correctly. BUT, when I press Next Inventory key, the Inventory flickers and only shows Field Light. I press enter and it says This is a Red Key... This is a Gold/Yellow Key... Field Light on... Field Light off... I try to open a locked door, and it says I need a key...
[End of problem description]

/Edward
------------------
ThingLight() is my friend...
Edward's Cognative Hazards
2003-12-12, 1:16 AM #17
DOH!

you might have the key, but you should check that the key's bin has the correct value..

-from pow_keyred.cog-
Code:
taken:
   player = GetSourceRef();
   powerup = GetSenderRef();

   // Print("Red Key");
   jkPrintUNIString(player, bin);

   // Do effects.
   PlaySoundThing(pickupsnd, powerup, 1.0, -1, -1, 0);
   AddDynamicTint(player, 0.0, 0.0, 0.2);

   // Increment powerup amount.
   ChangeInv(player, bin, 1.0);
   SetInvAvailable(player, bin, 1);

the door checks the players keyred BIN(46) for the value 1, your giving the palyer the key.. but you not telling the game (bin) that the palyer HAS the key..

add this line (make shure you predefine the bin first)
ChangeInv(player, bin, 1.0);

i had this problem when i made a RPG cash system... its simple to look back on it

(for helpfulness the code from pow_keyred.cog)
Code:
# Jedi Knight Cog Script
#
# POW_KEYRED.COG
#
# POWERUP Script - Red Key
#
# [YB & CYW]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved


symbols

thing       powerup                          local
thing       player                           local
int         bin=46                           local
sound       pickupsnd=BactaPu1.wav           local
flex        amount                           local

message     touched
message     taken
message     shutdown
message     skill

end

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

code

shutdown:
   // Remove the key at end of level
   player = GetLocalPlayerThing();
   SetInv(player, bin, 0);
   SetInvAvailable(player, bin, 0);

   Return;

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

touched:
   player = GetSourceRef();
   amount = GetInv(player, bin);

   if (amount < GetInvMax(player, bin))
   {
      powerup = GetSenderRef();
      TakeItem(powerup, player);
   }

   Return;

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

taken:
   player = GetSourceRef();
   powerup = GetSenderRef();

   // Print("Red Key");
   jkPrintUNIString(player, bin);

   // Do effects.
   PlaySoundThing(pickupsnd, powerup, 1.0, -1, -1, 0);
   AddDynamicTint(player, 0.0, 0.0, 0.2);

   // Increment powerup amount.
   ChangeInv(player, bin, 1.0);
   SetInvAvailable(player, bin, 1);

   Return;

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

skill:
   if (GetParam(0) == 24)                            // Force Pull
   {
      ReturnEx(0);
      Return;
   }

   ReturnEx(-1);
   Return;

end


------------------
I am pjb.
Another post......
another moment of my life wasted.....
at least i made a level.
PJB's JK page's

-the PJB jedi rule book-
rule one, "never trust a bartender with bad grammar"-kyle katarn in JO

Rule Two, "Gravity is a crule misstress" -kyle katarn in MotS, and the alternatior MK I in AJTD

rule three, "asprines good, but it hasent got the kick of morphine. and its not gonna stop the hurting in my arm, the ones thats on the otherside of the room i mean" -the alternatior
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-12-12, 1:58 AM #18
THANK YOU! It sure is typical to miss that one thing... That one single important thing... [http://forums.massassi.net/html/mad.gif]
Thanks! [http://forums.massassi.net/html/biggrin.gif]

/Edward
------------------
Privacy can be a good thing... [http://forums.massassi.net/html/cool.gif]
Edward's Cognative Hazards

↑ Up to the top!