Hi! Welcome to the forum for Platinum Arts Sandbox Free 3D Game Maker. I currently have the forums locked as I am attempting to properly update them.

In the meantime please join the new Discord Server!

If you have any questions please e-mail me through the Platinum Arts website.

Check for RPG character Health

Having issues not related to a specific Sandbox game mode? Get help here!
Please also read the rules for support when posting support requests.
Failure to comply with the forum rules may result in your topic being locked without resolution.
Locked
porings
Member
Member
Posts: 12
Joined: June 28th, 2009, 6:04 am
Name: poring
IRC Username: poring

Check for RPG character Health

Post by porings »

Any help is greatly appreciated. Thx

1.Anyone here knows where can i find the variable which sets the health of our characters in RPG? For example i wanna check their Health(HP) : If they have full health they will give you items. (Spawned characters)

I realised that the max health of characters are controlled by many status eg endurance strength and etc. But surely there will be a variable to tell you the current health of the particular spawned character?

2. About the TAB in RPG it will show the Character Stats right. Where can i find the script which shows the gui? is it in the source code? If so where is it?

Thx everyone
Hirato
Developer
Developer
Posts: 689
Joined: May 30th, 2009, 1:23 pm
IRC Username: hirato

Re: Check for RPG character Health

Post by Hirato »

1.
it's not possible at the moment, we intend to supersede the current RPG though....
if this functionality is needed, add the following line into rpgscript.cpp

Code: Select all

	NF(char, health,	-1,		0xFFFFFF)
you'd use r_char_get_health to get the health of the current entity
don't forget to compile

2. in rpggui.cpp
This is not a url, clicking it is pointless
porings
Member
Member
Posts: 12
Joined: June 28th, 2009, 6:04 am
Name: poring
IRC Username: poring

Re: Check for RPG character Health

Post by porings »

Hey Hirato, thx for your help. But i can't compile, build or rebuild the sandbox. I've been trying all day. I have these problems (errors on RPG Platinum Arts Sandbox 2.5 src)
1.

Code: Select all

-------------- Build: ssp in Sandbox ---------------

Precompiling header: ..\shared\cube.h
Compiling: ..\engine\bih.cpp
Compiling: ..\engine\blend.cpp
Compiling: ..\engine\blob.cpp
Compiling: ..\engine\client.cpp
Compiling: ..\engine\command.cpp
Compiling: ..\engine\console.cpp
Compiling: ..\engine\cubeloader.cpp
Compiling: ..\engine\decal.cpp
Compiling: ..\engine\dynlight.cpp
Compiling: ..\engine\glare.cpp
Compiling: ..\engine\grass.cpp
Compiling: ..\engine\lightmap.cpp
Compiling: ..\engine\main.cpp
Compiling: ..\engine\material.cpp
Compiling: ..\engine\menus.cpp
Compiling: ..\engine\movie.cpp
Compiling: ..\engine\normal.cpp
Compiling: ..\engine\octa.cpp
Compiling: ..\engine\octaedit.cpp
Compiling: ..\engine\octarender.cpp
Compiling: ..\engine\pch.cpp
Compiling: ..\engine\physics.cpp
Compiling: ..\engine\pvs.cpp
Compiling: ..\engine\rendergl.cpp
Compiling: ..\engine\rendermodel.cpp
Compiling: ..\engine\renderparticles.cpp
Compiling: ..\engine\rendersky.cpp
Compiling: ..\engine\rendertext.cpp
Compiling: ..\engine\renderva.cpp
Compiling: ..\engine\server.cpp
Compiling: ..\engine\serverbrowser.cpp
Compiling: ..\engine\shader.cpp
Compiling: ..\engine\shadowmap.cpp
Compiling: ..\engine\sound.cpp
Compiling: ..\engine\texture.cpp
Compiling: ..\engine\ui.cpp
Compiling: ..\engine\water.cpp
Compiling: ..\engine\world.cpp
Compiling: ..\engine\worldio.cpp
Compiling: ..\shared\crypto.cpp
Compiling: ..\engine\3dgui.cpp
Compiling: ..\shared\geom.cpp
Compiling: ..\shared\stream.cpp
Compiling: ..\shared\tools.cpp
Compiling: ..\shared\zip.cpp
Compiling: ..\sspgame\ssp.cpp
In file included from D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\shared\cube.h:1:
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\sspgame\/sspgame.h: In function 'void game::gameplayhud(int, int)':
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\sspgame\/sspgame.h:902: warning: unused variable 'top'
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\sspgame\/sspgame.h:902: warning: unused variable 'left'
Compiling: ..\sspgame\sspent.cpp
Compiling: ..\sspgame\sspentities.cpp
Compiling: ..\sspgame\sspmonster.cpp
Compiling: ..\sspgame\ssprender.cpp
Compiling: ..\sspgame\sspstubs.cpp
Compiling: ..\sspgame\sspweapons.cpp
Compiling: SDL_win32_main.c
Compiling: sandbox.rc
Linking executable: ..\..\bin\sandbox_ssp.exe
Output size is 1.83 MB

-------------- Build: fps in Sandbox ---------------

Compiling: ..\fpsgame\ai.cpp
Compiling: ..\fpsgame\client.cpp
Compiling: ..\fpsgame\entities.cpp
Compiling: ..\fpsgame\fps.cpp
Compiling: ..\fpsgame\monster.cpp
Compiling: ..\fpsgame\movable.cpp
Compiling: ..\fpsgame\pch.cpp
Compiling: ..\fpsgame\render.cpp
Compiling: ..\fpsgame\scoreboard.cpp
Compiling: ..\fpsgame\server.cpp
Compiling: ..\fpsgame\waypoint.cpp
Linking executable: ..\..\bin\sandbox_fps.exe
Output size is 2.10 MB

-------------- Build: rpg in Sandbox ---------------

Compiling: ..\rpggame\pch.cpp
Compiling: ..\rpggame\rpg.cpp
Compiling: ..\rpggame\rpgent.cpp
In file included from D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\shared\cube.h:5:
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\rpggame\/rpggame.h:1253: error: ISO C++ forbids declaration of 'rpgobj' with no type
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\rpggame\/rpggame.h:1253: error: expected ';' before '*' token
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\rpggame\/rpggame.h:1256: error: 'rpgobj' is not a type
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\rpggame\/rpggame.h: In constructor 'mproj::mproj(vec, vec, int*, float)':
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\rpggame\/rpggame.h:1256: error: class 'mproj' does not have any field named 'weapon'
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\rpggame\/rpggame.h: At global scope:
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\rpggame\/rpggame.h:1261: error: redefinition of 'struct rpgent'
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\rpggame\/rpggame.h:511: error: previous definition of 'struct rpgent'
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\rpggame\/rpggame.h:1396: error: expected unqualified-id at end of input
Process terminated with status 1 (4 minutes, 47 seconds)
7 errors, 2 warnings
I'm using Code::Blocks 8.02

Many errors too if i build the dev's version straight away without modifying.

Code: Select all

-------------- Build: ssp in Sandbox ---------------

Compiling: ..\engine\cubeloader.cpp
In file included from D:\DONT TOUCH!!!!\Platinum Arts Sandbox\Copy of PlatinumArtsSandbox2.5\src\shared\cube.h:1:
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\Copy of PlatinumArtsSandbox2.5\src\engine\/engine.h: In member function 'void cubeloader::create_ent(cubeloader::c_persistent_entity&)':
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\Copy of PlatinumArtsSandbox2.5\src\engine\/engine.h:723: error: 'struct extentity' has no member named 'attr1'
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\Copy of PlatinumArtsSandbox2.5\src\engine\/engine.h:724: error: 'struct extentity' has no member named 'attr2'
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\Copy of PlatinumArtsSandbox2.5\src\engine\/engine.h:729: error: 'struct extentity' has no member named 'attr3'
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\Copy of PlatinumArtsSandbox2.5\src\engine\/engine.h:729: error: 'struct extentity' has no member named 'attr4'
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\Copy of PlatinumArtsSandbox2.5\src\engine\/engine.h:732: error: 'struct extentity' has no member named 'attr1'
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\Copy of PlatinumArtsSandbox2.5\src\engine\/engine.h:733: error: 'struct extentity' has no member named 'attr3'
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\Copy of PlatinumArtsSandbox2.5\src\engine\/engine.h:733: error: 'struct extentity' has no member named 'attr4'
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\Copy of PlatinumArtsSandbox2.5\src\engine\/engine.h:733: error: 'struct extentity' has no member named 'attr2'
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\Copy of PlatinumArtsSandbox2.5\src\engine\/engine.h:736: error: 'struct extentity' has no member named 'attr3'
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\Copy of PlatinumArtsSandbox2.5\src\engine\/engine.h:737: error: 'struct extentity' has no member named 'attr4'
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\Copy of PlatinumArtsSandbox2.5\src\engine\/engine.h:740: error: 'struct extentity' has no member named 'attr5'
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\Copy of PlatinumArtsSandbox2.5\src\engine\/engine.h: At global scope:
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\Copy of PlatinumArtsSandbox2.5\src\engine\/engine.h:1025: warning: '__dummy_importcube' defined but not used
Process terminated with status 1 (0 minutes, 8 seconds)
11 errors, 1 warnings
For the tip you gave, should i put it here? in rpgscript.cpp

Code: Select all

	NI(item, slots,		0,		SLOT_MAX - 1)
	NI(item, weight,	0,		1000)
	NS(item, drop)
	NS(item, equip)

	NI(spell, cooldown,	0,		100000)
	NI(spell, range,	2,		1024)
	NI(spell, type,		STYPE_TARGET,	STYPE_SELF)
	NI(spell, cost,		0,		100000)
	NI(spell, castdelay,	0,		20000)
	NI(spell, effect,	0,		0x7FFFFFFF)
	NI(spell, fade,		1,		1000000)
	NI(spell, gravity,	-10000,		10000)

	NF(char, health,   -1,      0xFFFFFF)
2. I have another question. Is there anyway i can make spawned characters chase the player without really know how to edit source? Some easy editing like adding a line of code?
I'm not so good at C++. Still in baby steps of learning.

3. If i use r_char_get_health will it show me the value of health straight away? eg 160 at max health

4. By "supersede rpg" you mean that the devs are not going to upgrade or develope it anymore?

Thx for your time Hirato and others who can help. I hope i'm not troubling everyone.
User avatar
GR1M
Support Team
Support Team
Posts: 1305
Joined: August 22nd, 2009, 4:35 pm
Name: Luke
IRC Username: Gr1m
Location: Texas
Contact:

Re: Check for RPG character Health

Post by GR1M »

I also have been having trouble compiling SVN version of Sandbox.
Image
Want a user bar like this one? PM Leo
Hirato
Developer
Developer
Posts: 689
Joined: May 30th, 2009, 1:23 pm
IRC Username: hirato

Re: Check for RPG character Health

Post by Hirato »

1) you placed the code in the right place.
this mproj is incredibly suspicious, as this is only inside the master chef ogro RPG, I suspect you tried to merge the two sometime before this

the svn error is just an outdated project file

2) No, not at the moment

3) r_char_get_health will return the current entity's current health; if he's at full health and the maximum is 160, yes :P

4) yes and no, while it does mean we're not working on it anymore, it also means we're working on another one to replace it
This is not a url, clicking it is pointless
porings
Member
Member
Posts: 12
Joined: June 28th, 2009, 6:04 am
Name: poring
IRC Username: poring

Re: Check for RPG character Health

Post by porings »

Hey Hirato. Sorry for the late reply. I've just finished my exams.

I've realised that i mixed up my src files so i extracted everything again from the official platinum arts sandbox 2.5.
I build it without any changes and i get an error.


-------------- Build: ssp in Sandbox ---------------

Code: Select all

-------------- Build: ssp in Sandbox ---------------

Compiling: ..\engine\bih.cpp
In file included from C:\Documents and Settings\Administrator\Desktop\PlatinumArtsSandbox2.5\PlatinumArtsSandbox2.5\src\shared\cube.h:1:
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\engine\/engine.h: In member function 'void BIH::build(vector<BIHNode>&, ushort*, int, int)':
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\engine\/engine.h:846: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://www.mingw.org/bugs.shtml> for instructions.
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings
 
since i cannot proceed, i edited rpgscript.cpp as follows. The edit is underlined.

Code: Select all

#include "rpggame.h"

/*
This file is to contain ALL function exposed to cubescript that allow the scripting and configuration of entities and game objects
this involves simple things like setting the colour of a projectile to more complex ones like setting dialogue
*/

namespace rpgobj
{
	rpgent *selected;
	void renumerate()
	{
		int num = 0;
		loopv(game::rpgobjs)
		{
			rpgent *d = game::rpgobjs[i];
			d->temp.id = num++;

			rpgchar *c = d->getchar();
			if(c)
			{
				loopvj(c->inventory)
				{
					c->inventory[j]->temp.id = num++;
				}
				loopvj(c->spellbook)
				{
					c->spellbook[j]->temp.id = num++;
				}
			}
		}
		game::lastid = num - 1;
	}

	rpgent *getent(int who)
	{
		loopv(game::rpgobjs)
		{
			if(game::rpgobjs[i]->temp.id == who)
				return game::rpgobjs[i];

			rpgchar *d = game::rpgobjs[i]->getchar();

			if(d)
			{
				loopvj(d->inventory)
				{
					rpgent *item = d->inventory[j];
					if(item->temp.id == who)
						return item;
				}
				loopvj(d->spellbook)
				{
					rpgent *spell = d->spellbook[j];
					if(spell->temp.id == who)
						return spell;
				}
			}
		}

		return NULL;
	}

	int getident(rpgent *d)
	{
		if(d) return d->temp.id;
		return -1;
	}

	ICOMMAND(r_select, "i", (int *id),
		selected = getent(*id);
	);

	ICOMMAND(r_addeffect, "iiii", (int *t, int *s, int *d, int *r),
		if(!selected) return;
		rpgent *e = selected;
		e->effects.add(new status(*t, *s, *d, *r));
	);

	ICOMMAND(r_addowneffect, "iii", (int *t, int *s, int *r),
		if(!selected || selected->etype != ENT_ITEM) return;
		status *st = new status(*t, *s, 0, *r);
		st->duration = -1;

		((rpgitem *) selected->subtype)->owneffects.add(st);
	);


	ICOMMAND(r_additem, "s", (const char *s),
		if(!selected) return;
		rpgent *e = selected;

		if(!e->getchar()) return;
		rpgent *item = new rpgent(DEFAULTMODEL, ++game::lastid);
		selected = item;

		defformatstring(ds)("spawn_%s", s);
		execute(ds);

		if(item->etype == ENT_ITEM)
		{
			e->getchar()->inventory.add(item);
		}
		else if(item->etype == ENT_SPELL)
		{
			e->getchar()->spellbook.add(item);
		}
		else
		{
			conoutf("r_additem: Error adding item to \"%s\", \"%s\" is not a valid item type", e->name, item->name);
			delete item;
		}

		selected = e;
	);

	///TODO WRITEME
	//ICOMMAND(r_applyeffect, "iiiii", ent effect strength duration element

	ICOMMAND(r_destroy, "", (),
		if(selected == game::player1)
		{
			conoutf("Warning: a script just *tried* to delete the player");
			return;
		}

		loopv(game::rpgobjs)
		{
			if(game::rpgobjs[i] == selected)
			{
				delete game::rpgobjs[i];
				game::rpgobjs.remove(i);
				return;
			}
			rpgchar *c = game::rpgobjs[i]->getchar();
			if(c)
			{
				loopvj(c->inventory)
				{
					if(c->inventory[j] == selected)
					{
						game::rpgobjs[i]->dequip(c->inventory[j]);
						delete c->inventory[j];
						c->inventory.remove(j);
						return;
					}
				}
				loopvj(c->spellbook)
				{
					if(c->spellbook[j] == selected)
					{
						delete c->spellbook[j];
						c->spellbook.remove(j);
						return;
					}
				}
			}
		 }

		 selected = NULL;
		 game::hover = NULL;
	);

	 ICOMMAND(r_drop, "", (),
		loopv(game::rpgobjs)
		{
			rpgent *e = game::rpgobjs[i];
			rpgchar *ec = e->getchar();
			if(ec)
			{
				loopvj(ec->inventory)
				{
					if(ec->inventory[j] == selected)
					{
						e->drop(ec->inventory[j]);
						return;
					}
				}
				loopvj(ec->spellbook)
				{
					if(ec->spellbook[j] == selected)
					{
						e->drop(ec->spellbook[j]);
						return;
					}
				}
			}
		}
	);

	ICOMMAND(r_loopinv, "s", (char *s),
		rpgent *ent = selected;
		if(!selected || selected->etype != ENT_CHAR || !s[0])
			return;

		rpgchar *c = (rpgchar *) ent->subtype;
		loopv(c->inventory)
		{
			selected = c->inventory[i];
			execute(s);
		}
		loopv(c->spellbook)
		{
			selected = c->spellbook[i];
			execute(s);
		}
		selected = ent;
	);

	ICOMMAND(r_pickup, "i", (int *i),
		rpgent *d = getent(*i);
		if(!selected || !d) return;

		selected->pickup(d);
	);

	ICOMMAND(r_say, "ss", (const char *t, const char *s),
		if(!selected) return;
		selected->dialogue.add(new rpgchat(newstring(s), newstring(t)))
	);

	ICOMMAND(r_dist, "i", (int *d),
		rpgent *ent = getent(*d);

		if(!ent || !selected)
		{
			floatret(-1);
			return;
		};

		floatret(ent->o.dist(selected->o));
	);

	ICOMMAND(r_face, "i", (int *d),
		if(!selected) return;
		rpgent *vic = getent(*d);

		vec o = vec(vic->o).sub(selected->o).normalize();

		vectoyawpitch(o, selected->yaw, selected->pitch);
	);

	ICOMMAND(r_kill, "", (int *i),
		if(selected)
			selected->die();
	);

	///TODO WRITEME
	//ICOMMAND(r_reset, "ii" ent 'remove corpse'

	ICOMMAND(r_response, "sis", (const char *t, int *d, const char *s),
		if(!game::hover && !game::hover->dialogue.inrange(game::hover->chatpos)) return; //-1, aka closed will fail

		game::hover->dialogue[game::hover->chatpos]->dests.add(new response(newstring(t), *d, newstring(s)));
	);

	ICOMMAND(r_ressurrect, "i", (int *death),
		if(selected)
			selected->respawn(*death);
	);

	ICOMMAND(r_spawn, "si", (const char *sp, int *in),
		loopv(entities::ents)
		{
			extentity *e = entities::ents[i];
			if(e->type == SPAWN)
			{
				if(e->attr2 == *in)
				{
					selected = new rpgent(DEFAULTMODEL, ++game::lastid);
					game::rpgobjs.add(selected);
					selected->o = e->o;

					defformatstring(ds)("spawn_%s", sp);
					execute(ds);
				}
			}
		}
	);

	ICOMMAND(r_talk, "ii", (int *e, int *d),
		rpgent *r = getent(*e);

		if( !r || (selected != game::player1 && r != game::player1)) return;

		game::hover = r;
		//note -1 is closed
		game::hover->chatpos = *d;
		//the GUI will automatically open, as the chat hook looks for game::selected->chatpos >= 0
	);

	ICOMMAND(r_telemap, "s", (const char *map),
		if(!selected) return;
		if(selected != game::player1)
		{
			//TODO allow other creatures to go to other maps
			//TODO 2; allow nearby creatures that're following the player to go with him (eg, to attack him)
			game::rpgobjs.removeobj(selected);
			selected = NULL;
			return;
		}

		game::transfer = true;
		load_world(map);
	);

	ICOMMAND(r_teleport, "i", (int *i, int *d),
		if(!selected) return;
		entities::teleport(*selected, *d);
	);

	///TODO WRITEME
	//ICOMMAND(r_trigger, "ii" ent status

	///TODO make the below accept 2 arguments, if only 1 is provided, (ie arg2 is NULL), assume it's the last created, otherwise treat the first as the entity ident

	#define N(b, n, f, t, c, c2) ICOMMAND(r_ ## b ## _ ## n, f, (t *i), \
		if(!selected) \
			return; \
			\
		rpg ## b *e = selected->get ## b  (); \
		if(!e) \
			return; \
		c \
	); \
	ICOMMAND(r_get_ ## b ## _ ## n, "", (), \
		if(!selected) return; \
		rpg##b *e = selected->get ## b  (); \
		if(!e) \
			return; \
		c2 \
	)


	#define NI(b, n, min, max) N(b, n, "i", int, e->n = clamp((int)max, (int)min, *i), intret(e->n))
	#define NF(b, n, min, max) N(b, n, "f", float, e->n = clamp((float)max, (float)min, *i), floatret(e->n))
	#define NS(b, n) N(b, n, "s", const char, if(e->n) {delete[] e->n;} e->n = newstring(i), if(e->n) result(e->n))
	#define NB(b, n) N(b, n, "i", int, e->n = *i != 0, intret(e->n))

	NB(object, active);

	NI(item, slots,		0,		SLOT_MAX - 1);
	NI(item, weight,	0,		1000);
	NS(item, drop);
	NS(item, equip);

	NI(spell, cooldown,	0,		100000);
	NI(spell, range,	2,		1024);
	NI(spell, type,		STYPE_TARGET,	STYPE_SELF);
	NI(spell, cost,		0,		100000);
	NI(spell, castdelay,	0,		20000);
	NI(spell, effect,	0,		0x7FFFFFFF);
	NI(spell, fade,		1,		1000000);
	NI(spell, gravity,	-10000,		10000);
	[u]NF(char, health,   -1,      0xFFFFFF);[/u]	#undef N
	#undef NI
	#undef NF
	#undef NS
	#undef NB

	#define N(n, f, t, c, c2) ICOMMAND(r_##n, f, (t *i), \
		rpgent *e = selected; \
		if(!e) return; \
		c; \
	); \
	ICOMMAND(r_get_ ## n, "", (), \
		rpgent *e = selected; \
		if(!e) return; \
		c2 \
	)

	#define NI(n, min, max) N(n, "i", int, e->n = clamp((int)max, (int)min, *i), intret(e->n))
	#define NF(n, min, max) N(n, "f", float, e->n = clamp((float)max, (float)min, *i), floatret(e->n))
	#define NS(n) N(n, "s", const char, if(e->n) {delete[] e->n;} e->n = newstring(i), if(e->n) result(e->n))
	#define NB(n) N(n, "i", int, e->n = *i != 0, intret(e->n))

	N(type, "i", int,
		*i = clamp(ENT_MAX - 1, 0, *i);
		e->cleansubtypes();
		switch(e->etype = *i)
		{
			case ENT_CHAR:
				if(game::rpgobjs.length()-1) e->type = ENT_AI;
				else e->type = ENT_PLAYER;
				e->subtype = new rpgchar();
				break;
			case ENT_ITEM:
				e->type = ENT_INANIMATE;
				e->subtype = new rpgitem();
				break;
			case ENT_SPELL:
				e->type = ENT_INANIMATE;
				e->subtype = new rpgspell();
				break;
			case ENT_OBJECT:
				e->type = ENT_INANIMATE;
				e->subtype = new rpgobject();
				break;
		}
		,
		intret(e->etype);
	);

	NS(icon);
	NS(model);
	NS(name);
	NS(description);
	NS(death);
	NS(interact);
	NS(approach);

	#undef N
	#undef NI
	#undef NF
	#undef NS
	#undef NB

	#define N(n, f, t, c) ICOMMAND(r_proj_##n, f, (t *i), \
		if(!effects.length()) \
		{ \
			conoutf("error: no effects (use r_proj_new)"); \
			return; \
		} \
		projeffect *e = effects[effects.length()-1]; \
		c; \
	);
	#define NI(n, min, max) N(n, "i", int, e->n = clamp((int)max, (int)min, *i))
	#define NF(n, min, max) N(n, "f", float, e->n = clamp((float)max, (float)min, *i))
	#define NS(n) N(n, "s", const char, if(e->n) {delete[] e->n;} e->n = newstring(i))
	#define NB(n) N(n, "i", int, e->n = *i != 0)

	ICOMMAND(r_proj_new, "", (), effects.add(new projeffect()););
	//simplifies variable configuration commands

	NI(basevel,		0,		100000);
	NI(kickback,		-200,		200);
	NI(flags,		0,		PFX_MAX - 1);
	NI(trailpart,		0,		PART_LENS_FLARE - 1);
	NI(trailcol,		0,		0xFFFFFF);
	NI(trailfade,		1,		120000);
	NI(gravity,		-10000,		10000);
	NI(projpart,		0,		PART_LENS_FLARE - 1);
	NI(projcol,		0,		0xFFFFFF);
	NI(lightradius,		32,		4096);
	NI(lightcolour,		-0xFFFFFF,	0xFFFFFF);
	NI(deathpart,		0,		PART_LENS_FLARE - 1);
	NI(deathpartcol,	0,		0xFFFFFF);
	NI(deathfade,		1,		120000);
	NI(deathdecal,		-1,		DECAL_RIPPLE);
	NI(deathlightflags,	0,		7);
	NI(deathlightinitcol,	-0xFFFFFF,	0xFFFFFF);
	NI(deathlightfade,	1,		120000);

	NF(trailsize,		0.01f,		100);
	NF(projsize,		0.01f,		100);
	NF(deathpartsize,	0.01f,		100);


	NS(mdl);

	#undef NB
	#undef NI
	#undef NF
	#undef NS
	#undef N
};
So after that i compile the rpgscript.cpp and rebuild the whole thing again. I cut the bin folder and rebuild it.
( One question : Is it necessary to rebuild? Or shud i just compile it? )

I have 0 errors. but 11 warnings.

Report:

Code: Select all

-------------- Build: ssp in Sandbox ---------------

Precompiling header: ..\shared\cube.h
Compiling: ..\engine\bih.cpp
Compiling: ..\engine\blend.cpp
Compiling: ..\engine\blob.cpp
Compiling: ..\engine\client.cpp
Compiling: ..\engine\command.cpp
Compiling: ..\engine\console.cpp
Compiling: ..\engine\cubeloader.cpp
Compiling: ..\engine\decal.cpp
Compiling: ..\engine\dynlight.cpp
Compiling: ..\engine\glare.cpp
Compiling: ..\engine\grass.cpp
Compiling: ..\engine\lightmap.cpp
Compiling: ..\engine\main.cpp
Compiling: ..\engine\material.cpp
Compiling: ..\engine\menus.cpp
Compiling: ..\engine\movie.cpp
Compiling: ..\engine\normal.cpp
Compiling: ..\engine\octa.cpp
Compiling: ..\engine\octaedit.cpp
Compiling: ..\engine\octarender.cpp
Compiling: ..\engine\pch.cpp
Compiling: ..\engine\physics.cpp
Compiling: ..\engine\pvs.cpp
Compiling: ..\engine\rendergl.cpp
Compiling: ..\engine\rendermodel.cpp
Compiling: ..\engine\renderparticles.cpp
Compiling: ..\engine\rendersky.cpp
Compiling: ..\engine\rendertext.cpp
Compiling: ..\engine\renderva.cpp
Compiling: ..\engine\server.cpp
Compiling: ..\engine\serverbrowser.cpp
Compiling: ..\engine\shader.cpp
Compiling: ..\engine\shadowmap.cpp
Compiling: ..\engine\sound.cpp
Compiling: ..\engine\texture.cpp
Compiling: ..\engine\ui.cpp
Compiling: ..\engine\water.cpp
Compiling: ..\engine\world.cpp
Compiling: ..\engine\worldio.cpp
Compiling: ..\shared\crypto.cpp
Compiling: ..\engine\3dgui.cpp
Compiling: ..\shared\geom.cpp
Compiling: ..\shared\stream.cpp
Compiling: ..\shared\tools.cpp
Compiling: ..\shared\zip.cpp
Compiling: ..\sspgame\ssp.cpp
In file included from D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\shared\cube.h:1:
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\sspgame\/sspgame.h: In function 'void game::gameplayhud(int, int)':
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\sspgame\/sspgame.h:902: warning: unused variable 'top'
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\sspgame\/sspgame.h:902: warning: unused variable 'left'
Compiling: ..\sspgame\sspent.cpp
Compiling: ..\sspgame\sspentities.cpp
Compiling: ..\sspgame\sspmonster.cpp
Compiling: ..\sspgame\ssprender.cpp
Compiling: ..\sspgame\sspstubs.cpp
Compiling: ..\sspgame\sspweapons.cpp
Compiling: SDL_win32_main.c
Compiling: sandbox.rc
Linking executable: ..\..\bin\sandbox_ssp.exe
Output size is 1.83 MB

-------------- Build: fps in Sandbox ---------------

Compiling: ..\fpsgame\ai.cpp
Compiling: ..\fpsgame\client.cpp
Compiling: ..\fpsgame\entities.cpp
Compiling: ..\fpsgame\fps.cpp
Compiling: ..\fpsgame\monster.cpp
Compiling: ..\fpsgame\movable.cpp
Compiling: ..\fpsgame\pch.cpp
Compiling: ..\fpsgame\render.cpp
Compiling: ..\fpsgame\scoreboard.cpp
Compiling: ..\fpsgame\server.cpp
Compiling: ..\fpsgame\waypoint.cpp
Linking executable: ..\..\bin\sandbox_fps.exe
Output size is 2.10 MB

-------------- Build: rpg in Sandbox ---------------

Compiling: ..\rpggame\pch.cpp
Compiling: ..\rpggame\rpg.cpp
Compiling: ..\rpggame\rpgent.cpp
Compiling: ..\rpggame\rpgentities.cpp
Compiling: ..\rpggame\rpggui.cpp
Compiling: ..\rpggame\rpghud.cpp
Compiling: ..\rpggame\rpgio.cpp
Compiling: ..\rpggame\rpgobj.cpp
Compiling: ..\rpggame\rpgproj.cpp
Compiling: ..\rpggame\rpgrender.cpp
Compiling: ..\rpggame\rpgscript.cpp
Compiling: ..\rpggame\rpgstats.cpp
Compiling: ..\rpggame\rpgstubs.cpp
Linking executable: ..\..\bin\sandbox_rpg.exe
Output size is 1.90 MB

-------------- Build: movie in Sandbox ---------------

Compiling: ..\moviecube\action.cpp
In file included from D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\shared\cube.h:8:
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\moviecube\/modeinfo.h:39: warning: 'gamemodes' defined but not used
Compiling: ..\moviecube\characterinfo.cpp
In file included from D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\shared\cube.h:1:
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\moviecube\/modeinfo.h:39: warning: 'gamemodes' defined but not used
Compiling: ..\moviecube\client.cpp
Compiling: ..\moviecube\clientmode.cpp
In file included from D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\shared\cube.h:7:
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\moviecube\/modeinfo.h:39: warning: 'gamemodes' defined but not used
Compiling: ..\moviecube\control.cpp
In file included from D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\shared\cube.h:8:
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\moviecube\/modeinfo.h:39: warning: 'gamemodes' defined but not used
Compiling: ..\moviecube\entities.cpp
In file included from D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\shared\cube.h:1:
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\moviecube\/game.h: In function 'vector<extentity*>& entities::getents()':
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\moviecube\/game.h:711: warning: dereferencing type-punned pointer will break strict-aliasing rules
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\moviecube\/modeinfo.h: At global scope:
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\moviecube\/modeinfo.h:39: warning: 'gamemodes' defined but not used
Compiling: ..\moviecube\mapentities.cpp
In file included from D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\shared\cube.h:1:
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\moviecube\/modeinfo.h:39: warning: 'gamemodes' defined but not used
Compiling: ..\moviecube\movable.cpp
Compiling: ..\moviecube\moviecube.cpp
Compiling: ..\moviecube\pch.cpp
In file included from D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\shared\cube.h:1:
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\moviecube\/modeinfo.h:39: warning: 'gamemodes' defined but not used
Compiling: ..\moviecube\render.cpp
In file included from D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\shared\cube.h:1:
D:\DONT TOUCH!!!!\Platinum Arts Sandbox\PlatinumArtsSandbox2.5\src\moviecube\/modeinfo.h:39: warning: 'gamemodes' defined but not used
Compiling: ..\moviecube\server.cpp
Linking executable: ..\..\bin\sandbox_movie.exe
Output size is 1.94 MB
Process terminated with status 0 (6 minutes, 51 seconds)
0 errors, 11 warnings
After all that. I'm still not able to use the command. And i can't shoot spells with right click. Is there any thing that i've done wrong?

One more thing. How do i use the command r_char_get_health. I get unknown command. i edited in my cfg file as follows.
value = [ echo $r_char_get_health ]
so if i type /value ingame shud it return 160?

Anyone out there who can help me i greatly appreciate it.
Locked