Help me, my Enchant center function doesn't working :(

Freeform discussion about anything related to modding Transcendence.
Post Reply
Cyclone
Anarchist
Anarchist
Posts: 10
Joined: Sun Jun 12, 2011 2:03 am

I want to make ability to enchant weapon in the station, but it doesn't working when i played with it :(
The code like this

Code: Select all

				<EnchantCenter>
					<Initialize>
						(block (itemType)
							(setq gItem (scrGetItem gScreen))
							(setq itemType (itmGetUNID gItem))
						)
					</Initialize>

					<Actions>
						<Action name="Enchant" key="E" >
							(switch
								(eq itemType 0x0100 0;)
									(block (intEnhanceWeaponUse)
										(intEnhanceWeaponUse 0x0100 0 "is more powerful")
										)
									)
								(eq itemType 0x0100 1;)
									(block (intEnhanceWeaponUse)
										(intEnhanceWeaponUse 0x0100 1 "is more powerful")
										)
									)
								(eq itemType 0x0100 2;)
									(block (intEnhanceWeaponUse)
										(intEnhanceWeaponUse 0x0100 2 "is more powerful")
										)
									)
								(eq itemType 0x0100 3;)
									(block (intEnhanceWeaponUse)
										(intEnhanceWeaponUse 0x0100 3 "is more powerful")
										)
									)
								(eq itemType 0x0100 4;)
									(block (intEnhanceWeaponUse)
										(intEnhanceWeaponUse 0x0100 4 "is more powerful")
										)
									)
								(eq itemType 0x0100 5;)
									(block (intEnhanceWeaponUse)
										(intEnhanceWeaponUse 0x0100 5 "is more powerful")
										)
									)
								)
							)
						</Action>

						<Action name="Done" cancel="1" key="N">
							<ShowPane pane="Default"/>
						</Action>

					</Actions>

				</EnchantCenter>
Anybody help me!!!
TVR
Militia Commander
Militia Commander
Posts: 334
Joined: Sat Sep 08, 2012 3:26 am

Code: Select all

(eq itemType 0x0100 0;)
There are around 2-3 things wrong with this statement, I may not be able to name all of them.

First, '0x0100' (4096 in base-10) and '0;' will never be equal, therefore it will never execute.

Second, itemType is a UNID, you can't check the enhancement status of every single instance of that itemType in the entire game. instead (itmIsEnhanced) takes an itemStruct, a data structure that denotes a specific instance of an item.

Third... never mind, just replace the above and all other derivatives with this:

Code: Select all

(not (itmIsEnhanced gItem))
Also, I don't think that's how (intEnhanceWeaponUse) is called, could you please explain what you are trying to do to the weapon?
Fiction is reality, simplified for mass consumption.
PGP: 0x940707ED, 5DB8 4CB4 1EF5 E987 18A0 CD99 3554 3C13 9407 07ED
Bitcoin: 1LLDr7pnZDjXVT5mMDrkqRKkAPByPCQiXQ
Cyclone
Anarchist
Anarchist
Posts: 10
Joined: Sun Jun 12, 2011 2:03 am

TVR wrote:

Code: Select all

(eq itemType 0x0100 0;)
There are around 2-3 things wrong with this statement, I may not be able to name all of them.

First, '0x0100' (4096 in base-10) and '0;' will never be equal, therefore it will never execute.

Second, itemType is a UNID, you can't check the enhancement status of every single instance of that itemType in the entire game. instead (itmIsEnhanced) takes an itemStruct, a data structure that denotes a specific instance of an item.

Third... never mind, just replace the above and all other derivatives with this:

Code: Select all

(not (itmIsEnhanced gItem))
Also, I don't think that's how (intEnhanceWeaponUse) is called, could you please explain what you are trying to do to the weapon?
I want my auton (which my auton can transform into station too) can enhance any weapon. I use 0x0100 x until the end because i use the code from UsefulItems.xml (Transcendence file) which some of weapon enhancer use 0x0100 x.

For the first of your statement, what did you mean?

For the second of your statement, should i use (ItmIsEnhanced) to compatible with all 0x0100 x codes?

For the third of your statement, did you mean i must change the "action" for enhance the weapons?
Cyclone
Anarchist
Anarchist
Posts: 10
Joined: Sun Jun 12, 2011 2:03 am

Please i need u all. I want my mod working :(
TVR
Militia Commander
Militia Commander
Posts: 334
Joined: Sat Sep 08, 2012 3:26 am

Change everything in <Action name="Enchant" key="E" > to this:

Code: Select all

(block (notFound)
	; Install
	(setq notFound True)
	(objEnumItems gSource "w~lI" theItem
		(block (weaponItem)
			(setq weaponItem theItem)
			(if (and 
					notFound 
					(leq (itmGetLevel weaponItem) 10)
					(eq (shpGetItemDeviceName gSource weaponItem) 0)
					)
				(block (newMods)
					(setq newMods 0x0100)
					(switch
						; If the item is damaged, we repair it
						(and (itmIsDamaged weaponItem) (ls newMods 0x8000))
							(block Nil
								(shpRepairItem gSource theItem)
								(objSendMessage gSource Nil (cat (itmGetName weaponItem 33) " has been repaired"))
								)

						; Enhance the weapon
						(block (result)
							(setq result (shpEnhanceItem gSource theItem newMods))
							(objSendMessage gSource Nil (intItemEnhanceStatus result (cat "Your " (itmGetName weaponItem 32) " " successText) (cat "your " (itmGetName weaponItem 32))))
							)
						)
					(setq notFound Nil)
					)
				)
			)
		)

	; Item is identified

	(itmSetKnown gItem)

	; If we did not find a weapon to enhance, then no effect. Otherwise
	; we consume the item

	(if notFound
		(objSendMessage gSource Nil "The enhancement has no effect")
		(objRemoveItem gSource gItem 1)
		)
	)
Tell me if it does not work.
Fiction is reality, simplified for mass consumption.
PGP: 0x940707ED, 5DB8 4CB4 1EF5 E987 18A0 CD99 3554 3C13 9407 07ED
Bitcoin: 1LLDr7pnZDjXVT5mMDrkqRKkAPByPCQiXQ
Post Reply