ps, i now run this all the time as it keeps the pirates off me whilst i'm scripting. Seems very stable and very effective

Moderators: Moderators for English X Forum, Scripting / Modding Moderators
Code: Select all
Continuously check notoriety and update relation accordingly
012 while [TRUE] * main loop
Calculate the correct relation to player
013 $note = get notoriety from race Pirates to race Player
014 $pirate.to.ply = Foe
015 if $note > -1000 AND $note < 1
016 $pirate.to.ply = Neutral
017 else if $note > 0
018 $pirate.to.ply = Friend
019 end
Load the entire Pirate ship array
020 $ship.array = get ship array: of race Pirates class/type=null
021 $ship.count = size of array $ship.array
022 while $ship.count * iterate through every pirate ship
023 dec $ship.count =
024 $ship = $ship.array[$ship.count]
025 $player = null
if the ship is in space, check for player ships within 15000m
026 if not $ship -> is docked
027 $sector = $ship -> get sector
028 $player = find ship: sector=$sector class or type=null race=Player flags=[Find.Nearest] refobj=$ship maxdist=15000 maxnum=1 refpos=null
029 end
if there are none then adjust this ships relation
030 skip if $player
031 $ship -> set relation against Player to $pirate.to.ply
allow for interupts ie the rest of the game
032 @ = wait 50 ms
033 end * get the next pirate ship
034 end * continue with main loop