Nexus Modding > Scripting

The AI and You

<< < (12/20) > >>

Mularac:
Take a look at what I wrote here, it should help you understand better the range of each variables.

The prefix before a variable, like "e.ship" or "m.otherShip" are not arbirtrary, they clarify the scope of each variable.

R. prefixes doesn't exist, and you have to be careful with the ones that have m. ones, as they're global variables.
Also, every variable declared in the sceneInit rule (or any rule outside a machine block) is automatically declared as m. variable, and if you want to access it from someplace outside that rule you have to use the m. prefix. Example:


--- Code: ---RULES
RULE event sceneInit
:action
///... pice of coding
string := "hello world";
///... further code...
:end
END

Machine "smt"
State smt
Rule event in
:action
debug(string); //This will display a 0
debug(m.string); //this will display "Hello world"
:end
END //event in
END //state smt
END //Machine smt
END //rules
--- End code ---

The Old Dragon:
Nice spot on the security value, I hadn't noticed that one tucked away  ;)

As Mularac said, you have to be careful with the variable prefix's. You can find a description on the values and uses in the Modding Manual, page 59 I believe (section 8.1.4). Nexus will either ignore your coding or tell you to go suck it's dangly bits, I'm afraid (sometimes it can be very unforgiving  :( ).

So looking at the the 'SceneInit' rule...

You need to either remove all the R.,G.,V.'s or remove and replace them with M.'s instead. I understand your reasoning, but it's more likely to cause issues; changing the names to things like M.GShip.1 should be fine.

(Don't forget to change the names in the 'Entities' section as well or they won't be recognised!)

Now the 'HullLow' rule...

1) The variable prefix in the condition line needs to be an "E." as this represents an Event action. In short, what we're doing is asking the game to check the race value whenever a ship reaches a low hull value (not sure what % damage level triggers it) and only perform the actions in the rule if the ship in question belongs to the Raptors.

2) The Raptor Threshold value; again change this to an M. and change the value. You've got 8 raptors in the scene, so a value of 4 would probably be more appropriate (with the value at 2, the gorgs won't jump in untill there's only 1 healthy raptor left).

3) Just change the remaining  R.ShipCount(s) back to  M.ShipCount(s).

And now the 'CallGorg' Rule...

Only one issue here and you're correct. The M.GL (my variable name for the Gorg ship I chose to be the leader (M.GL=GorgLead)). Change the M.GL to  M.GShip.1 and that should work ok.

Final point, although not strictly required; each state should have it's own "In" rule (and "Out" rule, though I do tend to ignore this one  :) ), even if they are empty rules. All you're saying to the game here is when you enter a state, read this one first (or read that one last).

The_Small_Time_Modder:
Bah humbug... i did all the fising you guys spoke of and the blasted thing is still refusing to cooperate... stinkin' little....  >:(

I have a feeling i need to fill in for a few other spots, ill put the code for the stuff im suspecting below...


--- Code: --- ExecList(M.GorgFleet,
SetLongRangeDir(S.this, JumpVector, 0, 0);
LongRangeArrive(S.this);

--- End code ---
The spot im suspecting i need to change is the JumpVector, 0, 0 part...

--- Code: ---JumpVector:=VNeg(R2Vec(M.GL:M.Ship.0));

--- End code ---
for this coding im guessing i need to change the Vneg and R2Vec parts.
NOTE: M.Ship.0 is now the Gorg battleship "Argentum" in my mission...

and yes, you're right old... it CAN be very unforgiving. i had to trash two missions (including a previous version of THIS one) because it wouldn't cooperate no matter how hard i tried to fix it. Im not sad, im just really frustrated with it...  >:(

Mularac:
your problem there is that the JumpVector variable contains a vector, and the game expects a number. what you should use is this:

SetLongRangeDir(S.this, JumpVector:x, JumpVector:y, JumpVector:z);

The Old Dragon:
The Execlist section is fine, providing that the list M.GorgFleet is populated by the Gorg ships you want to jump in. The error is in the JumpVector that you've declared, let me see if I can break this down a little...

JumpVector - No problems here, we're just providing a name for the variable (you could call it Fred if you really wanted; but looking back on it at a later date; you'd probably sit there scratching your head trying to figure out what you were on at the time).

VNeg - Again no issues here. This part tells Nexus that we want to put the 'Jump field' (that blue sparkly, strippy kind of thing) in front of the ship, as opposed to behind it when a ship is jumping out (I think changing this to VNorm will do this).

R2Vec - As I understand it, this is the direction that we want the ship to be facing when it jumps in or out of the scene. It must contain a value in brackets to function properly. It is this section that contains the error.

At the moment, you're telling the Gorg ships to jump in facing the direction M.GL ( a variable that I don't think you have defined) and you've attached a value/command to this variable with the use of a ':'.

So to fix it, all you need to do is replace...


--- Code: ---JumpVector:=VNeg(R2Vec(M.GL:M.Ship.0));
--- End code ---

with...


--- Code: ---JumpVector:=VNeg(R2Vec(M.Ship.0:Orientation));
--- End code ---

Now we're telling the Gorg ships to jump in facing the same direction as the ship 'Argentum'.

If you're still having problems, you could attach the mission file to one of your posts and one or more of us can have a look and iron out the issues.

On a completely different note that I didn't answer in my previous post; the F107 is part of Vanilla Nexus, it's a little something that I'm working on when I get the time.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version