shield trouble

Freeform discussion about anything related to modding Transcendence.
Post Reply
andrewpen
Commonwealth Pilot
Commonwealth Pilot
Posts: 97
Joined: Thu May 31, 2012 12:35 pm
Location: In my lab

how do i get this shield to only recharge once when it goes down and only do it again when it has recharged normally?

Code: Select all

<?xml version="1.0" ?>
<!DOCTYPE TranscendenceExtension
[

<!ENTITY itredunShield					"0xDDAA0093">

]>
<TranscendenceExtension UNID="0xDDAA0093" version="0.98">
<ItemType UNID="&itRedunShield;"
			name=				"Redundent shield generator"
			level=				"10"
			value=				"4000"
			mass=				"2000"
			attributes=			"MajorItem;inc"
			frequency=			"rare"
			
			

			description=		"This is Ships INC's best none military laser resistant shield."

			>

		<Image imageID="&rsItems1;" imageX="192" imageY="0" imageWidth="96" imageHeight="96"/>

		<Shields
				hitPoints=		"90"
				regen=			"20"
				hpBonus=	" +200, -20,+20,-5"
				powerUse=		"1"
				idlePowerUse=	"1"
				>
		</Shields>
		<Events>
    <OnShieldDown>
	(block (shieldLevel)
				(setq shieldLevel (objGetShieldLevel gSource))

					; If shields are down, then restore shields
					(ls shieldLevel 50)
						(block Nil
							(shpRechargeShield gSource 100)
							(objSendMessage gSource Nil "Shields Restored")
							)
				  )
				  
					
				</OnShieldDown>
				
 </Events>
</ItemType>
</TranscendenceExtension>
please help if u can

Ps i have only just started to learn event and function code by playing with it and seeing what works
when life throws you a curve ball catch it and throw it back.
User avatar
Shivan Hunter
Commonwealth Pilot
Commonwealth Pilot
Posts: 81
Joined: Tue Nov 29, 2011 3:07 am

I'm not sure the game can tell the difference between "recharging normally" and your shpRechargeShield call.
I'm here to shift paradigms and chew bubblegum... and I'm all out of bubblegum.

<+The_Shrike> If you install 2 solar panels, you will have 2 solar panels installed.
<DarthGeek|2> :o
andrewpen
Commonwealth Pilot
Commonwealth Pilot
Posts: 97
Joined: Thu May 31, 2012 12:35 pm
Location: In my lab

Ok how could I us that and still make a balanced shield
when life throws you a curve ball catch it and throw it back.
User avatar
Shivan Hunter
Commonwealth Pilot
Commonwealth Pilot
Posts: 81
Joined: Tue Nov 29, 2011 3:07 am

Hmm. Instead of waiting until it recharges normally, you could have a chance that it'll restore fully when it goes down. So get a random number between 1 and 10 and say, check whether it's 3 or less (30% chance), and if so, restore the shield. You could increase this chance and lengthen the delay before it starts recharging normally (if it isn't recharged)- and you could do several of them, where the better shields have better chances of restoring.

Any chance above, say, 50% would probably be unbalanced, especially if it restored the shield fully.
I'm here to shift paradigms and chew bubblegum... and I'm all out of bubblegum.

<+The_Shrike> If you install 2 solar panels, you will have 2 solar panels installed.
<DarthGeek|2> :o
andrewpen
Commonwealth Pilot
Commonwealth Pilot
Posts: 97
Joined: Thu May 31, 2012 12:35 pm
Location: In my lab

Any idea how to code that I have no idea
when life throws you a curve ball catch it and throw it back.
User avatar
Shivan Hunter
Commonwealth Pilot
Commonwealth Pilot
Posts: 81
Joined: Tue Nov 29, 2011 3:07 am

See if this works. I can't test it right now, got a midterm to study for, but it should work. Using a 30% chance (random number between 1 and 10 is greater than or equal to 8)

Code: Select all

	<OnShieldDown>
		(block Nil
			(if (geq (random 1 10) 8)
				(block Nil
					(shpRechargeShield gSource 100)
					(objSendMessage gSource Nil "Shields Restored")
				)
			)
		)
	</OnShieldDown>
I'm here to shift paradigms and chew bubblegum... and I'm all out of bubblegum.

<+The_Shrike> If you install 2 solar panels, you will have 2 solar panels installed.
<DarthGeek|2> :o
andrewpen
Commonwealth Pilot
Commonwealth Pilot
Posts: 97
Joined: Thu May 31, 2012 12:35 pm
Location: In my lab

Shivan Hunter wrote:See if this works. I can't test it right now, got a midterm to study for, but it should work. Using a 30% chance (random number between 1 and 10 is greater than or equal to 8)

Code: Select all

	<OnShieldDown>
		(block Nil
			(if (geq (random 1 10) 8)
				(block Nil
					(shpRechargeShield gSource 100)
					(objSendMessage gSource Nil "Shields Restored")
				)
			)
		)
	</OnShieldDown>
It doesn't work please help :? :(
when life throws you a curve ball catch it and throw it back.
Post Reply