Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Veteran Plugin.  () 1 Vote
Re: Veteran Plugin. [message #330998 is a reply to message #330985] Sun, 18 May 2008 08:22 Go to previous messageGo to next message
ExEric3 is currently offline  ExEric3
Messages: 746
Registered: February 2005
Location: Slovakia
Karma: 0
Colonel
nodmanmik wrote on Sun, 18 May 2008 14:59


i know nothing about scripting...


I think it's time to learn it...
Re: Veteran Plugin. [message #331148 is a reply to message #330998] Mon, 19 May 2008 05:22 Go to previous messageGo to next message
nodmanmik is currently offline  nodmanmik
Messages: 25
Registered: April 2008
Location: United Kingdom
Karma: 0
Recruit
lol so do i... how can i learn? a website? ...

hehe


Nodmanmik

http://i32.tinypic.com/wl3rz7.jpg
Re: Veteran Plugin. [message #331149 is a reply to message #300286] Mon, 19 May 2008 05:50 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
Buy this book:

http://www.amazon.co.uk/C%2B%2B-Without-Fear-Beginners-Guide/dp/0321246950/ref=s r_1_1?ie=UTF8&s=books&qid=1211201251&sr=8-1

I have quite allot of books on C++, for me, this was the best book for learning it at an introductory level. I should of started with this book first, instead I got half way through C++ for dummies and regretted ever buying it.

The one I linked to is very affordable and a great way to start learning. Buy it. Read it. Learn it. Love it.



Re: Veteran Plugin. [message #331163 is a reply to message #300286] Mon, 19 May 2008 08:53 Go to previous messageGo to next message
Genesis2001
Messages: 1397
Registered: August 2006
Karma: 0
General (1 Star)
http://ecx.images-amazon.com/images/I/51n0eVq1e6L._SL500_BO2,204,203,200_PIsitb-dp-500-arrow,TopRight,45,-64_OU01_AA240_SH20_.jpg

That's the book I used to learn C++...

Thanks,
Zack

[Updated on: Mon, 19 May 2008 08:54]

Report message to a moderator

Re: Veteran Plugin. [message #331235 is a reply to message #331148] Mon, 19 May 2008 22:43 Go to previous messageGo to next message
ExEric3 is currently offline  ExEric3
Messages: 746
Registered: February 2005
Location: Slovakia
Karma: 0
Colonel
nodmanmik wrote on Mon, 19 May 2008 14:22

lol so do i... how can i learn? a website? ...

hehe


For example. Books, websites, friends etc...

I also dont know C++ and when I have some problems Im trying to fix it or ask someone for help.

But this is gonna off topic.
Re: Veteran Plugin. [message #331249 is a reply to message #300286] Tue, 20 May 2008 01:43 Go to previous messageGo to next message
nodmanmik is currently offline  nodmanmik
Messages: 25
Registered: April 2008
Location: United Kingdom
Karma: 0
Recruit
thats ok...

ty for the advice people..



Nodmanmik

http://i32.tinypic.com/wl3rz7.jpg
Re: Veteran Plugin. [message #331345 is a reply to message #300286] Tue, 20 May 2008 17:59 Go to previous messageGo to next message
slavik262 is currently offline  slavik262
Messages: 79
Registered: February 2007
Karma: 0
Recruit
www.learncpp.com is the path I took, along with C++ for dummies. However, I already had some experience in C. I've done no Renegade scripting, but from the looks of it, scripting is very template driven and object-oriented.

http://img432.imageshack.us/img432/7862/userbar405373ux.gif
Re: Veteran Plugin. [message #331364 is a reply to message #300286] Wed, 21 May 2008 04:42 Go to previous messageGo to next message
nodmanmik is currently offline  nodmanmik
Messages: 25
Registered: April 2008
Location: United Kingdom
Karma: 0
Recruit
hrm... ill look up on it!

thanks people for helping! Very Happy


Nodmanmik

http://i32.tinypic.com/wl3rz7.jpg
Re: Veteran Plugin. [message #331766 is a reply to message #300286] Sat, 24 May 2008 07:44 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
I decided to upgrade the veteran system that I posted here to use in cnc_reborn. I changed it so that it rewards players for healing/repairing and disarming.
I also added some little notices for players too, these notices will only be displayed for people using the upgraded client scripts.dll, but for cnc_reborn that's fine.

Here is the changes I made.

struct RepPlayers {
	std::string RepPlayerName;
	int RepPoints;
};

std::vector<RepPlayers> RepInfo;


void RepUpdate(int ID, int number) {

	if (!RepInfo.empty()) {
		for (int i = 0; i < RepInfo.size(); i++) {
			if (RepInfo[i].RepPlayerName == Get_Player_Name_By_ID(ID)) {
				int cvp, now;
				cvp = RepInfo[i].RepPoints;
				now = number + cvp;
				RepInfo[i].RepPoints = now;

				if (cvp < 200 && now >= 200) {
	VetUpdate(ID, 1, Commands->Get_Points(Get_GameObj(ID)));
	Display_Int_Player(Get_GameObj(ID),1,"Bonus repairing veteran points gained: 1");
	RepInfo[i].RepPoints = 0;
	now = 0;
	cvp = 0;
                }

				break;
			}
		}
	}
}


int RepCheckPoints(int ID) {
	if (!RepInfo.empty()) {
		for (int i = 0; i < RepInfo.size(); i++) {
			if (RepInfo[i].RepPlayerName == Get_Player_Name_By_ID(ID)) {
				int Points;
				Points = RepInfo[i].RepPoints;
				return Points;
			}
		}
	}
	return 0;
}


bool RepCheck(int ID) {
	if (!RepInfo.empty()) {
		for (int i = 0; i < RepInfo.size(); i++) {
			if (RepInfo[i].RepPlayerName == Get_Player_Name_By_ID(ID)) {
				return true;
			}
		}
	}
	return false;
}


void RepAddPlayer(int ID) {
	if (RepCheck(ID) == false) {
		RepPlayers temp;
		temp.RepPlayerName = Get_Player_Name_By_ID(ID);
		temp.RepPoints = 0;
		RepInfo.push_back(temp);
	}
}


void RepClearPlayers() {
	RepInfo.erase(RepInfo.begin(), RepInfo.end());
	int Players = The_Game()->MaxPlayers;
	for (int i = 1; i <= Players; i++) {
		if (Get_GameObj(i)) {
			RepAddPlayer(i);
		}
	}
}


Then on the ::Damaged events for the vehicles, players and buildings I did the following:

void MDB_SSGM_Vehicle::Damaged(GameObject *obj, GameObject *damager, float damage) {
			if(damage < 0){
	if (Commands->Is_A_Star(damager) && Commands->Get_Player_Type(damager) == Commands->Get_Player_Type(obj)){
	RepUpdate(Get_Player_ID(damager), ((damage - damage) - damage)/2);
				}
	}
	if (damage > 0.0f) {
		LastDamage = damage;
	}
}


void MDB_SSGM_Player::Damaged(GameObject *obj, GameObject *damager, float damage) {
		if(damage < 0){
	if (Commands->Is_A_Star(damager) && Commands->Get_Player_Type(damager) == Commands->Get_Player_Type(obj)){
	RepUpdate(Get_Player_ID(damager), ((damage - damage) - damage));
				}
	}

	if ((IsSecondWind == true) && (Commands->Get_Health(obj) <= 25) && (Commands->Get_Health(obj) > 0)) {
		IsSecondWind = false;
		Commands->Set_Health(obj,Commands->Get_Max_Health(obj));
		Commands->Set_Shield_Strength(obj,Commands->Get_Max_Shield_Strength(obj));
	}
}


void MDB_SSGM_Building::Damaged(GameObject *obj, GameObject *damager, float damage) {
	if(damage < 0){
if (Commands->Is_A_Star(damager) && Commands->Get_Player_Type(damager) == Get_Object_Type(obj)){
	RepUpdate(Get_Player_ID(damager), ((damage - damage) - damage));
				}
	}



void MDB_SSGM_Beacon::Killed(GameObject *obj, GameObject *shooter) {
		VetUpdate(Get_Player_ID(shooter), 5, Commands->Get_Points(shooter));
	Display_Int_Player(shooter,5,"bonus veteran points gained: 5");
	if (IsDisarmed == false) {
		IsDisarmed = true;
		FDSMessage(StrFormat("%ls disarmed a %s",Get_Wide_Player_Name(shooter),Translate_Preset(obj).c_str()),"_BEACON");
	}
}


void MDB_SSGM_C4::Killed(GameObject *obj, GameObject *shooter) {
			VetUpdate(Get_Player_ID(shooter), 1, Commands->Get_Points(shooter));
	Display_Int_Player(shooter,1,"Bonus veteran points gained: 1");
	if (Settings->LogC4) {
		FDSMessage(StrFormat("%ls %s has been disarmed by %ls (Owner: %ls - Attached to: %s)",Get_Wide_Team_Name(Get_Object_Type(obj)),Translate_Preset(obj).c_str(),Get_Wide_Player_Name(shooter),Get_Wide_Player_Name(Get_C4_Planter(obj)),Translate_Preset(Get_C4_Attached(obj)).c_str()),"_C4");
	}
	WasDisarmed = true;
}


I added the script to players on the join hook, the same as the veteran thing, here:

void Player_Join_Hook(int i,const char *Nick) {
	VetAddPlayer(i);
	RepAddPlayer(i);


And I clear the info on the game over event here:

void GameOver() {
	VetClearPlayers();
RepClearPlayers();
	char ObjectsType[10],ObjectsType2[10],ObjectsFile[20];


I also added those little messages on the normal veteran points gained too, here:

void MDB_SSGM_Vehicle::Killed(GameObject *obj, GameObject *shooter) {
	
	if (Commands->Is_A_Star(shooter)){
VetUpdate(Get_Player_ID(shooter), GetPoints(Commands->Get_Preset_Name(obj)), Commands->Get_Points(shooter));
Display_Int_Player(shooter,GetPoints(Commands->Get_Preset_Name(obj)),"Veteran points gained: %d"),GetPoints(Commands->Get_Preset_Name(obj));


void MDB_SSGM_Player::Killed(GameObject *obj, GameObject *shooter) {

		if (Commands->Is_A_Star(shooter) && Commands->Get_Player_Type(shooter) != Commands->Get_Player_Type(obj))
{
VetUpdate(Get_Player_ID(shooter), GetPoints(Commands->Get_Preset_Name(obj)), Commands->Get_Points(shooter));
Display_Int_Player(shooter,GetPoints(Commands->Get_Preset_Name(obj)),"Veteran points gained: %d"),GetPoints(Commands->Get_Preset_Name(obj));


void MDB_SSGM_Building::Killed(GameObject *obj, GameObject *shooter) {
	if (Commands->Is_A_Star(shooter)){
	VetUpdate(Get_Player_ID(shooter), 25, Commands->Get_Points(shooter));
	Display_Int_Player(shooter,25,"Veteran points gained: 25");
	}



Hope someone finds a use for it.. I may even make it a plug-in if I have time in the next few days, maybe...

Also, my maths seems to be fading away from me...
There must be a better way to turn a negative number into a positive number, rather then "(damage - damage) - damage)".



Re: Veteran Plugin. [message #331768 is a reply to message #300286] Sat, 24 May 2008 07:49 Go to previous messageGo to next message
ExEric3 is currently offline  ExEric3
Messages: 746
Registered: February 2005
Location: Slovakia
Karma: 0
Colonel
Ehm. Could you tell me to which files I must add it? In Love
Re: Veteran Plugin. [message #331770 is a reply to message #331766] Sat, 24 May 2008 08:36 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
reborn wrote on Sat, 24 May 2008 15:44


Also, my maths seems to be fading away from me...
There must be a better way to turn a negative number into a positive number, rather then "(damage - damage) - damage)".


#include <cstdlib>
abs(number);

or, for floating point numbers

#include <cmath>
fabs(number);


Or, if you already know for sure the number is negative;
int number = -number;


http://steamsignature.com/card/1/76561197975867233.png

[Updated on: Sat, 24 May 2008 08:37]

Report message to a moderator

Re: Veteran Plugin. [message #331798 is a reply to message #331770] Sat, 24 May 2008 11:15 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
danpaul88 wrote on Sat, 24 May 2008 11:36

reborn wrote on Sat, 24 May 2008 15:44


Also, my maths seems to be fading away from me...
There must be a better way to turn a negative number into a positive number, rather then "(damage - damage) - damage)".


Or, if you already know for sure the number is negative;
int number = -number;


Thanks DP Wink



Re: Veteran Plugin. [message #331923 is a reply to message #300794] Sun, 25 May 2008 15:37 Go to previous messageGo to next message
lonleyppl
Messages: 4
Registered: May 2008
Karma: 0
Recruit
not many people can make fun of your code reborn
it seems to me like you have coded half the modded servers ive played
one example
hunt the player (mvrtech)
awesome idea that no one else has had
Re: Veteran Plugin. [message #332874 is a reply to message #301078] Sat, 31 May 2008 23:41 Go to previous messageGo to next message
halo2pac is currently offline  halo2pac
Messages: 659
Registered: December 2006
Location: Near Cleveland, Ohio
Karma: 0
Colonel
reborn wrote on Tue, 04 December 2007 18:00


I believe that making your code available to everyone is a good thing.


well then release all the source for C&C Reborn. Big Grin


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: Veteran Plugin. [message #332894 is a reply to message #300286] Sun, 01 June 2008 04:06 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
I will be. Why wouldn't I?


Re: Veteran Plugin. [message #332954 is a reply to message #300286] Sun, 01 June 2008 16:17 Go to previous messageGo to next message
halo2pac is currently offline  halo2pac
Messages: 659
Registered: December 2006
Location: Near Cleveland, Ohio
Karma: 0
Colonel
Including the DLL source?

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: Veteran Plugin. [message #332962 is a reply to message #300286] Sun, 01 June 2008 17:36 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
I'll be releasing the code that runs on the official server and the compiled scripts.dll, which is based on SSGM. I don't understand why you think I wouldn't :-/

This is getting rather off-topic though.



Re: Veteran Plugin. [message #333052 is a reply to message #300286] Mon, 02 June 2008 17:20 Go to previous messageGo to next message
halo2pac is currently offline  halo2pac
Messages: 659
Registered: December 2006
Location: Near Cleveland, Ohio
Karma: 0
Colonel
is there a way to make the levels infinite?
and the reward increase based on the level?


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: Veteran Plugin. [message #333067 is a reply to message #300286] Mon, 02 June 2008 23:37 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
Yeah, that's possible. You could make the reward directly proportionate to the veteran level itself or the veteran points they have.

I'll throw something together...



Re: Veteran Plugin. [message #333473 is a reply to message #300286] Thu, 05 June 2008 11:10 Go to previous messageGo to next message
halo2pac is currently offline  halo2pac
Messages: 659
Registered: December 2006
Location: Near Cleveland, Ohio
Karma: 0
Colonel
Thanks much.
A couple of things though. does it read from an ini to get settings? and if so for the names of the levels is it possible to make them read the names from a list and for a level like 50 if you have no name it just displays "promoted to level 50".

and I really suck @ c++, best I ever did was modify what you get in the crates.

could you compile it for me?

thanks.


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: Veteran Plugin. [message #335007 is a reply to message #330148] Thu, 12 June 2008 19:16 Go to previous messageGo to next message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma: 0
Colonel
EA-DamageEverything wrote on Sun, 11 May 2008 22:04

error C2653: 'reb_vet_System' : is not a class or namespace name c:\ExScripts\SSGM Source\gmscripts.cpp 215

= paste the whole script into the gmmain.cpp and the class into gmmain.h, this could/should help. I do it this way and everything works.
--------
error C2601: 'GetPoints' : local function definitions are illegal c:\ExScripts\SSGM Source\gmscripts.cpp

= Get_Points would be a valid scripts command.

Over all, the whole code should be placed in one file. You cannot split Reborns' main code because the gmmain.cpp has zero access to the gmscripts.cpp if I am interpreting the include-Syntax right. In the other way, the gmscripts can read gmmain, gmcrate etc.

I probably fail with this post, but I do think it goes in the right direction.

Ok, ive copied and pasted the whole script into the gmmain.cpp and class into gmmain.h but i got 45 errors/warnings
Here they are
HERE!!!!


This account is no longer being active.
Re: Veteran Plugin. [message #335009 is a reply to message #335007] Thu, 12 June 2008 19:20 Go to previous messageGo to next message
nopol10 is currently offline  nopol10
Messages: 1043
Registered: February 2005
Location: Singapore
Karma: 0
General (1 Star)
I think it would be good if you knew and understood the code rather than just copy and paste everything reborn puts up here.

You should check where you pasted the code, because you may have stuffed them into another method/function instead of in a blank space.


nopol10=Nopol=nopol(GSA)

http://i14.photobucket.com/albums/a330/napalmic/siggy.jpg
Re: Veteran Plugin. [message #335010 is a reply to message #335009] Thu, 12 June 2008 19:35 Go to previous messageGo to next message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma: 0
Colonel
I know where every thing goes. Most of the other commands are working. But when i tried doing this one, i had alot of errors. So i just read most of the replies and found this one and said that it might work. But it seems not to.

This account is no longer being active.
Re: Veteran Plugin. [message #335053 is a reply to message #300286] Fri, 13 June 2008 03:21 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
You're missing some functions, and your compiler is complaining about some warnings that in this instance do not really matter.
You're also missing at least one global variable, and I'm pretty sure you've either renamed some mdb scripts, or you've accidently missed a semi-colon or something.



Re: Veteran Plugin. [message #335361 is a reply to message #300286] Sun, 15 June 2008 00:58 Go to previous messageGo to previous message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)
can you tell me where everything goes. does every thing just go in gmmain

http://s18.postimage.org/jc6qbn4k9/bricks3.png
Previous Topic: c++ simple commands
Next Topic: strings
Goto Forum:
  


Current Time: Sun Jun 23 11:49:51 MST 2024

Total time taken to generate the page: 0.01325 seconds