Sign up Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
planedonut

Registered:
Posts: 10
Reply with quote  #1 
I am trying to alter the shields of a ship I created on Artemis 2.1.1 but the shields aren't changing no matter what I put in as a value. 

My code is simple (it is in the <start> block):
<create type="enemy" x="95000" y="0" z ="94000" angle="45" name="KR01" raceKeys="Kralien" hullKeys="Cruiser" fleetnumber="1"/>
<set_object_property property="shieldStateBack" value="5" name="KR01" />


Was this feature not implemented in 2.1.1? Or am I just missing something?
Mike Substelny

Avatar / Picture

Administrator
Registered:
Posts: 2,391
Reply with quote  #2 
I think that won't work because of an irritating feature. There are a lot of ship properties you can't set in the same block where you created the ship. You need to create the ship in one code block then set it's properties later in another code block. Later can be just later lines of code, but it must be after a new set of conditions is checked. This goes for shield state, turn rate, max speed, etc..

In my scripts I usually include a "Priming" code block. I create ships in one block, set a variable, then in a later block I check that variable and set the properties of all the ships. It's kind of like creating a pump then later priming the pump so it can move fluids.

__________________
"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
I think that won't work because of an irritating feature. There are a lot of ship properties you can't set in the same block where you created the ship. You need to create the ship in one code block then set it's properties later in another code block. Later can be just later lines of code, but it must be after a new set of conditions is checked. This goes for shield state, turn rate, max speed, etc..

In my scripts I usually include a "Priming" code block. I create ships in one block, set a variable, then in a later block I check that variable and set the properties of all the ships. It's kind of like creating a pump then later priming the pump so it can move fluids.

Ah looks like thats it. 

First, I set a variable in <start> and created a corresponding <event> that triggered based on the value set in <start> and then was changed in the <event>.

This didn't resolve my issue, but I was noticing that it was taking ~2 seconds for the ship in question to appear on the map when loading up the mission so i stuck a 5 second timer in <start> and a corresponding check onto the event if statements and that did the trick. 

Its enough time to make sure the ship is created but not too much so that a scan can be completed before the shields get changed so it should work fine for my purposes.

Thanks for your help!
Darrin

Registered:
Posts: 145
Reply with quote  #4 
Some things to keep in mind:

If you want to permanently change an enemy's shields, you'll want to set shieldMaxStateBack and shieldMaxStateFront as well. Otherwise the shields will regenerate back up to their Max value. 

The game engine will sometimes decide that a newly-created enemy is "elite" and give it increased shields, and maybe some elite abilities. I think this is random? I think this happens at creation, so yes, it's better to create a separate event to set the shield strength at what you want it to be. 

When you're dealing with stations, neutrals, and friendly ships, sometimes the game gets confused by a create statement and will throw in a different ship. I like to use "hull ID", but then suddenly all my stations are TSN Light Cruisers for some reason. So try switching to "race/hull keys" keywords and see if that helps. (Or if  you're using race/hull keys, switch to hull ID and see if that helps.) 



planedonut

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

The game engine will sometimes decide that a newly-created enemy is "elite" and give it increased shields, and maybe some elite abilities. I think this is random? I think this happens at creation, so yes, it's better to create a separate event to set the shield strength at what you want it to be. 


You can actually alter whether or not a ship is overpowered/gets elite abilities with the set_special command! I am programming missions for a lab study at my university so I was real glad I could make sure there was no variability like that with enemy spawns.


Mike Substelny

Avatar / Picture

Administrator
Registered:
Posts: 2,391
Reply with quote  #6 
Quote:
Originally Posted by Darrin
The game engine will sometimes decide that a newly-created enemy is "elite" and give it increased shields, and maybe some elite abilities. I think this is random? I think this happens at creation, so yes, it's better to create a separate event to set the shield strength at what you want it to be. 


The beginning of vesseldata.xml file describes Skaraans with the tag "hasspecials" which means all of their ships automatically spawn with a random set of elite abilities. When your script spawns any enemy ship you can turn on elite abilities you want it to have, but when you spawn a Skaraan it already has random abilities, so you need to turn OFF any abilities you do not want it to have.

A modder who wants an AI race to have randomly assigned elite abilities should put the "hasspecials" flag in that race's vesseldata.xml description. For example, this might be appropriate for Star Trek's Orion Pirates or Ferengi Marauders. This might also work for the Gamilons in a Star Blazers mod, since they sometimes had special ships with special abilities.

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