Home Crush your enemies... and create an EMPIRE!!! Space Empires V -- BUY NOW!!!

User login

  • Create new account
  • Request new password

Navigation

  • news
    • archive
    • blogs
    • books
    • forums
    • recent posts
    • groups
  • image galleries
  • projects & downloads
  • search
  • create content
  • news aggregator

Search

Who's online

There are currently 2 users and 129 guests online.

Online users

  • Mynhardt
  • bqspearman

Languages

  • English English
  • French French

Browse archives

« November 2008  
Mo Tu We Th Fr Sa Su
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Home » news » forums » Support & Feedback » Scenarios & Mods » SE:V MODs

Script function to find particular component?

Isopsyco's picture
Submitted by Isopsyco on Thu, 2007-12-20 08:38. SE:V MODs

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?

‹ Question about abilities DevnullMod 1.0.0 Initial Release ›
» login or register to post comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Psieye's picture

Re: Script function to find particular component?

Submitted by Psieye on Thu, 2007-12-20 10:09.

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

» login or register to post comments
Isopsyco's picture
Mod Designer

Re: Script function to find particular component?

Submitted by Isopsyco on Thu, 2007-12-20 11:01.

Even with an AI tag, how would you determine if its damaged? The functions in the script docs don't have one that does this directly, they have one that gets the component ID, which I'm not sure how that is associated. How would one set up a loop to look through all the components on a ship and single out a particular one (or several if its carrying more than one).

» login or register to post comments

Re: Script function to find particular component?

Submitted by Corellon on Sat, 2007-12-22 13:46.

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

» login or register to post comments
Isopsyco's picture
Mod Designer

Re: Script function to find particular component?

Submitted by Isopsyco on Sun, 2007-12-23 00:22.

Corellon wrote:
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


Corellon!! Thanks a bunch, you just saved me several hours of testing functions and script to see if those functions would do the job! The script manual isn't very clear on the syntax limits and what values its asking for when its a name.
Thanks again!!

» login or register to post comments

Re: Script function to find particular component?

Submitted by Corellon on Sun, 2007-12-23 11:38.

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)

» login or register to post comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Now on STEAM

Now on STEAM!Space Empires V via STEAMSpace Empires IV via STEAMSTEAM online by Valve Corporation

Popular content

Today's:

  • Research By Percentage SUCKS
  • Troops/Fighter
  • Space Empires V and VI: Expansions and the Future: Tell the Company What's on Your Wish List
  • drone combat?!
  • Star Trek Trailers.....

All time:

  • Space Empires V and VI: Expansions and the Future: Tell the Company What's on Your Wish List
  • Space Empires V
  • Gritty Galaxy Fleet Clash
  • Damn Dirty Bugs/Annoyances
  • Space Empires V: General Thoughts, Observations, and Suggestions

Last viewed:

  • Modding How to?
  • New: Exodus Mod
  • Video Issues.
  • questions about strategy
  • does anyone remember Ascendancy from the Logic factory?
(c) Strategy First, Inc. All rights reserved.