View Full Version : Problems with Thing Flags.
Edward
11-28-2003, 01:24 PM
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.
# 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.
# 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).
# 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
12-01-2003, 12:18 AM
*Meeow?*
EH_AceCSF
12-01-2003, 04:49 AM
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..
Edward
12-01-2003, 05:10 AM
Then what do I use to give the player an ID value identifying if he is Good, bad, or one of the owners?
/Edward
Checksum
12-01-2003, 09:15 AM
userdata. Duh.
------------------
Duel Zero (http://forums.massassi.net/html/Forum5/HTML/010438.html) key count: Zero! Down to guns and forces. Expect a release soon.
Edward
12-01-2003, 09:34 AM
I see... Should I use it? I'm a bit doubtfull because of its description by DataMaster.
<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).]
[SF]pjb
12-01-2003, 10:12 AM
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 (http://www.geocities.com/SF_PJB1)
-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
[SF]pjb
12-01-2003, 10:14 AM
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 (http://www.geocities.com/SF_PJB1)
-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
Edward
12-01-2003, 01:00 PM
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
12-01-2003, 02:16 PM
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
Hell Raiser
12-02-2003, 07:54 AM
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 (http://www.hellraiser64.com/tdir)
Edward
12-05-2003, 03:58 AM
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:
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
12-08-2003, 03:40 AM
Moof?
Edward
12-11-2003, 03:52 AM
BELCH!
[SF]pjb
12-11-2003, 05:41 AM
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 (http://www.geocities.com/SF_PJB1)
-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
Edward
12-11-2003, 12:25 PM
Not Hot Keys!
Keys! The kind of thing you have to unlock locked doors with!
Update on the whole testing COG.
# 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...
[SF]pjb
12-12-2003, 04:16 AM
DOH!
you might have the key, but you should check that the key's bin has the correct value..
-from pow_keyred.cog-
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)
# 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 (http://www.geocities.com/SF_PJB1)
-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
Edward
12-12-2003, 04:58 AM
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
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.