Sign up Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
planedonut

Registered:
Posts: 10
Reply with quote  #1 
Hey all. I'm trying to create a simple AI loop that forces a space shark to travel to a point and then turn around and travel back to the origin to simulate a set patrol path sorta thing.

I am trying to just clear the stack of the space shark and load it up with what I want but I cant seem to affect the stack at all. 

I create the shark in <start>

<create type="monster" x="10000" z="90000" name="SS1" monsterType="2" />

then I have an initialization event that occurs a few seconds after <start> finishes to ensure the shark has spawned. This initialization sets a variable to a value that will allow the shark pathmaking event to start which can be seen here:


<event name="Shark Pathmaking A-B">
    <if_variable name="pathmaking" comparator="EQUALS" value="1" />
    <if_inside_sphere name="SS1" centerX="10000" centerY="0" centerZ="90000" radius="1000" />
    <if_variable name="ASTRIG" comparator="EQUALS" value="0" />
        <clear_ai name="SS1" />
        <add_ai name="SS1" type="POINT_THROTTLE" value1="10000" value2="0" value3="65000" value4="5" />
        <add_ai name="SS1" type="CHASE_PLAYER" value1="3000" value2="1000" />
        <add_ai name="SS1" type="CHASE_ANGER" />
        <set_variable name="ASTRIG" value="1" />
        <set_variable name="BSTRIG" value="0" />
  </event>


The ASTRIG and BSTRIG ("A/B" "Shark" "Trigger"....I promise I didnt name those intending to post here and submit you to that...) variables are to make sure an event doesnt occur until the corresponding event occurs. Meaning that a very similar looking event called Shark Pathmaking B-A exists that flips ASTRIG to 0 and BSTRIG to 1.

Any advice on this would be much appreciated! My example might be hard to understand lol I can probably piece together something simpler if needed.
Mike Substelny

Avatar / Picture

Administrator
Registered:
Posts: 2,401
Reply with quote  #2 
Have you used the Science Station and server [F7] to examine the shark's brain stack? In the past I think I have had success with target_throttle and dir_throttle but I'm not certain that all the brain stack elements that work with ships also work with monsters.

In the Artemis Armada IV script I do some AI stuff with a shark. It's in the code for "Mad Scientist Situation" and the shark is named Bernardo (bonus points if you know why that's his name).

Follow this link to a forum discussion about the mission and a download link:

https://artemis.forumchitchat.com/post/sandbox-script-armada-iv-9994759?highlight=armada+iv&pid=1308029773

If I can help in any other way please let me know.

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

Registered:
Posts: 10
Reply with quote  #3 
Quote:
Originally Posted by Mike Substelny
Have you used the Science Station and server [F7] to examine the shark's brain stack? In the past I think I have had success with target_throttle and dir_throttle but I'm not certain that all the brain stack elements that work with ships also work with monsters.

In the Artemis Armada IV script I do some AI stuff with a shark. It's in the code for "Mad Scientist Situation" and the shark is named Bernardo (bonus points if you know why that's his name).

Follow this link to a forum discussion about the mission and a download link:

https://artemis.forumchitchat.com/post/sandbox-script-armada-iv-9994759?highlight=armada+iv&pid=1308029773

If I can help in any other way please let me know.

I have looked at that server menu while playing but it doesnt look like anything changes for the shark's stack, even when i try to clear the AI or add POINT_THROTTLE. I think ive come up with a makeshift solution that will work.

This is random but would you happen to know how I can change the number of PShocks on the Artemis with scripting in 2.4? The line

<set_object_property property="countShk" value="0" name="Artemis" />

doesnt seem to be doing anything for me

Thanks for all your help by the way, youve been on pretty much each of the topics I've posted. I appreciate it.

Darrin

Registered:
Posts: 164
Reply with quote  #4 
Quote:
Originally Posted by planedonut

I have looked at that server menu while playing but it doesnt look like anything changes for the shark's stack, even when i try to clear the AI or add POINT_THROTTLE. I think ive come up with a makeshift solution that will work.


POINT_THROTTLE may not work with monsters. Try DIR_THROTTLE, see if that does anything different. 

Another option would be to drop a beacon that attracts sharks. I had some limited success with this in my Easter Egg mission, where I switched two beacons between attract/repel. However... the shark still wanders off on his own sometimes. 

Quote:
Originally Posted by planedonut

This is random but would you happen to know how I can change the number of PShocks on the Artemis with scripting in 2.4? The line
 <set_object_property property="countShk" value="0" name="Artemis" /> 

doesnt seem to be doing anything for me


I don't see why that wouldn't work. Try add_object_property with a negative number. 

Mike Substelny

Avatar / Picture

Administrator
Registered:
Posts: 2,401
Reply with quote  #5 
Quote:
Originally Posted by planedonut

This is random but would you happen to know how I can change the number of PShocks on the Artemis with scripting in 2.4? The line
 <set_object_property property="countShk" value="0" name="Artemis" /> 

doesnt seem to be doing anything for me



This will affect P-Shock torpedoes in storage but not in the tubes. A mission script cannot change or read the contents of player torpedo tubes.

In any case, I believe that line does not work in Artemis 2.4. I think you need to be on at least 2.7.0 or possibly later for a script to affect counts of P-Shock torpedoes.

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

Registered:
Posts: 10
Reply with quote  #6 
Quote:
Originally Posted by Mike Substelny


This will affect P-Shock torpedoes in storage but not in the tubes. A mission script cannot change or read the contents of player torpedo tubes.

In any case, I believe that line does not work in Artemis 2.4. I think you need to be on at least 2.7.0 or possibly later for a script to affect counts of P-Shock torpedoes.

Shoot that’s unfortunate. I am a little hesitant to go up to a version that high due to that fact that I’m developing for a lab study and introducing things like tags/beacons/etc would require a bunch of study documentation changes.

I appreciate the help, though, I’ll figure something out.
Mike Substelny

Avatar / Picture

Administrator
Registered:
Posts: 2,401
Reply with quote  #7 
Quote:
Originally Posted by planedonut

Shoot that’s unfortunate. I am a little hesitant to go up to a version that high due to that fact that I’m developing for a lab study and introducing things like tags/beacons/etc would require a bunch of study documentation changes.


In that case you should consider this strategy:
  • Upgrade to Artemis 2.7.5
  • Make a copy of the game folder, possibly on the desktop
  • In that copy edit vesseldata.xml
  • Set the unwanted torpedo types on the player ships to zero

That should work. Though honestly the Tags, Beacons, Probes, and P-Shocks add a lot of fun for players.

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

Registered:
Posts: 10
Reply with quote  #8 
Quote:
Originally Posted by Darrin


POINT_THROTTLE may not work with monsters. Try DIR_THROTTLE, see if that does anything different. 



No luck there either. Calling clear_ai doesnt do anything either. Probably going to chalk it up to the version I am using or something along those lines. For my purposes, I've decided to just continuously set the sharks location to a specific point until the player gets close enough to it which unleashes it. 

That lets me have some sort of control over its position which is good enough for my needs.
Mike Substelny

Avatar / Picture

Administrator
Registered:
Posts: 2,401
Reply with quote  #9 
Quote:
Originally Posted by planedonut


No luck there either. Calling clear_ai doesnt do anything either. Probably going to chalk it up to the version I am using or something along those lines. For my purposes, I've decided to just continuously set the sharks location to a specific point until the player gets close enough to it which unleashes it. 

That lets me have some sort of control over its position which is good enough for my needs.


In every version of Artemis 2.x the DIRECT command works with generic objects. You could try this in your script:

  • Create a generic object, possibly an invisible one, at the X,Z coordinates where you want the shark to start.
  • Depending on your needs, you might put the generic object above or below the player's plane using the Y coordinate.
  • Pin the shark to the object by constantly copying the object's X,Z coordinates and angle, or using set_relative_position.
  • Move the generic object to interesting places using the DIRECT command. The shark will move with it.
  • When a player ship gets close release the shark.

__________________
"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:

Easily create a Forum Website with Website Toolbox.