A Few Random Questions
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 419
- Joined: Wed, 11. Dec 13, 02:39
A Few Random Questions
1) Is there anyway to repeatedly perform aiscript or mdscript actions on every frame update?
2) Is there anyway to make the player's ship invisible or not render?
3) How do you change or cycle the player's missiles within a script? Using <equip_weapon> doesn't work. (Solved: Have to use <activate_weapon> instead)
4) Now that engines can cause proximity damage, is there anyway to disable this feature? (Solved: Removed connections with "triggerpart" tag from engine component files)
2) Is there anyway to make the player's ship invisible or not render?
3) How do you change or cycle the player's missiles within a script? Using <equip_weapon> doesn't work. (Solved: Have to use <activate_weapon> instead)
4) Now that engines can cause proximity damage, is there anyway to disable this feature? (Solved: Removed connections with "triggerpart" tag from engine component files)
Last edited by Clownmug on Sun, 7. Feb 16, 09:56, edited 1 time in total.
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
1.)
yes, but not entirely reliable (may skip a frame or two sometimes) and i wouldnt recommend it unless absolutely necessary since it will affect performance:
AIScriptdont forget some kind of abort condition because (perform a check of a value instead of the value="true" ) otherwise it will be difficult to kill this script.
MD (untested but should work in theory)
a delay might be necessary if this freezes the Game. killing this MD Script externally is less critical though - just <cancel_cue/>
2.)
no idea. what do you want to achieve?
3.)
answered.
4.)
permanently? just remove the related Values from the Engine Macros i think
temporary on demand? afaik nope.
what is your Goal? protecting Repair Drones? if yes - that should be already part of the core game - if a Ship kills its own Drones with the Engines its a Bug, not a feature (according to Dev Posts in the Beta Forums)
yes, but not entirely reliable (may skip a frame or two sometimes) and i wouldnt recommend it unless absolutely necessary since it will affect performance:
AIScript
Code: Select all
<do_while value="true">
<!-- perform actions -->
<wait exact="0.0001s"/>
</do_while>
MD (untested but should work in theory)
Code: Select all
<cue name="EndlessLoop">
<!-- no conditions - will trigger immediately -->
<actions>
<!-- perform actions here -->
<reset_cue cue="this"/>
</actions>
</cue>
2.)
no idea. what do you want to achieve?
3.)
answered.
4.)
permanently? just remove the related Values from the Engine Macros i think
temporary on demand? afaik nope.
what is your Goal? protecting Repair Drones? if yes - that should be already part of the core game - if a Ship kills its own Drones with the Engines its a Bug, not a feature (according to Dev Posts in the Beta Forums)
if not stated otherwise everything i post is licensed under WTFPL
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter
I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help

-
- Posts: 419
- Joined: Wed, 11. Dec 13, 02:39
Right now I have this as part of an aiscript:UniTrader wrote:1.)
yes, but not entirely reliable (may skip a frame or two sometimes) and i wouldnt recommend it unless absolutely necessary since it will affect performance:
AIScriptdont forget some kind of abort condition because (perform a check of a value instead of the value="true" ) otherwise it will be difficult to kill this script.Code: Select all
<do_while value="true"> <!-- perform actions --> <wait exact="0.0001s"/> </do_while>
MD (untested but should work in theory)a delay might be necessary if this freezes the Game. killing this MD Script externally is less critical though - just <cancel_cue/>Code: Select all
<cue name="EndlessLoop"> <!-- no conditions - will trigger immediately --> <actions> <!-- perform actions here --> <reset_cue cue="this"/> </actions> </cue>
Code: Select all
<label name="control"/>
<warp object="this.ship" zone="player.zone">
<position object="player.primaryship"/>
<rotation pitch="player.primaryship.rotation.pitch" roll="player.primaryship.rotation.roll" yaw="player.primaryship.rotation.yaw"/>
</warp>
<wait exact="1ms"/>
<resume label="control"/>
Trying to crudely simulate flying another ship by mirroring the movement of the player's ship.UniTrader wrote: 2.)
no idea. what do you want to achieve?
I can't find any value in the engine macros that affect damage. Right now I'm using <upgrade_object_by_macro> to give the player the same engines as the other ship that's mirroring them. If it's a capital ship, it gets killed by the player because of those engines.UniTrader wrote: 4.)
permanently? just remove the related Values from the Engine Macros i think
temporary on demand? afaik nope.
what is your Goal? protecting Repair Drones? if yes - that should be already part of the core game - if a Ship kills its own Drones with the Engines its a Bug, not a feature (according to Dev Posts in the Beta Forums)
-
- Moderator (English)
- Posts: 8074
- Joined: Tue, 30. Mar 04, 12:28
4. Not sure if helpful but the beta 3 changelog includes changes to engine damage. Maybe that list of files modified between b2 and b3 could help narrow down a search.
http://forum.egosoft.com/viewtopic.php?t=355582CBJ wrote:• Beta 3 Fixed heat damage from engines still being applied when engine is wrecked (new feature in 4.00).
• Beta 3 Fixed heat damage from engines not being applied after ship changes zone (new feature in 4.00).
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
1.)
hmm - you could perhaps achieve a more reliable 2-frame-delay by calling a script which immediately returns instead of the wait - not sure about this, but worth a try..
also another Idea, but not entirely sure if this applies:
try to lower your system load - the increased wait time is afaik caused by the game noticing it currently runs slowly and tries to improve this by delaying some actions (of all the scripts scheduled to be executed now only the scripts which are started within eg 50ms are executed in the current frame, the remaining ones are done in the next frame. Scripts are executed serially so scripts performing intensive calculations between blocking actions may increase the wait times of other scripts slightly)
2. i suggest using new Drone Type for this which is invisible.. and keep the skunk nearby, but within a certain distance
4.) ok, its not in the macro - but i think i just found it in the component:
but another idea when using the drone approach: playe the Engine far outside the distance where it cajn do anything. - placing it 100km behind the drone makes sure its always outside the regular zone boundaries (just an idea - may have sideeffects)
hmm - you could perhaps achieve a more reliable 2-frame-delay by calling a script which immediately returns instead of the wait - not sure about this, but worth a try..
also another Idea, but not entirely sure if this applies:
try to lower your system load - the increased wait time is afaik caused by the game noticing it currently runs slowly and tries to improve this by delaying some actions (of all the scripts scheduled to be executed now only the scripts which are started within eg 50ms are executed in the current frame, the remaining ones are done in the next frame. Scripts are executed serially so scripts performing intensive calculations between blocking actions may increase the wait times of other scripts slightly)
2. i suggest using new Drone Type for this which is invisible.. and keep the skunk nearby, but within a certain distance
4.) ok, its not in the macro - but i think i just found it in the component:
Code: Select all
<connection name="Connection19" hidden="true" tags="part triggerpart ">
<offset>
<position x="0" y="0" z="-161.7645"/>
</offset>
<parts>
<part name="engine_damage">
<lods>
<lod index="0">
<materials>
<material id="1" ref="effects.lightcone_engine_xl_exhaust"/>
</materials>
</lod>
</lods>
<size>
<max x="35" y="35" z="144.55"/>
<center x="0" y="0" z="0"/>
</size>
</part>
</parts>
</connection>
if not stated otherwise everything i post is licensed under WTFPL
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter
I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help

-
- Posts: 419
- Joined: Wed, 11. Dec 13, 02:39
I looked through the list but didn't find anything that affected engines globally. I think it might be hard coded.Sparky Sparkycorp wrote:4. Not sure if helpful but the beta 3 changelog includes changes to engine damage. Maybe that list of files modified between b2 and b3 could help narrow down a search.
http://forum.egosoft.com/viewtopic.php?t=355582CBJ wrote:• Beta 3 Fixed heat damage from engines still being applied when engine is wrecked (new feature in 4.00).
• Beta 3 Fixed heat damage from engines not being applied after ship changes zone (new feature in 4.00).
I tried setting up an onUpdate() function with lua to ensure the code runs every frame. Then in the onUpdate() I used SignalObject() to trigger <event_object_signalled> for an aiscript interrupt. This method worked but still had the same jerking motion as before. I'm starting to think that it's not possible to synch the motion because the player's ship will always be one frame ahead of the other ship.UniTrader wrote:1.)
hmm - you could perhaps achieve a more reliable 2-frame-delay by calling a script which immediately returns instead of the wait - not sure about this, but worth a try..
also another Idea, but not entirely sure if this applies:
try to lower your system load - the increased wait time is afaik caused by the game noticing it currently runs slowly and tries to improve this by delaying some actions (of all the scripts scheduled to be executed now only the scripts which are started within eg 50ms are executed in the current frame, the remaining ones are done in the next frame. Scripts are executed serially so scripts performing intensive calculations between blocking actions may increase the wait times of other scripts slightly)
I'm not sure which drone you mean. The only new file I noticed is for the xenon drone.UniTrader wrote: 2. i suggest using new Drone Type for this which is invisible.. and keep the skunk nearby, but within a certain distance
Removing those connections with a patch worked, I don't know if I'll make it a permanent solution though. That idea with the drone sounds interesting, hopefully I'll figure out which drone is the new one. It's not in HoL by any chance? I never signed up for the beta unfortunately.UniTrader wrote: 4.) ok, its not in the macro - but i think i just found it in the component:
but another idea when using the drone approach: playe the Engine far outside the distance where it cajn do anything. - placing it 100km behind the drone makes sure its always outside the regular zone boundaries (just an idea - may have sideeffects)Code: Select all
<connection name="Connection19" hidden="true" tags="part triggerpart "> <offset> <position x="0" y="0" z="-161.7645"/> </offset> <parts> <part name="engine_damage"> <lods> <lod index="0"> <materials> <material id="1" ref="effects.lightcone_engine_xl_exhaust"/> </materials> </lod> </lods> <size> <max x="35" y="35" z="144.55"/> <center x="0" y="0" z="0"/> </size> </part> </parts> </connection>
Thanks for your help guys.
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
with new drone i meant a new drone type you make yourself which completely suits your needs. not something re-purposed from Vanilla.(and Drone as in Player-Operated Remote Control)
and yes, the "steered" Ship will always be one Frame behind. you can make it less noticeable by only allowing slow ships though.
and yes, the "steered" Ship will always be one Frame behind. you can make it less noticeable by only allowing slow ships though.
if not stated otherwise everything i post is licensed under WTFPL
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter
I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help

-
- Posts: 5625
- Joined: Sat, 10. Nov 12, 17:55
Do you need to go through aiscripts every frame?
It might even happen that signalled events are processed in a different order then they are created, or they can have some delay for any reason.
Im not sure what and how you do it, but keeping some globals updated from cues and having scripts read that when they get to it might provide a more smooth/reliable communication. In case order of data packets is important.
It might even happen that signalled events are processed in a different order then they are created, or they can have some delay for any reason.
Im not sure what and how you do it, but keeping some globals updated from cues and having scripts read that when they get to it might provide a more smooth/reliable communication. In case order of data packets is important.
-
- Posts: 419
- Joined: Wed, 11. Dec 13, 02:39
I think for now I'm going to try adding the player ship's velocity on each axis to the position values for the warp, hopefully that'll make a difference.UniTrader wrote:with new drone i meant a new drone type you make yourself which completely suits your needs. not something re-purposed from Vanilla.(and Drone as in Player-Operated Remote Control)
and yes, the "steered" Ship will always be one Frame behind. you can make it less noticeable by only allowing slow ships though.
I was mostly using an aiscript because I read one of the updates for 4.0 beta was something about it being able to support 1024 interrupts per frame.pref wrote:Do you need to go through aiscripts every frame?
It might even happen that signalled events are processed in a different order then they are created, or they can have some delay for any reason.
Im not sure what and how you do it, but keeping some globals updated from cues and having scripts read that when they get to it might provide a more smooth/reliable communication. In case order of data packets is important.
-
- Posts: 3615
- Joined: Sun, 8. Apr 12, 09:40
why not using an AI for the captain?
you can write your "command" to this.ship.pilot.$force = table[]
with forward, backward, throttle, left, right
at the AI you only need to calculate the the new position and add an handler to update/interrupt the movement
so you can handle this by a conversation (not ending, show always the same 6 options again) at the "bridge" and use the F2 view
for real fly a smallship use
http://forum.egosoft.com/viewtopic.php?t=381713
(ok here would be capitals possible to, but thats not so real usefull for command your fleet)
EDIT:
ha ha, AI works
[ external image ]
startet a thread if someone will test it
http://forum.egosoft.com/viewtopic.php? ... 25#4584325
you can write your "command" to this.ship.pilot.$force = table[]
with forward, backward, throttle, left, right
at the AI you only need to calculate the the new position and add an handler to update/interrupt the movement
so you can handle this by a conversation (not ending, show always the same 6 options again) at the "bridge" and use the F2 view
for real fly a smallship use
http://forum.egosoft.com/viewtopic.php?t=381713
(ok here would be capitals possible to, but thats not so real usefull for command your fleet)
EDIT:
ha ha, AI works

[ external image ]
startet a thread if someone will test it
http://forum.egosoft.com/viewtopic.php? ... 25#4584325
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
Marvin Martian wrote:why not using an AI for the captain?
you can write your "command" to this.ship.pilot.$force = table[]
with forward, backward, throttle, left, right
at the AI you only need to calculate the the new position and add an handler to update/interrupt the movement
so you can handle this by a conversation (not ending, show always the same 6 options again) at the "bridge" and use the F2 view
for real fly a smallship use
http://forum.egosoft.com/viewtopic.php?t=381713
(ok here would be capitals possible to, but thats not so real usefull for command your fleet)
EDIT:
ha ha, AI works
[ external image ]
startet a thread if someone will test it
http://forum.egosoft.com/viewtopic.php? ... 25#4584325
did you take a look at my Bridge Commands Script? thats basically the same, just with less hazzle.. (if there were proper Hotkey support - abusing/kidnapping the Map Hotkey is a bit buggy if used in quick sucession)
if not stated otherwise everything i post is licensed under WTFPL
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter
I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help

-
- Posts: 3615
- Joined: Sun, 8. Apr 12, 09:40
no not for real, just installed once an eternity ago, but then i was fixed to the mechanic table and can't move, so i drop it at the same moment 
don't know if this was bug or a feature
my AI alllows to use the ship without further limitations, you only tied to the conversation as long as you "command"
EDIT:
ok take a look
my solution is like direct the donky with a carrot at a rod and line

don't know if this was bug or a feature

my AI alllows to use the ship without further limitations, you only tied to the conversation as long as you "command"
EDIT:
ok take a look
not even close, you say fly to position, thats the (now) vanilla-command we already haveUniTrader wrote:did you take a look at my Bridge Commands Script? thats basically the same,
my solution is like direct the donky with a carrot at a rod and line
-
- Posts: 419
- Joined: Wed, 11. Dec 13, 02:39
I decided to try making an invisible drone like UniTrader suggested, but it worked a little differently from the first mod you linked. It had a dummy component which I used to transform into the another ship using <upgrade_object_by_macro>.Marvin Martian wrote:why not using an AI for the captain?
you can write your "command" to this.ship.pilot.$force = table[]
with forward, backward, throttle, left, right
at the AI you only need to calculate the the new position and add an handler to update/interrupt the movement
so you can handle this by a conversation (not ending, show always the same 6 options again) at the "bridge" and use the F2 view
for real fly a smallship use
http://forum.egosoft.com/viewtopic.php?t=381713
(ok here would be capitals possible to, but thats not so real usefull for command your fleet)
EDIT:
ha ha, AI works
[ external image ]
startet a thread if someone will test it
http://forum.egosoft.com/viewtopic.php? ... 25#4584325
Then I realized I could just do the same thing for the player's ship so that's what I'm working on now. I've taken the main body of the ship and turned it into a radar component, then I use that to transform into the macro of another ship.
This works fine for small ships with the exception of not being able to use its weapons. For larger ships the game crashes whenever I try opening a menu. I have an aiscript ready for controlling the weapons, but I can't figure out how to find the new "ship" to run it. Using <find_ship>, <find_object>, or <find_object_component> don't seem to work. I know it exists somewhat as a separate object since it shows up in the property menu.
I like the idea behind your other mod for controlling large ships, but I want to see if more direct control is possible. I might go back to using <warp> to player's position and rotation just for large ships. The jerky movement should be less noticeable with them except when boosting.
-
- Posts: 3615
- Joined: Sun, 8. Apr 12, 09:40
in case of the cover function at the plot- game they cover player.primary.ship and player.entity so i think the "drone" is player.entity
or check player.subordinates, if the drone is a drone, they should be inside
maybe you could start the AI at player.copilot (don't think do something similar) and let her command the turrets
Edit:
do you think it will be possible you can manage this "move by warp" drone into an Tractor beam drone, for moving jumpbeacons or damaged ships
or check player.subordinates, if the drone is a drone, they should be inside
maybe you could start the AI at player.copilot (don't think do something similar) and let her command the turrets

Edit:
do you think it will be possible you can manage this "move by warp" drone into an Tractor beam drone, for moving jumpbeacons or damaged ships
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
Ships dont execute Scripts. Entities/NPcs do.Clownmug wrote:This works fine for small ships with the exception of not being able to use its weapons. For larger ships the game crashes whenever I try opening a menu. I have an aiscript ready for controlling the weapons, but I can't figure out how to find the new "ship" to run it. Using <find_ship>, <find_object>, or <find_object_component> don't seem to work. I know it exists somewhat as a separate object since it shows up in the property menu.

Regarding the Crash the debuglog (file) might provide the necesary insight what goes wrong there.
not really like the Vanilla Map - mine is for Commanding Ships you are on board using the First Person View - and yours tooMarvin Martian wrote:EDIT:
ok take a looknot even close, you say fly to position, thats the (now) vanilla-command we already haveUniTrader wrote:did you take a look at my Bridge Commands Script? thats basically the same,
my solution is like direct the donky with a carrot at a rod and line

although our Approaches could be combined - set the Speed using your method of a Menu, and decide the Direction by using the Direction the Player looks to like me. (still not a fan of the player direct control of Caps - you are the Commander, not the Helmsman)
but for our both approaches to this proper Custom Hotkey Support is essential if it were to be done completely right, not abusing/kidnapping Map Hotkeys or keep talking to the captian to set the direction.. these are both just workarounds for that..
if not stated otherwise everything i post is licensed under WTFPL
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter
I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help

-
- Posts: 419
- Joined: Wed, 11. Dec 13, 02:39
I'm not using the drone anymore. I'm using the player's ship itself which is "upgraded" to become the other ship. I tried using player.copilot, player.ship.pilot and player.controlled.pilot, but it doesn't seem to do anything.Marvin Martian wrote:in case of the cover function at the plot- game they cover player.primary.ship and player.entity so i think the "drone" is player.entity
or check player.subordinates, if the drone is a drone, they should be inside
maybe you could start the AI at player.copilot (don't think do something similar) and let her command the turrets![]()
It's possible.Marvin Martian wrote: Edit:
do you think it will be possible you can manage this "move by warp" drone into an Tractor beam drone, for moving jumpbeacons or damaged ships
I know this, but I can't find the "ship" for an entity to control it.UniTrader wrote: Ships dont execute Scripts. Entities/NPcs do.![]()
It's not showing any relevant errors in the log unfortunately.UniTrader wrote: Regarding the Crash the debuglog (file) might provide the necesary insight what goes wrong there.
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
ah, misunderstood you...Clownmug wrote:I know this, but I can't find the "ship" for an entity to control it.UniTrader wrote: Ships dont execute Scripts. Entities/NPcs do.![]()
you attach the Ship as Upgrade to the Player Ship? then its still player.primaryship (or also this.ship if the script is run on board of the Playership)
also to control the turrets it might me necesary to add a DO to the Player Ship - at least iforgotmysocks did it this way for his skunk turret mod iirc. the script checks if its run on the right guy i think and if not simply aborts, so your tries couldnt work..
if not stated otherwise everything i post is licensed under WTFPL
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter
I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help

-
- Posts: 3615
- Joined: Sun, 8. Apr 12, 09:40
i simply use the DO attack AI at my "Pilot" for my platform-mod, si its possible, only any attack handler will not suite if the entity isn't part of the shipUniTrader wrote: the script checks if its run on the right guy i think and if not simply aborts, so your tries couldnt work..
on figters the Pilot controls the turrets in my opinion too
-
- Posts: 419
- Joined: Wed, 11. Dec 13, 02:39
Adding a defense officer to the player ship didn't work as expected. It controlled the player's weapons rather than the weapons on the attached "ship".
It's funny, I can actually assign a pilot to the "ship" by just hiring one in the game. In a way it's a weird half ship, half component hybrid. If I could just figure out how to find it in the mdscript I would be all set.
I'm thinking of trying the lua function GetContainedObjectsByOwner() or GetContainedShipsByOwner() since the property menu has no problem finding the "ship". I don't know how I would get the array/list back to the mdscript though.
It's funny, I can actually assign a pilot to the "ship" by just hiring one in the game. In a way it's a weird half ship, half component hybrid. If I could just figure out how to find it in the mdscript I would be all set.
I'm thinking of trying the lua function GetContainedObjectsByOwner() or GetContainedShipsByOwner() since the property menu has no problem finding the "ship". I don't know how I would get the array/list back to the mdscript though.