Sign up Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
HaydenBarca

Registered:
Posts: 127
Reply with quote  #1 
I'm looking for hooks for the weapons player where they have to set their console to a certain condition to fulfill a condition.  For instance, variable X is 1 while weapons is targeting a specific target or has beams set to frequency B, but when they change the condition (target something else, beams set to some other frequency), variable X is reset to 0.

I found <if_player_is_targeting/>, but I can't figure out how to detect when they are no longer targeting that thing.

I couldn't find any hook for beam frequencies or the contents of the torpedo tubes (e.g. is there an EMP in at least one tube?).

Does anyone have some insights or tricks for this?
Darrin

Registered:
Posts: 159
Reply with quote  #2 
Quote:
Originally Posted by HaydenBarca
I'm looking for hooks for the weapons player where they have to set their console to a certain condition to fulfill a condition.  For instance, variable X is 1 while weapons is targeting a specific target or has beams set to frequency B, but when they change the condition (target something else, beams set to some other frequency), variable X is reset to 0.


There really aren't any object properties in the game to tell what the Weapons player is doing. They can target things, and they can shoot things. You can count how many torps they have, but you can't tell what they are loading in the tube or whether it's been fired at anything in particular. 

The best way for Weapons to trigger events is to give them things to shoot at, and then set a condition for when that target no longer exists. I like to use wrecks for this: they are stationary, easy to blow up with a beam attack or two, you can tag them, and sometimes they drop anomalies. Outside of beams and torpedoes, Weapons can also trigger events by tagging ships/monsters, sending out probes (scan_level = 1), and possibly do something with beacons (although that might be a little tedious). 

Quote:
Originally Posted by HaydenBarca

I found <if_player_is_targeting/>, but I can't figure out how to detect when they are no longer targeting that thing.


Maybe set a 1-second timer, check if they are still targeting, and if they aren't increment a counter? 

Quote:
Originally Posted by HaydenBarca

I couldn't find any hook for beam frequencies or the contents of the torpedo tubes (e.g. is there an EMP in at least one tube?).

Does anyone have some insights or tricks for this?


Beam frequency is not a property available to scripting. Likewise, there's no way to tell what's loaded in the torpedo tubes. 

You could take a count of all the armament on the ship when it gets created or docks at a station, and then maybe set up a 1-second timer to check and see if the numbers drop... but it would probably get extremely fiddly very quickly. 

Dave Thaler

Registered:
Posts: 499
Reply with quote  #3 
Quote:
Originally Posted by HaydenBarca
I'm looking for hooks for the weapons player where they have to set their console to a certain condition to fulfill a condition.


The other conditions that are relevant to weapons are <if_object_tag_matches/> and <if_monster_tag_matches/> where the weapons player has to hit a target with a tag.

Quote:
I found <if_player_is_targeting/>, but I can't figure out how to detect when they are no longer targeting that thing.


You should be able to detect when no longer targeting by using 3 events in your script in this order:
1) An event that always sets a variable like "targetingThing" to 0.   You can set the condition to something like testing if the player ship exists, so it will execute every cycle.
2) Then right after event 1, add an event that uses if_player_is_targeting and sets the variable to 1 if so.
3) Then right after event 2, you can test targetingThing against 0 and any other relevant conditions, and do whatever actions you want, which will occur whenever they are not targeting that thing.

You can add other variables/conditions as needed, e.g., to only do the thing once, and only if you previously had the thing targeted.
HaydenBarca

Registered:
Posts: 127
Reply with quote  #4 
Thanks, Darrin and Dave!  Yes, I will definitely be making use of tags.  I'll try the "still targeting loop".  I hadn't thought about beacons, too.  Thanks.
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.