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 → SetInv() doesn't work AT ALL!
SetInv() doesn't work AT ALL!
2001-09-18, 6:35 PM #1
This is very strange. The cog compiles and runs, but it doesn't set the inventory as it should. Here is the part of the code that's just not working:
Code:
	player = GetLocalPlayerThing();

	# Remove all weapons
	setInv(player, 1, 0);
	setInv(player, 2, 0);
	setInv(player, 3, 0);
	setInv(player, 4, 0);
	setInv(player, 5, 0);
	setInv(player, 6, 0);
	setInv(player, 7, 0);
	setInv(player, 8, 0);
	setInv(player, 9, 0);
	setInv(player, 10, 0);

	If(GetCurWeapon(player) == 10) jkSetFlags(player, 0x8);
	SetCurWeapon(player, 0);
That's under the 'startup' section. I also have it under respawn and it doesn't work either > [http://forums.massassi.net/html/frown.gif] I got the code directly from some cogs on massassi that work, so I'm not sure why it won't work on mine! Thanks in advance.
2001-09-19, 12:24 AM #2
It's probably conflicting with the kyle.cog. Try adding 'sleep(3.0)' or timer to the startup message to delay the changes until after the kyle.cog has finished.

Raynar


------------------
... the Jedi I admire the most, met up with Darth Maul, now he's toast ...
Rbots - a project to develop a working Bot for Jedi Knight... download the latest development version here
Pagewizard_YKS: "making your own lightsaber doesn't make you a nerd... "
Raynar - the man with a 10.75" ePenis
2001-09-19, 1:13 AM #3
If I modify the kyle.cog (and the weapon cogs, for that matter), do I have to release them in a separate gob to be put in the resource directory? Or maybe, put in their own directory and run as a batch file? What I mean is, can I modify these files and include them with the level gob and have them work?
2001-09-19, 9:33 AM #4
No. You can't put it in the levels, as far as i know... Make a folder 'cog' put them in and gob it for your mod
Hey, I'm here! But who cares?
2001-09-19, 9:58 AM #5
I put the sleep in there and the setInv()s are now working... Unfortunately, it leaves the bryar selected [http://forums.massassi.net/html/frown.gif] I guess there's no way to deselect a weapon, eh?
2001-09-19, 2:07 PM #6
Also, setInv only works to set the inventory of the host, not the other player. Argh! I guess I have to send a trigger to the local machine to make it set the inventory, but getsenderref doesn't work [http://forums.massassi.net/html/frown.gif]
2001-09-19, 4:53 PM #7
If you want to let the player have a fist on startup do this.

SelectWeapon(player, 1);

As for letting clients inventory go away do this.

On host cog.

SendTrigger(clientPlayer, someID, 0, 0, 0, 0);

On client.

trigger:

if(GetSourceref() == someID)
{
for(x=1; x<=10; x=x+1) SetInv(player, x, 0);
}

SelectWeapon(player, 0);


I may be wrong but editing the kyle.cog and placing it in level cog directory should work as it's already registered in every level as a kyle player in template section with the cog registered. May be wrong.

What getsenderref isn't working?

------------------
http://millennium.massassi.net/ - Millennium

[This message has been edited by Hideki (edited September 19, 2001).]
2001-09-19, 5:01 PM #8
Thanks, Hideki. Let me get this straight (this is a question): A server cog cannot directly use setInv() on connected clients, so the server cog must use a trigger to force the local cogs to set their own inventories? Right?
2001-09-20, 4:45 AM #9
EXACTLY! Right.

------------------
http://millennium.massassi.net/ - Millennium
2001-09-20, 7:16 AM #10
About editing the kyle.cog: Doesn't JK look in the resource folder before it looks at the level? So, if kyle.cog is in Res2, JK would find it there and ignore the kyle.cog in the level.

However, it seems there is a way to get around that by making the player use a different cog. For example, Rbots uses rbot-player.cog instead of kyle.cog.

------------------
Fiction must be more realistic than truth or no one will believe it.

[This message has been edited by SaberMaster (edited September 20, 2001).]
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2001-09-20, 11:34 AM #11
Thanks a ton, guys. Yeah, SaberMaster, I talked to Raynar about that and have edited the master.tpl file to point to my new kyle.cog (arena_client.cog). Thanks!

↑ Up to the top!