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 → Random power ups
Random power ups
2001-02-23, 6:18 AM #1
{update: since the last one seems to be too hard for everyone I'll go with a simpler version}
I need a cog that will spawn one of 10 random things to a ghost position. It's for JK MP.

I would like it to display something like:
Location (ghost)
Item 1
Item 2
Item 3
Item 4
Item 5
Item 6
Item 7
Item 8
Item 9
Item 10

The main thing about this cog is that I want a different percent chance of an item appearing. The percentage chances are as follows:
Item 1 = 22%
Item 2 = 18%
Item 3 = 15%
Item 4 = 15%
Item 5 = 12%
Item 6 = 8%
Item 7 = 5%
Item 8 = 2%
Item 9 = 2%
Item 10 = 1%

Thank you in advance.

------------------
The Empire turned against him. The New Republic hate him.
Wanted by both sides his only hope is to hide.
That’s exactly what he’s not going to do!
Armed with his trusty pistol and trained to kill he’s going to make a name for himself.

[This message has been edited by Berlick (edited February 24, 2001).]
2001-02-25, 1:12 AM #2
[http://forums.massassi.net/html/frown.gif]
2001-02-25, 2:20 AM #3
I have one cog that generates only two items randomly...
Quote:
<font face="Verdana, Arial" size="2">
# Jedi Knight Cog Script
#
# Randomrespawn.COG
#
# [Cave_Demon]
#
#
# This Cog is Not supported by LucasArts Entertainment Co

symbols

thing ghost
thing juttu local
template pup1
template pup2
int time=15 local
int time2 local

message startup
message entered
message touched
message timer

end

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

code
startup:
time2 = Rand();
if (time2 < 0.5)
{
juttu = CreateThing(pup1, ghost);
}
else if (time2 > 0.5)
{
juttu = CreateThing(pup2, ghost);
}
Return;

entered:
touched:
SetTimer(Time);
DestroyThing(juttu);


Return;

Timer:
time2 = Rand();
if (time2 < 0.5)
{
juttu = CreateThing(pup1, ghost);
}
else if (time2 > 0.5)
{
juttu = CreateThing(pup2, ghost);
}
Return;
end


</font>

Credit me if my cog helps you

------------------
The death is smiling to all of us,
All what we can do, is smile back.
WHAT?
2001-02-25, 2:24 PM #4
Thanks cave but I could really do with the cog I asked for. I might be able to modify your cog so it works like I want but I doubt it. Either way you'll be in the credits. I'm still looking for the cog I want.
2001-02-26, 4:42 AM #5
this may or may not work in MP (have only tested in SP):
Code:
# Jedi Knight Cog Script
#
# randomIrespawn.COG
#
# A cog that will randomly respawn objects at ghost positions
# 
# 2001 LordVirus
# This Cog is Not supported by LucasArts Entertainment Co

flags=0x40;

symbols

message	startup
message	pulse
message	taken


thing		pos1
thing		pos2
thing		pos3
thing		pos4
thing		pos5
thing		pos6
thing		pos7
thing		pos8
thing		pos9
thing		pos10

template	pup1
template	pup2
template	pup3
template	pup4
template	pup5
template	pup6
template	pup7
template	pup8
template	pup9
template	pup10

flex		respawntime

thing		currentitem		local
thing		currentpos		local

int		player			local
int		gotten=1		local
int		chance			local
int		poschance		local

end

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

code

startup:

player=GetLocalPlayerThing();
gotten=1;
SetPulse(respawntime);

return;

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

pulse:
chance=Rand()*100;
poschance=Rand()*10;

if (poschance<=1 && poschance>=0){
currentpos=pos1;
}
else if (poschance<=1 && poschance>=0){
currentpos=pos2;
}
else if (poschance<=2 && poschance>=1){
currentpos=pos3;
}
else if (poschance<=3 && poschance>=2){
currentpos=pos4;
}
else if (poschance<=4 && poschance>=3){
currentpos=pos5;
}
else if (poschance<=5 && poschance>=4){
currentpos=pos6;
}
else if (poschance<=6 && poschance>=5){
currentpos=pos7;
}
else if (poschance<=7 && poschance>=6){
currentpos=pos8;
}
else if (poschance<=8 && poschance>=7){
currentpos=pos9;
}
else if (poschance<=10 && poschance>=8){
currentpos=pos10;
}

if (chance>=0 && chance<=22){
currentitem=pup1;
}
else if (chance>=22 && chance<=40){
currentitem=pup2;
}
else if (chance>=40 && chance<=55){
currentitem=pup3;
}
else if (chance>=55 && chance<=70){
currentitem=pup4;
}
else if (chance>=70 && chance<=82){
currentitem=pup5;
}
else if (chance>=82 && chance<=90){
currentitem=pup6;
}
else if (chance>=90 && chance<=95){
currentitem=pup7;
}
else if (chance>=95 && chance<=97){
currentitem=pup8;
}
else if (chance>=97 && chance<=99){
currentitem=pup9;
}
else if (chance>=99 && chance<=100){
currentitem=pup10;
}

CreateThing(currentitem, currentpos);
return;

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


end


if it works and you use it, please give me & Virus Productions credit.

------------------
Black. His gloves of finest wool.
Black. His codpiece made of metal.
His horse is blacker than a hole.
His pot is blacker than his kettle.

Visit Virus Productions!

[This message has been edited by LordVirus (edited February 27, 2001).]

[This message has been edited by LordVirus (edited February 27, 2001).]
"And lo, let us open up into the holy book of Proxy2..." -genk
His pot is blacker than his kettle!
2001-02-26, 3:38 PM #6
It's 3:41 am here so I don't have enough time to test it but I will tell you if it works tommorow, can't see any reason why not (like I said I know a little cog just coudn't figure out how to do this).
If it works you most definatly will get credit. I suggest you test it yourself and if it works submit it, it will be a good cog to prevent camping.

Thanks for everything friend.
(why does ^ always sound so nasty to my ears, guess I just read my SW books too often)

------------------
The Empire turned against him. The New Republic hate him.
Wanted by both sides his only hope is to hide.
That’s exactly what he’s not going to do!
Armed with his trusty pistol and trained to kill he’s going to make a name for himself.
2001-02-27, 1:21 AM #7
BAAAD screwup in that COG that I posted, it still had it's debugging code in it! I've edited the message, and the proper one is there now.

------------------
Black. His gloves of finest wool.
Black. His codpiece made of metal.
His horse is blacker than a hole.
His pot is blacker than his kettle.

Visit Virus Productions!
"And lo, let us open up into the holy book of Proxy2..." -genk
His pot is blacker than his kettle!
2001-02-27, 6:15 AM #8
Thanks LordVirus.
It works but it works too well. You end up with stockpiles of weapons!
Could you make it so it only spawns in a position if there is nothing already there? I don't mind if you have to make it use only one ghost. If you can't do this I'll just have to set the respawn to a low value and hope for the best.
Thanks for everything. You're a big help and it is most appreaceiated(sp)

↑ Up to the top!