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 when someone dies..
SetInv when someone dies..
2002-01-02, 9:58 AM #1
When the player kills someone, how do I make the player get more of a certain item? I mean, should I modify kyle.cog or something like that? or should I make a powerup cog?


[This message has been edited by JediJigge (edited January 02, 2002).]
2002-01-02, 10:23 AM #2
I had a problem like that when i made Aftermath 4, i couldn't figure out how i'd do that so i just added the item to backbag cog...

I had some problems getting it work, though...

------------------
I have tried escaping two times,
Both times i got caught and returned to my cage...
Last edited by mb; today at 10:55 AM.
2002-01-02, 10:47 AM #3
Thanks, that's a good idea... But why didn't it work? If it don't work I guess I will need another solution...
2002-01-02, 8:21 PM #4
BAH! This is a chinch, and can be done in a plain ole' level cog.

Use 'Killed' to determine when the enemie is killed, then use 'Setinv' to set your item:

Code:
Killed:
If(Getsenderref() == Enemie) {
Setinv(Player, BIN_num, Getinv(Player, BIN_num) + 1); }
Stop;



Bingo, problem solved.

------------------
Success is the inverse relationship between effort, gain, and loss.
And when the moment is right, I'm gonna fly a kite.
2002-01-03, 8:28 AM #5
okay i'm stupid, I know, but here's my very first cog I've made from scratch... and something is wrong... It's supposed to make the player able to "buy" a weapon when he press activate on a surface.. this is for the crossbow... it didn't work(as i expected)...

Code:
symbols

message	activated

thing		player				   local
surface	shotgunbuy linkid=1
flex		shotguncost=30			   local

end

#-----------------------------------------------------------

activated:

	player=GetSourceRef();
	shotgunbuy=GetSenderRef();

	if(GetInv(player, 119) => shotguncost)
	{
	SetInv(player, 5, 1);
	SetInv(player, 119, -30);
	}
	else
	jkPrintUNIString(player, 120);

	Return;

end

2002-01-03, 9:14 AM #6
If you had studied COG syntax more closely, you would realize that there is suppolse to be a 'CODE' line to signify the start of the code. I see no such line in your cog.

In other words, the syntax is as follows:

Code:
Symbols

Message Any

End

Code

//Crap goes here.

End



That should solve your problem.

------------------
Success is the inverse relationship between effort, gain, and loss.
And when the moment is right, I'm gonna fly a kite.
2002-01-04, 3:56 AM #7
ops!! I had it there... I must have accidently deleted it... I know there has to be a code line.. I'm braindead [http://forums.massassi.net/html/smile.gif] *sorry*

↑ Up to the top!