Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Lua Question
icon5.gif  Lua Question [message #463298] Thu, 01 March 2012 09:56 Go to next message
hego64 is currently offline  hego64
Messages: 19
Registered: April 2011
Location: Hegoville
Karma: 0
Recruit
Hey, its hego64 here! I haven't been here in quite awhile, but I've made a lot of progress with my server.

Anywho, I want to know if its possible to change someone's character when they get to a certian number of kills. Like, if you reach 50 kills you change into Havoc. I know its probably possible, but I don't know how to go about doing this.

Thanks,
-Hego64
Re: Lua Question [message #463424 is a reply to message #463298] Thu, 01 March 2012 21:26 Go to previous messageGo to next message
halo2pac is currently offline  halo2pac
Messages: 659
Registered: December 2006
Location: Near Cleveland, Ohio
Karma: 0
Colonel
Use an array to store the kills, on player join you set yourarray[PLAYER ID] to 0. every kill you set yourarray[PLAYER ID]++ and do an if statement to check whether or not yourarray[PLAYER ID] = 50.

This is pretty basic programming stuff by the way, you should really look at some tutorials for java or visual basic.


http://img339.imageshack.us/img339/1991/nefobbygenyunoreleasere.jpg
Rene-Buddy | Renegade X
Join the fight against Obsessive-Compulsive Posting Disorder. Cancel is ur friend.
*Renegade X Dev Team Member*
Re: Lua Question [message #463458 is a reply to message #463298] Fri, 02 March 2012 09:30 Go to previous messageGo to next message
iRANian is currently offline  iRANian
Messages: 4308
Registered: April 2011
Karma: 0
General (4 Stars)
It's better to store it in a HashTemplateClass (where the key is the player name), so the kills can be "saved" when the player leaves and restored when the player joins, you'll need to use the HashIterator class to remove all the values at level load or gameover in your HashTemplateClass.

But the FDS stores the kill count (in a similar way internally) in cPlayer::Kills so he'll just need to attach a script to all players and in ::Killed() check that variable for a number of 50 really.


Long time and well respected Renegade community member, programmer, modder and tester.

Scripts 4.0 private beta tester since May 2011.

My Renegade server plugins releases
Re: Lua Question [message #463460 is a reply to message #463298] Fri, 02 March 2012 09:48 Go to previous messageGo to next message
hego64 is currently offline  hego64
Messages: 19
Registered: April 2011
Location: Hegoville
Karma: 0
Recruit
Thanks y'all! I'll see what I can do with it when I have the chance. I'm at school right now and dont have access to any of my lua stuff Huh I'll post again if I cant figure it out/if it works.

Re: Lua Question [message #463507 is a reply to message #463460] Sat, 03 March 2012 01:09 Go to previous messageGo to next message
sla.ro(master) is currently offline  sla.ro(master)
Messages: 610
Registered: September 2010
Location: Romania
Karma: 0
Colonel
@iran and halo2pac: he talks about Lua, not C++......

you can just use Change_Character(obj, char) when you a player have 50 kills or whatever (use Get_Kills(playerID)). If your using TT, use LuaTT and there is a Kill hook. look on examples.

check here for functions


Creator of Mutant Co-Op
Developer of LuaTT
Re: Lua Question [message #463508 is a reply to message #463507] Sat, 03 March 2012 01:23 Go to previous messageGo to next message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)
sla.ro(master) wrote on Sat, 03 March 2012 01:09

@iran and halo2pac: he talks about Lua, not C++......

you can just use Change_Character(obj, char) when you a player have 50 kills or whatever (use Get_Kills(playerID)). If your using TT, use LuaTT and there is a Kill hook. look on examples.

check here for functions


you can do everything they said with lua.


http://s18.postimage.org/jc6qbn4k9/bricks3.png
Re: Lua Question [message #463543 is a reply to message #463508] Sat, 03 March 2012 13:22 Go to previous message
halo2pac is currently offline  halo2pac
Messages: 659
Registered: December 2006
Location: Near Cleveland, Ohio
Karma: 0
Colonel
Gen_Blacky wrote on Sat, 03 March 2012 03:23

sla.ro(master) wrote on Sat, 03 March 2012 01:09

@iran and halo2pac: he talks about Lua, not C++......

you can just use Change_Character(obj, char) when you a player have 50 kills or whatever (use Get_Kills(playerID)). If your using TT, use LuaTT and there is a Kill hook. look on examples.

check here for functions


you can do everything they said with lua.



http://img339.imageshack.us/img339/1991/nefobbygenyunoreleasere.jpg
Rene-Buddy | Renegade X
Join the fight against Obsessive-Compulsive Posting Disorder. Cancel is ur friend.
*Renegade X Dev Team Member*
Previous Topic: Veteran Plugin
Next Topic: Copyright question
Goto Forum:
  


Current Time: Sat Nov 23 05:54:00 MST 2024

Total time taken to generate the page: 0.00871 seconds