I guess this is directed to George, or anyone else who has dealt with these problems. All of these issues arose while I was modding the radiator finned laser cannon for OddBob in the Hard Science Conversion thread.
1. Is there a way to phrase an (objEnumItems ...)'s criteria to pick up virtual items? I was trying to make the weapon component of that device a virtual item, and I could create and install it as a virtual, but I couldn't "find" it later to unistall/remove it.
2. Is there a way to reference the <Events> section of an <ItemType> definition from an <Invoke>? In the example in the other thread, I was forced to include the Event logic in the ShipClass.
Latest batch of Modding questions
-
- Developer
- Posts: 2997
- Joined: Thu Jul 24, 2003 9:53 pm
- Contact:
Unfortunately, there is not. But I will add a new flag that includes virtual items for all places that take an item criteria filter (including objEnumItems).Burzmali wrote: 1. Is there a way to phrase an (objEnumItems ...)'s criteria to pick up virtual items?
I'm not sure what you mean here. Reference how? Do you want to invoke a piece of code in <Events>?Burzmali wrote: 2. Is there a way to reference the <Events> section of an <ItemType> definition from an <Invoke>? In the example in the other thread, I was forced to include the Event logic in the ShipClass.
On 2, here is an example.
The question I have is, is there a value for !obj! that will cause <OnMyTimer> to trigger?
Code: Select all
<ItemType UNID="&itMyItem;"
.
.
.
>
<Invoke>
.
.
.
(sysAddObjTimerEvent 3600 !obj! "OnMyTimer")
.
.
.
</Invoke>
<Events>
<OnMyTimer>
.
.
.
</OnMyTimer>
</Events>
</ItemType>
-
- Developer
- Posts: 2997
- Joined: Thu Jul 24, 2003 9:53 pm
- Contact:
I get it now.
I will need to add a new function, because you will need both the object and the item as parameters.
Something like,
I think both gSource (the object) and gItem are necessary. I'll add this to the next version.
I will need to add a new function, because you will need both the object and the item as parameters.
Something like,
Code: Select all
(sysAddObjItemTimerEvent 3600 gSource gItem "OnMyTimer")
-
- Developer
- Posts: 2997
- Joined: Thu Jul 24, 2003 9:53 pm
- Contact:
BTW, I'm also thinking of adding more built-in events for installed items:
<OnInstall> Gets called when the item is installed (and perhaps the script can return a code that prevents the installation)
<OnUninstall> Gets called when the item is uninstalled (and, again, the script can prevent uninstallation)
<OnUpdate> Gets called every update (for performance I will probably restrict this so that it only gets called every 10 ticks).
<OnFire> Gets called for weapons when the weapon fires.
Would that help your mod? In other words, would those events be enough to do your mod without requiring a virtual item?
<OnInstall> Gets called when the item is installed (and perhaps the script can return a code that prevents the installation)
<OnUninstall> Gets called when the item is uninstalled (and, again, the script can prevent uninstallation)
<OnUpdate> Gets called every update (for performance I will probably restrict this so that it only gets called every 10 ticks).
<OnFire> Gets called for weapons when the weapon fires.
Would that help your mod? In other words, would those events be enough to do your mod without requiring a virtual item?
- Betelgeuse
- Fleet Officer
- Posts: 1920
- Joined: Sun Mar 05, 2006 6:31 am
OnInstall and OnUninstall would be great for "living" items so that they can't be easily uninstalled
OnFire would be great for a weapon that damages your own shields
one request though can there be a OnActivate and OnDisable so we can have effects happen on those events
OnFire would be great for a weapon that damages your own shields
one request though can there be a OnActivate and OnDisable so we can have effects happen on those events
Crying is not a proper retort!