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 → Gun torret
Gun torret
2004-01-01, 11:36 AM #1
Alright, I'm making a gun torret for Attack on Theed and i've ran into a little problem. What my cog does is teleports the player to a platform, and sets his actor flags such that he can't move, only turn and fire. I use SelectWeapon to make him pull out the strifle, and i set his super charge bin so he can fire fast. I also try to change his energy ammo inventory to 999.

You experience cog guys probably see my problem already. ChangeInv doesn't let you exceed the bin max, and apparently neither does SetInv. Is there a way I can change an inventory to a value higher than the bin max? And if not, can you guys think of a way around this? Its every important that this be done without modifying items.dat so that AoT can be played with mods. Here are the cogs for you to look at.

Code:
# Jedi Knight Cog Script
#
# aot_defensegun.cog
#
# Controls the defense guns.
#
# [SM SIth Lord]
#
# This cog is not made or distributed by LucasArts Entertainment Co.

symbols

message		activated
message		timer

surface		actiswitch=-1

thing		player		local
thing		gunport=-1
thing		exitport=-1
thing		debugcam=-1

end

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

code

activated:
player = GetSourceRef();
SetActorFlags(player,0x840000);
TeleportThing(player,gunport);
SendTrigger(player,771,player,exitport,-1,-1);
SetTimerEx(30,1,player,-1);
return;

timer:
SetCameraFocus(1,debugcam);
return;

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

end


And the cient side of the cog:
Code:
# Jedi Knight Cog Script
#
# aot_defensegun_cli.cog
#
# Client side of defense gun.
#
# [SM SIth Lord]
#
# This cog is not made or distributed by LucasArts Entertainment Co.

flags=0x240
symbols

message		trigger
message		pulse

thing		exitport	local
thing		player		local

flex		oldammo=-1	local

end

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

code

trigger:
player = GetLocalPlayerThing();
if( GetSourceRef() != 771 || GetParam(0) != player ) return;
exitport = GetParam(1);
SelectWeapon(player,3);
oldammo = GetInv(player,11);
SetInv(player,11,999);
SetPulse(0.5);
return;

pulse:
if( GetCurWeapon(player) == 3 && GetInv(player,11) > 500 ){
  if( GetInv(player,63) != 3.0 ) ChangeInv(player,63,3.0);
  if( GetInv(player,11) != 999 ) SetInv(player,11,999);
  }
else{
  SetPulse(0);
  ChangeInv(player,11,oldammo);
  oldammo = -1;
  TeleportThing(player,exitport);
  ClearActorFlags(player,0x840000);
  }
return;

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

end


------------------
One day, after everybody else quits, I'll be the best.
Sith Mercenaries
^My site.

[This message has been edited by SM_Sith_Lord (edited January 01, 2004).]
One day, after everybody else quits, I'll be the best.
Sith Mercenaries
^My site.
2004-01-01, 12:00 PM #2
You could change the items.dat to allow 999 in that bin.

Are you just trying to make it so you can shoot an infinite amount of shots? If you are, you could just make the cog so that it doens't subtract anything from the bin.

------------------
*Takes out his blaster and fires shots at the wall, the blastmarks leave the words "S-TROOPER WUZ 'ERE!!!"
2004-01-01, 12:04 PM #3
Yeah, that would easily do it, but the thing is I can't modify items.dat. I have to make it so my level is compatible with mods, and changing items.dat or the strifle cog would screw up its compatability.

------------------
One day, after everybody else quits, I'll be the best.
Sith Mercenaries
^My site.
One day, after everybody else quits, I'll be the best.
Sith Mercenaries
^My site.
2004-01-01, 2:02 PM #4
Would making a cog add 1 to the bin after one is taken away work? Or maybe something like, ammo = GetInv(player, 11); and in a pulse message, SetInv(player, 11, ammo);. That way, it would keep setting the inventory of that bin to what it was before?

------------------
*Takes out his blaster and fires shots at the wall, the blastmarks leave the words "S-TROOPER WUZ 'ERE!!!"
2004-01-01, 10:10 PM #5
Well, I was trying to set the inventory to a value higher then the max so I could tell if the player changes guns or not. But now that i think about it... the inventory would not be reset until after the cog relizes that he changed guns. I guess i need to make it so it just sets the bin to the bin max until the player's current weapon isn't 3 anymore. I'll try it out and let u know how it goes.

------------------
One day, after everybody else quits, I'll be the best.
Sith Mercenaries
^My site.
One day, after everybody else quits, I'll be the best.
Sith Mercenaries
^My site.
2004-01-02, 7:48 AM #6
I think Stormtrooper's idea may have merit; use a pulse to keep resetting the ammo to the max.
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2004-01-03, 6:57 AM #7
Now here's just a thought (so please forgive me if I've gotten the wrong end of the stick... [http://forums.massassi.net/html/redface.gif] )

If you set the weapon in "items.dat" file to be "999" then when you teleport the player to that position, you could perform a flag check on that player (the one that got teleported) because he/she would be the only player with those flags (from a client-side persepctive - eg, they wouldn't be moving for a start) and then with a pulse message perform what Stormtrooper suggested...

By the by, that's not really the scenario to be using "SetInv()" verb for really... [http://forums.massassi.net/html/redface.gif] Sorry...

Hope this has helped (in some small way - they're just ideas for you to tinker and play-around with) [http://forums.massassi.net/html/biggrin.gif]

-Jackpot

PS: I'll post back if I think up any more ideas... [http://forums.massassi.net/html/smile.gif]

------------------
"lucky_jackpot is the smily god..." - gothicX

"Life is mostly froth and bubble,
But two things stand in stone,
Kindness in another's trouble,
Courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2004-01-04, 2:26 PM #8
Well there would be good ways to do it like stortroppers idea but i dont think ull be able to get the inventory to read 999. Although I have one idea it probably wont work but just create a bm of the inventory side of the hud that has 999 writin in and when you enter the turret get it to change the bm to your new one.

------------------
hello.
go to www.nigelsjkprojects.uni.cc
Spoting an error in post will result in a $100 reward.
Offer expires on 6/6/06. Valid one per customer, per day.

Rangi

↑ Up to the top!