Page 1 of 1

questions about shields

Posted: 19 Sep 2010, 13:17
by raaar
I'm having problems trying to get shields to work

what i want is a simple startcraft-like shield: with radius just slighly bigger than the unit, starts fully charged, and stops 100% of all enemy weapons' dmg until depleted.

i read the wikis
http://springrts.com/wiki/Shield_Interception_Tag_Use
http://springrts.com/wiki/All_Weapons_v ... lt%2C_type
http://springrts.com/wiki/Weapon_Variables
(first and second are inconsistant..)

Code: Select all

[PEEWEE_EMG]
{
	ID=16;
	name=E.M.G.;
	explosiongenerator=custom:EMGFLASH;
	rendertype=4; //0 for laser//
	// using texture now color=2;//
	cegTag=PEEWEESHINE;
	
	Texture1=emg;
	Texture2=null;
	Texture3=null;
	Texture4=null;
	stages=8;
  	separation=0.5;
  	alphadecay=0.0;
  	sizedecay=-0.01;
  	nogap=1;
	rgbcolor=1 0.9 0.3;
	size=2.0;
	intensity=0.5;
	
	lineofsight=1;
	turret=1;
	range=195;
	reloadtime=0.1;
	weapontimer=1;
	weaponvelocity=600;
	//sprayangle=924;
	sprayangle=1448;//1848
	areaofeffect=8;
	burst=1;
	burstrate=0.1;
	soundstart=armsml2;
	soundhit=lasrhit1;
	soundtrigger=1;
	tolerance=3000;
	startsmoke=0;
	endsmoke=0;
	explosiongaf=fx;
	waterexplosiongaf=fx;
	waterexplosionart=h2oboom1;
	lavaexplosiongaf=fx;
	lavaexplosionart=lavasplashsm;
	InterceptedByShieldType=1;
	[DAMAGE]
	{
		default=6;//dps most be 60 50 now
    group_invincible=1;
	}
}

[sphere_golem_shield]
{
	name=Energy shield;
	IsShield=1;
	ShieldRepulsor=0;
	SmartShield=1;
	ExteriorShield=0;
	VisibleShield=1;
	VisibleShieldRepulse=0;
	ShieldEnergyUse=100;
	ShieldForce=3000;
	ShieldRadius=68;
	ShieldMaxSpeed=500;
	ShieldPower=3000;
	ShieldStartingPower=3000;
	ShieldPowerRegen=30;
	ShieldPowerRegenEnergy=100;
	ShieldInterceptType=1;
	ShieldGoodColor=1.0 0.3 0.3;
	ShieldBadColor=0.5 0.5 0.5;
	ShieldAlpha=0.5;
	visibleShieldHitFrames=5;
	[DAMAGE]
	{
		default=10;
	}
}
gave the golem the shield, and wanted it to stop all weapons by default. According to the first wiki...it should at least stop the peewee's emg....but it doesn't. And it's radius is twice as big as the unit's collision box.

So, what do i need to do to make it work like i want, preferably without needing to add "InterceptedByShieldType" to every weapon.

Is there any way to make the shield "flash" when hit?

Re: questions about shields

Posted: 19 Sep 2010, 15:30
by raaar
It seems it's blocking plasma type shots, so maybe the second wiki page has the correct info.

It also seems that even if the shots are destroyed by the shield, if the unit itself is within the aoe of the explosion, it gets damaged (as in...shields can make shots explode on collision but do not block aoe dmg)

Re: questions about shields

Posted: 19 Sep 2010, 22:36
by Forboding Angel
Yes that is correct. Aoe is not blocked.

And interceptshieldtype is needed for every weapon.

Re: questions about shields

Posted: 19 Sep 2010, 23:31
by raaar
Forboding Angel wrote:Yes that is correct. Aoe is not blocked.

And interceptshieldtype is needed for every weapon.
is there really no way to block aoe dmg?

maybe some lua would enable to get around it...

but that doesn't make much sense...kinda weird that they put some complicated shield behaviour in the engine and missed such an obvious thing?

Re: questions about shields

Posted: 19 Sep 2010, 23:48
by Beherith
Moved topic to games and mods.

Re: questions about shields

Posted: 20 Sep 2010, 12:11
by Forboding Angel
Long story short, the calculations needed to block aoe would grind your computer to a halt, therefore, they were left out.

Re: questions about shields

Posted: 20 Sep 2010, 12:16
by ==Troy==
Thats something that I was puzzling over previously too.

Is there a function to at least simply "consume" the projectile? without any damage done whatsoever? It would be at least a good alternative.

Re: questions about shields

Posted: 20 Sep 2010, 19:15
by Forboding Angel
Now that's an interesting idea. Perhaps it could be lua'd?

Re: questions about shields

Posted: 21 Sep 2010, 03:28
by raaar
Forboding Angel wrote:Long story short, the calculations needed to block aoe would grind your computer to a halt, therefore, they were left out.
this doesn't make sense.

a hackish way around it, for single unit shields: when unit gets damaged by aoe(or direct hit), drain from shield first and only after depletion drain hp.

another way: compute distance between blast origin and shield surface(nearest point of impact) and drain from the shield accordingly. If shield is depleted, apply remaining aoe damage to units within(*) the shield normally.

(*)unit is considered to be within shield if:
"distance from unit origin to shield origin" + "largest unit dimension" < "shield radius"

the point of impact between aoe and shields could also be used as a reference to draw "hit" effects on it.

EDIT:
math :mrgreen:
shield origin=(sx, sy, sz)
blast origin=(bx,by,bz)
shield radius=R

distance to shield surface = sqrt((sx-bx)^2+(sy-by)^2+(sz-bz)^2) - R

Re: questions about shields

Posted: 21 Sep 2010, 05:02
by KingRaptor
A shield gadget by Argh.

Disclaimer: Not tested personally, may not work optimally (or at all) as-is.

EDIT: Though if you're going to just depend on the engine shields with AoE blocking added, without considering stuff like special damages to shields, it's pretty trivial to use the UnitDamaged() callin in a Lua gadget to transfer the damage to the shield battery before unit HP.