Sign up Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
HaydenBarca

Registered:
Posts: 196
Reply with quote  #1 
I'm trying to do a mission script that detects when a whale has just been tagged by the player ship.

First I create the whale
<create type="monster" monsterType="1" age="1" podnumber="3" x="68613.0" y="0.0" z="65491.0" angle="0" name="Young Whale" />

and clear all randomly generated tags during Start using:
<set_monster_tag_data tag_slot="0" name="Young Whale" />
<set_monster_tag_data tag_slot="1" name="Young Whale" />
<set_monster_tag_data tag_slot="2" name="Young Whale" />
<set_monster_tag_data tag_slot="3" name="Young Whale" />

Then in the mission, the player ship hits a whale with a tag.  Then I try to detect it using:
<if_monster_tag_matches name="Young Whale" string="ShipName" />

But it never detects it.  I put in a log entry after the if_monster_tag_matches statement to try to debug, but it never shows up in the log, even after Science confirms a successful tag.

Am I using this command incorrectly?
HaydenBarca

Registered:
Posts: 196
Reply with quote  #2 
Do you think it's causing problems that I have 12 different whales with the name "Young Whale"?  I'd like to have pods of whales and scripts to interact with them without having to resort to "Young Whale 1", "Young Whale 2", etc.

I did a test using <if_distance name1="Young Whale" player_slot2="0" comparator="LESS_EQUAL" value="2000.0" /> and again it didn't work.

Then I did a test with a single whale named "Young Whale" and both the tag and the distance comparison worked like a charm.

What this means is that if I want to interact with a pod of whales I would need to name them each uniquely and then repeat the brain stack and script logic for each one.  I couldn't get XML wildcard "*" to work as in "Young Whale*", so I need to change my plan or copy and paste a ton of code a lot of times.  That's really annoying.  Does anyone have any miracles?
Darrin

Registered:
Posts: 164
Reply with quote  #3 
Quote:
Originally Posted by HaydenBarca

What this means is that if I want to interact with a pod of whales I would need to name them each uniquely and then repeat the brain stack and script logic for each one.  I couldn't get XML wildcard "*" to work as in "Young Whale*", so I need to change my plan or copy and paste a ton of code a lot of times.  That's really annoying.  Does anyone have any miracles?


Sounds like each whale needs an individual name. And yes, you will have to check each whale for tags via copy/paste events.  

If you want each whale to have what looks like the same name, then you can add spaces before or after "Young Whale":

"Young Whale"
" Young Whale " 
"  Young Whale  "
etc.

 
Newcommerin

Avatar / Picture

Registered:
Posts: 190
Reply with quote  #4 
Maybe, it could be easier this way:

You have to rename the whales, cause Artemis won't work correctly if not. It would be like using a variable for multiple purpose - the program would not know wich of them is meant. You could use one or more " " at the end of the name, so the user won't see it at first, just like Darrin wrote.

Then write one query with a variable that is set if anyONE of all the whales it tagged. You have to ask for each whale individually in this query, but don't have to copy all the code for each whale.

__________________
Sorry, English is not my native language, I am German.
(* I wish I would live in America, I wish I would... *)
Any mistakes you can find, you can keep and with the spelling mistakes you can cook you an alphabet soup.

My Artemis Homepage: https://star-ship-academy.jimdo.com/
HaydenBarca

Registered:
Posts: 196
Reply with quote  #5 
Thanks for the ideas.  I think I see what you mean:

1) Create whales with unique names (Whale1, Whale2, etc.).  Use Darrin's spaces trick for aesthetic reasons.

2) Create lots of queries/events to detect tags

If Whale1 isTagged, set variable WhaleTotalTags=WhaleTotalTags+1
If Whale2 isTagged, set variable WhaleTotalTags=WhaleTotalTags+1
If Whale3 isTagged, set variable WhaleTotalTags=WhaleTotalTags+1
etc.

3) If WhaleTotalTags > 0, then do the thing to make the mission work


That would avoid some of the copy-and-paste.  Unfortunately, the additional issue I'm running into is that whales' default brain stack doesn't avoid black holes (!?!).  So I have to clear and recreate a brain stack to avoid black holes or else the subject of the mission might blissfully swim to their oblivion.  Sure I could detect that and recreate a new pod, but that's really ham-fisted.

But to clear and recreate brainstacks for uniquely named whales, I'm back to repeating 6-8 lines for each individual whale.  Not the end of the world, but annoyingly inelegant.  Being able to assign brain stacks by type would be much more useful (all Sharks do this, for instance, all Kralien cruisers do that, etc.).
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.