Script function to find particular component? |

Anyone know how to get a particular component from a ship and determine if its damaged?
I've looked through the script function lists and see that a list can be generated by component ID. What is the component ID referenced to? If I wanted to check and see if any ship has component X and its damaged how do I reference the component ID?
Re: Script function to find particular component?
Well the way I was handling things was to loop though all the components in the ship,
for index := 1 to Sys_Get_Space_Object_Comp_Count(ship_id) do
set comp_id := Sys_Get_Component_With_Name(sys_long_Player_ID, AI_COMPONENT_(Component Name))
set comp_id2 := Sys_Get_Space_Object_Comp_Info_Comp_ID( ship_id, index)
if (comp_id2 = comp_id ) then
set damage level := Sys_Get_Space_Object_Comp_Info_Comp_Tonnage_Structure(ship_id, index) / Sys_Get_Space_Object_Comp_Info_Comp_Tonnage_Damage(ship_id, index)
endif
endfor
It's not as easy as a function call, but it works, and it can check for multiple components of the same type
Re: Script function to find particular component?
Isopsyco,
Your welcome, I know some things aren't very clear, usually I use the CodeListing_Interface.txt located in the scriptphaser directory to lookup functions but even that is kinda out of date and wrong, in a couple places it calls for a long but expects a string or visa versa (with the queue checks of the top of my head, seems it was a cut and paste job but the planet queue fuction takes facility_id as a long, while the system queue check takes a string with the facility name (but the file still says it takes a long)




Re: Script function to find particular component?
Hmm... depending on exactly what sort of component (i.e. one-per-ship or not) you're thinking of, is there something that could be done with using AI tags as a marker?
---Sig---
Playing Touhou games (Go to this Wiki if interested. No, nobody else is that good/insane as that replay). No rush for SE