help with functions
Can someone teach me how to use functions. Especially the objAddItem and shpInstallDevice functions objSetDevicePos and objSetDeviceFireArc. objSetDeviceLinkedFireOptions it would realy help me with my cruiser
when life throws you a curve ball catch it and throw it back.
- digdug
- Fleet Admiral
- Posts: 2620
- Joined: Mon Oct 29, 2007 9:23 pm
- Location: Decoding hieroglyphics on Tan-Ru-Dorem
objAddItem is a straightforward function to use, it adds an item to a spaceobject.
the item must be an itemStruct, so you have to create it using itmCreate function.
This will create a lightining cannon and add it to the cargo of the playership.
---
shpInstallDevice installs devices onto a ship.
Note, the item returned by shpInstallDevice is not the same itemStruct that is picked from the cargo (removed from the cargo and installed). So, for example, if you are interested to set a firearc to a weapon, you have to do something like this:
so that you can then manipulate tempItem to your likings.
Note2: shpInstallDevice only works on ships and not on stations ! Well this could actually be a nice ticket. Installing or changing weapons on stations could be interesting.
---
objSetDevicePos can accept 2 different syntaxes: from Xelerus:
Argument List
obj: the spaceobject that has the device
deviceItem: the device to set the object of
number: angle of the new item's position
number: radius of the new item's position (in pixels)
the 2 numbers are polar coordinates of the position of the weapon, where 0,0 is the center of the ship.
OR
where list is a list made up of 3 numbers '(a b c) where '(0 0 0) is the center of the ship and where most weapons are fired from in Transcendence. This is handy since objGetDevicePos returns a list ! Unfortunately the returned list has only 2 numbers like this '(0 0) so what I do is to append an additional 0 to the list when I have to reinstall a weapon in the same slot of one I just uninstalled.
Example:
then when I have to use it
---
Code: Select all
(objAddItem obj item [count]) -> True/Nil
Code: Select all
(objAddItem gPlayership (itmCreate 0x001B4001 1))
---
shpInstallDevice installs devices onto a ship.
Code: Select all
(shpInstallDevice ship item) --> item
Code: Select all
(setq tempItem (shpInstallDevice ship item))
Note2: shpInstallDevice only works on ships and not on stations ! Well this could actually be a nice ticket. Installing or changing weapons on stations could be interesting.
---
objSetDevicePos can accept 2 different syntaxes: from Xelerus:
Code: Select all
(objSetDevicePos obj deviceItem number number) -> True/Nil
obj: the spaceobject that has the device
deviceItem: the device to set the object of
number: angle of the new item's position
number: radius of the new item's position (in pixels)
the 2 numbers are polar coordinates of the position of the weapon, where 0,0 is the center of the ship.
OR
Code: Select all
(objSetDevicePos obj deviceItem list) -> True/Nil
Example:
Code: Select all
(setq devicePos (objGetDevicePos ship weapon))
Code: Select all
(objSetDevicePos ship tempItm (append devicePos '(0)))
Thanks didgug I will try to get this right
Ps I have no knowledge of functions prier to this I would really like it if some one could write a tutorial on them.
Ps I have no knowledge of functions prier to this I would really like it if some one could write a tutorial on them.
when life throws you a curve ball catch it and throw it back.
Would it be possible to use these functions to enable a station to remove a standard weapon and replace it with a link fire weapon. Similar to PM's player ship drones.
when life throws you a curve ball catch it and throw it back.
- digdug
- Fleet Admiral
- Posts: 2620
- Joined: Mon Oct 29, 2007 9:23 pm
- Location: Decoding hieroglyphics on Tan-Ru-Dorem
as I said before in my previous post, there are no functions (to the best of my knowledge) that can install/uninstall weapons into stations.Would it be possible to use these functions to enable a station to remove a standard weapon and replace it with a link fire weapon