Register Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
Dart_Tech

Registered:
Posts: 30
Reply with quote  #1 
So I have been working for a bit with the GM module and making a Mission Script

So far everything is going good, except for me trying to figure out how to have the GM issue move orders.

When you make a ship like this:

Code:
<create type ="neutral" raceKeys="TSN" hullKeys="Dreadnought" use_gm_position="yes" angle="90" fleetnumber="-1" name="DN1"/>


You get a Dreadnought that is happily flying along to point (0,0,0). Well I want to tell it to move and go twords another point. From my understand I just clear and add on to its brainstack:

Code:
<clear_ai use_gm_selection="yes"/>
<add_ai use_gm_selection="yes" value1="100" value2="0" value3="100" value4="1" type ="POINT_THROTTLE"/>


Then it will tell the ship to move to (100,0,100). However, I want to be able to have the ship that the GM has selected go to the special Blue  Right Click target box.

I have made a visual for further refrence. when the unit spawns, it follows the red arrow. Im looking for a command that I can use to have it turn around and go to the selection box following the green arrow.

Help.png 

I thought i was close when I found: set_to_gm_position, but that would allow me to "teleport" it to that location, I want it to fly by itself?

Any help is very much appreciated.

Xavier Wise

Registered:
Posts: 972
Reply with quote  #2 
There are a couple of options depending on exactly what you want. If I remember correctly, direct throttle will allow you to set the ship on a particular heading (in degrees). Now I think, 0 degrees is straight down the map, 90 degrees points you to the right, 180 straight up and 270 to the left. For your angle, you'd need an angle of about 300. This is how the TSN Sandbox gives a GM direct control over the enemy ships.

The other option would be to target throttle. This would require a couple of events and is just a theory at the moment. Create an object briefly, set the ai to target throttle, then destroy the object you created. There are a couple of problems though - the time it takes for the ai to switch and the object you create. I am not sure if you can target a generic mesh (which would be he best option). If it works, it would allow you to set any location for the ship to head to.

Whichever option you choose, dont forget to build the rest of the brainstack. Otherwise, your ship will quite happily sail on by targeta and not retaliate against enemies. Tweak the ranges to target enemies for the desired effect.

__________________
Captain Xavier Wise TSN Raven (BC-014)
Link to TSN RP Community website
Link to TSN Sandbox
Link to Blog
Dart_Tech

Registered:
Posts: 30
Reply with quote  #3 
Thanks for the direct throttle, that should work.

I tried the other way but after the target is destroyed it stops following (which makes sense). I would need like a Navpoint that Science could not see maybe but don't think that's possible.

On a completely unrelated note, I make a blackhole like this:

Code:
<create type="blackhole" use_gm_position="yes" radius="5000" randomRange="3000"/>


My question is, how do I make a super massive black hole? like 3-4 times as large? I try changing the radius or randomRange and it does not change its size. Could i use a mesh?

ryleyra

Registered:
Posts: 2,366
Reply with quote  #4 
One possibly might be to create an anomaly, and use that as the target. As long as the player ship doesn't get there first and pick it up. I don't know if an anomaly's name is displayed on the screen, though, or if you will have to name it a sequence of spaces as is often done with Black Holes.

I'll add that there is another option, but it is extremely time consuming. Create your object, at the GM position, and then go through a loop that tests an x, y, and z (or just x and z) variable for greater than or less than the object's current location. Increment your variables and try again. Eventually you should locate the object and can use the variables to set your ship's heading. It can take several seconds to locate the object, based on the granularity of your increment value, so I'm suggesting it only to show that it CAN be done. Hopefully someday Thom will give us a way to read a property into a variable.

You cannot set the size of a black hole. The "radius" attibute is used for minefields and asteroids, which summon multiple objects at the same time. The create type="blackhole" command only creates a single, named Black Hole.

You could use a generic mesh, however the shape of the mesh would be an issue. The texture of the black hole is readily available, but there are no meshes available that are flat, much less made up of three layers like the actual black hole in game. I have at times stuck the blackhole texture on the shield mesh, which is a half-dome, or the skybox, which is a cube, but you end up with a distorted black hole or six black holes arranged in a cube, respectively.
Dart_Tech

Registered:
Posts: 30
Reply with quote  #5 
Alright thanks for the info.

I made a very large asteroid mesh with a pushback:

Code:
            <create type="genericMesh" use_gm_position="yes" name="Large Asteroid" meshFileName="dat\asteroid.dxs" textureFileName="dat\asteroidTexture.png" colorRed="0.0" colorGreen="1.0" colorBlue="0.0"/>
            <set_object_property property="artScale" value="1.0" name="Large Asteroid" />
            <set_object_property property="pushRadius" value="600.0" name="Large Asteroid" />


Is there a way I can add damage if you bump into it like a normal asteroid? I was thinking it may be a property I could set but none look obvious.
ryleyra

Registered:
Posts: 2,366
Reply with quote  #6 
The only way you could simulate damage is to test for if_inside_circle and deal damage to shields or an internal system. Since your mesh has a push radius, you may have to test and see what value allows the ship to take damage only once when it bounces off the mesh.

It's surprisingly difficult to deal damage directly. You can use addto_object_property with shields, but for internal damage you have to either damage a specific system or pick one randomly.
Mike Substelny

Avatar / Picture

Administrator
Registered:
Posts: 1,610
Reply with quote  #7 
Can't you just add a Point_Throttle element to the brain stack? Use both use_gm_position and use_gm_selection. Of course you might not like what this does to the brain stack since that ship will make getting to that point its top priority. Until you give it a new brain stack it won't do any fighting.
__________________
"The Admiralty had demanded six ships; the economists offered four; and we finally compromised on eight."
- Winston Churchill
Mike Substelny

Avatar / Picture

Administrator
Registered:
Posts: 1,610
Reply with quote  #8 
Quote:
Originally Posted by Dart_Tech
Is there a way I can add damage if you bump into it like a normal asteroid? I was thinking it may be a property I could set but none look obvious.


Asteroids are special. The only way to deal that sort of damage is to put some real asteroids inside your generic object.

It would be great if Thom made generic objects more powerful. As it is they are nothing but images on main screen, and most players never see them because they spend 99% of their time looking at Long Range Scan.

__________________
"The Admiralty had demanded six ships; the economists offered four; and we finally compromised on eight."
- Winston Churchill
Dart_Tech

Registered:
Posts: 30
Reply with quote  #9 
Quote:
Originally Posted by Mike Substelny
Can't you just add a Point_Throttle element to the brain stack? Use both use_gm_position and use_gm_selection.


Thats what i was trying to do but could not get the code right. If you found a way to do it please share.


CodiX

Registered:
Posts: 1
Reply with quote  #10 
Quote:
Originally Posted by Xavier Wise
Now I think, 0 degrees is straight down the map, 90 degrees points you to the right, 180 straight up and 270 to the left.

Isn't 0 degrees straight up?
ryleyra

Registered:
Posts: 2,366
Reply with quote  #11 
No, the coordinate system is actually reversed. The x coordinate goes from right to left, and the z coordinate goes from top to bottom. So 0 degrees, while it is "up" on the map, is actually "down" in regards to the coordinate plane.

In other words, if a ship is moving on heading 0 degrees, the z coordinate is DECREASING.
Dart_Tech

Registered:
Posts: 30
Reply with quote  #12 
Ok, so I worked on something and got this figured out. I decided to use placing a mine for a test. In the first event I first make a object at a unknown location called "GMCursor". Then I make a dummy object at 0,0,0 called "CurrentPosition", then i initialize 2 variables, Xcor and Zcor to make the Cordinates of CurrentPosition. I finaly set CheckDistance to get the testing going.

Then the idea is that CurrentPosition is moved across the screen along the X-axis following the increase of the Xcor in the second event.

When it hits the end of the screen, its moves down to the next line at the beginning like a typerwritter followed by the cordinates (second event).

Finally the last event when the distance between the known mesh and unknown mesh hit 0, it means it has been found and hte mine is placed useing the XZ cords!

Bad news is....it crashes. Any ideas?

Code:
    <event>
        <if_gm_button text="Mine Field (S)" />
        <create type="genericMesh" use_gm_position="yes" name="GMCursor" meshFileName="dat\asteroid.dxs" textureFileName="dat\asteroidTexture.png" />
        <create type="genericMesh" x="0" y="0" z="0" name="CurrentPosition" meshFileName="dat\asteroid.dxs" textureFileName="dat\asteroidTexture.png" />
        <set_variable name="Xcor" value="0"/>    
        <set_variable name="Zcor" value="0"/>        
        <set_variable name="CheckDistance" value="1"/>        
    </event>
    
    <event>
        <if_variable name="CheckDistance" comparator="=" value="1"/>
        <if_variable name="Xcor" comparator="NOT" value="100000"/>        
        <set_variable name="Xcor" value="Xcor+1"/>
        <addto_object_property property="deltax" name="CurrentPosition" value="Xcor" />
    </event>
    
    <event>
        <if_variable name="CheckDistance" comparator="=" value="1"/>
        <if_variable name="Xcor" comparator="=" value="100000"/>
        <set_variable name="Xcor" value="0"/>
        <Set_object_property property="deltax" name="CurrentPosition" comparator="GREATER_EQUAL" value="0" />
        <set_variable name="Zcor" value="Zcor+1"/>
        <Set_object_property property="deltaz" name="CurrentPosition" value="Zcor+1" />
    </event>
    
    <event>
        <if_variable name="CheckDistance" comparator="=" value="1"/>    
        <if_distance name1="CurrentPosition" name2="GMCursor" comparator="=" value="0"/>
        <create type="mines" count="1" x="Xcor" y="0" z="Zcor" radius="10" randomRange="18" randomSeed="37303" /> 
        <set_variable name="CheckDistance" value="0" />
    </event>
Mike Substelny

Avatar / Picture

Administrator
Registered:
Posts: 1,610
Reply with quote  #13 
Have you used F7 to determine what statements trigger the moment before it crashes? Can you describe the error message?

Spawning "CurrentPosition" at 0,0,0 could cause a problem. I recommend staying away from the edges of the sector.

It looks like you are causing object "CurrentPosition" to exponentially accelerate (by adding an ever increasing value to deltax and deltaz, which are rates of movement along the X and Z axes) and never slow down (you never reduce deltax or deltaz), so "CurrentPosition" will quickly shoot off the edge of the map and probably crash the server. Frankly I thought those properties were case sensitive to deltaX and deltaZ but maybe they work as you have coded them.

__________________
"The Admiralty had demanded six ships; the economists offered four; and we finally compromised on eight."
- Winston Churchill
Previous Topic | Next Topic
Print
Reply

Quick Navigation: