ARMOUR?

Topics regarding Scripting with Reality Factory
Post Reply
User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

ARMOUR?

Post by metal_head » Fri Apr 11, 2008 6:25 pm

I couldn't find this in the manual so I'm asking it here.How can I make an Armour attribute which is not activated from the inventory,but when you pick up an attribute you gain armour?

I put this in the armour.ini:

Code: Select all

[armour1]
attribute = health
melee = 80 5
bullet = 50 5
Bolt = 80 5
Explosion = 80 5
Model = 80 5
Melee = 80 5
Fall = 80 5
JumpOn = 80 5
Actor = 80 5
pistol_shell = 80 5
This in the player.ini

Code: Select all

[armour1]
initial = 100
low = 0
high = 100
and this in the hud.ini

Code: Select all

[armour1]
type = numeric
framex = 10
framey = 10
indicatoroffsetx = 550
indicatoroffsety = 10
font = 7
width = 3
I'm probably mistaking somewere...

User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: ARMOUR?

Post by QuestOfDreams » Fri Apr 11, 2008 10:23 pm

Each armour attribute must be placed in the Inventory as a Use item. When you wish to activate an armour type you go to the Inventory and select it. Any other armour type that may be active will be deactivated.

User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

Re: ARMOUR?

Post by metal_head » Fri Apr 11, 2008 11:19 pm

Yes,but I don't want it in the inventory,I want it like let's say in serious sam to pick it up from the ground and automaticly put it on I have disabled the inventory by the way

Mark in 2-D
Posts: 41
Joined: Wed Mar 07, 2007 10:53 am

Re: ARMOUR?

Post by Mark in 2-D » Thu Sep 11, 2008 2:40 pm

This is something I also want to know how to do. I hope someone can help.

User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: ARMOUR?

Post by Juutis » Thu Sep 11, 2008 3:07 pm

I'm not sure if you can define some kind of default armor but if not, it should be doable with a simple script:

Code: Select all

{
HEALTHATTRIBUTE [health]
ARMORATTRIBUTE [armor]

HEALTHDAMAGE [50.0]
ARMORDAMAGE [20.0]

tmp_health [0]
tmp_damage [0]

Spawn[ ()
{
	LowLevel("setup");
} ]

setup[ ()
{
	PawnRender(false);
	tmp_health = GetAttribute(HEALTHATTRIBUTE,"Player");

	think = "run";
} ]

run[ ()
{
	ThinkTime = 0;

	if((GetAttribute(HEALTHATTRIBUTE,"Player") < tmp_health) and (GetAttribute(ARMORATTRIBUTE,"Player") > 0))
	{
		tmp_damage = tmp_health - GetAttribute(HEALTHATTRIBUTE,"Player");

		ModifyAttribute(HEALTHATTRIBUTE,tmp_damage*(100-HEALTHDAMAGE)/100,"Player");
		ModifyAttribute(ARMORATTRIBUTE,-tmp_damage*ARMORDAMAGE/100,"Player");
	}

	if(GetAttribute(HEALTHATTRIBUTE,"Player") != tmp_health)
	{
		tmp_health = GetAttribute(HEALTHATTRIBUTE,"Player");
	}

} ]

}
HEALTHATTRIBUTE and ARMORATTRIBUTE are pretty obvious, I think. HEALTHDAMAGE and ARMORDAMAGE are the factors for the damage taken by health and armor. 100 = full damage and 0 = no damage. So for example:

Code: Select all

HEALTHDAMAGE [50.0]
ARMORDAMAGE [20.0]
Means that if you have armor, the damage your health takes is 50% of original damage while the armor takes 20% of the damage. So if you take 50 damage in total, your health will take 25 damage and armor 10 damage. Setting both to 0 would make you invulnerable and 100 would make your armor useless as you're taking full damage with or without armor.


***EDIT***
Note: This script won't reduce damage if it's greater than your current health. So if you have 20 health and you receive 50 damage you're going to die, no matter what. That's because the script heals the player after the damage is dealt.
Pain is only psychological.

Post Reply