Questions regarding moving AI and syntax of IF statement....
Posted: Wed Jun 25, 2003 1:00 am
Hi all,
I have a part question.
Q1: How should I interprete the "bat sign" when used in IF statements?
Q2: How can I make a AI move from it's spawn point to a pathway that I assign a target name?
OK. Now concerning the first question. When I test to see if a AI is alive I thought I do something like this. Of course the AI has a targetname etc..
The following is what you would see in a thread that I call from the main
program once friendlies and player are given weapons, etc..
move_tom:
if (isAlive level.tom)
{
iprintln "got this far"
level.tom runto $pn1
}
OK. Now when I run the game I do not get any error messages in the logfile. BUT, I neither see tom move to the targeted pathnode pn1 NOR
do I see any message pop up on the screen.
OK. Now if I change the if test parameter to read:
if !(isAlive level.tom)
Then I see the "got this far" message pop up on the screen.
NOW, if I understand the if statement syntax correctly, AND ALSO WHAT I SEE IN VARIOUS SCRIPT FILES FROM THE GAME......
Putting the "!" sign in front of the IF statement expression as you see above should TEST TRUE IF tom was dead, and therefore execute the statements within the IF statement. BUT this is not what I see here.
The only way I get the "got this far" text to show on the screen is if the
IF test returns senses that tom is dead.....which is not true...he is alive
and standing close to me in the game.
SO...... can some one set me straight on what the "!" sign does here?
Also in direct line with this I want to eventually test to see if a AI is dead,
AND then move another player to a given spot. Therefore I assumed that
the "!" placed in front of the test expression brackets, again like this....
if !(isAlive level.tom) would mean that if tom where dead then the statements would be carried out in the test statement, otherwise nothing would happen.
OK, if you have followed me this far, let me also say this..... If I test to see if tom is alive by writting:
if (isAlive level.tom) I GET NO ERRORS IN THE LOGFILE. BUT
NOTHING HAPPENS.
If I write the code as:
if !(isAlive level.tom) I get the iprintln test message BUT he does not
move.
AND WHEN WRITTEN WITH THE BAT SIGN, I GET THE FOLLOWING ERRORS IN THE LOGFILE:
level.tom runto $friendhide (maps/test_grb1.scr, 81)
level.tom ^
^~^~^ Script Error: command 'runto' applied to NIL
This is confusing as hell. He is alive but the test statement when testing to see if he is alive does not work, but seems to work if I test for if he is dead.
OK. For the second question. Is the command line correct in this thread
for moving the AI from his spawn point or for that matter whereever he would be at a given time, to a targeted PathNode?
I have tried for a few hours to make sure I have set mindist, maxdist, leash, etc.., to all type combos to see if they where preventing him from moving, with no success. Of course it would appear that the first question
regarding the IF statement syntax must be understood in order to expect
the guts of the if test statements to run correctly.
thanks for any help on these questions. I am being verbose to make sure
anyone that might help understands that I have set the targetname of the pathnode correctly, and as you see above, appear to be using the IF
statement correctly. Incidentally, when I use the IF statement for setting up a friendly player, it works the way I would expect it to. That is, the
guts of the IF statement get executed if the AI is alive, put another way,
the IF statement returns a TRUE to the command: if (isAlive level.friendly.1).
thanks in advance for any help....
I have a part question.
Q1: How should I interprete the "bat sign" when used in IF statements?
Q2: How can I make a AI move from it's spawn point to a pathway that I assign a target name?
OK. Now concerning the first question. When I test to see if a AI is alive I thought I do something like this. Of course the AI has a targetname etc..
The following is what you would see in a thread that I call from the main
program once friendlies and player are given weapons, etc..
move_tom:
if (isAlive level.tom)
{
iprintln "got this far"
level.tom runto $pn1
}
OK. Now when I run the game I do not get any error messages in the logfile. BUT, I neither see tom move to the targeted pathnode pn1 NOR
do I see any message pop up on the screen.
OK. Now if I change the if test parameter to read:
if !(isAlive level.tom)
Then I see the "got this far" message pop up on the screen.
NOW, if I understand the if statement syntax correctly, AND ALSO WHAT I SEE IN VARIOUS SCRIPT FILES FROM THE GAME......
Putting the "!" sign in front of the IF statement expression as you see above should TEST TRUE IF tom was dead, and therefore execute the statements within the IF statement. BUT this is not what I see here.
The only way I get the "got this far" text to show on the screen is if the
IF test returns senses that tom is dead.....which is not true...he is alive
and standing close to me in the game.
SO...... can some one set me straight on what the "!" sign does here?
Also in direct line with this I want to eventually test to see if a AI is dead,
AND then move another player to a given spot. Therefore I assumed that
the "!" placed in front of the test expression brackets, again like this....
if !(isAlive level.tom) would mean that if tom where dead then the statements would be carried out in the test statement, otherwise nothing would happen.
OK, if you have followed me this far, let me also say this..... If I test to see if tom is alive by writting:
if (isAlive level.tom) I GET NO ERRORS IN THE LOGFILE. BUT
NOTHING HAPPENS.
If I write the code as:
if !(isAlive level.tom) I get the iprintln test message BUT he does not
move.
AND WHEN WRITTEN WITH THE BAT SIGN, I GET THE FOLLOWING ERRORS IN THE LOGFILE:
level.tom runto $friendhide (maps/test_grb1.scr, 81)
level.tom ^
^~^~^ Script Error: command 'runto' applied to NIL
This is confusing as hell. He is alive but the test statement when testing to see if he is alive does not work, but seems to work if I test for if he is dead.
OK. For the second question. Is the command line correct in this thread
for moving the AI from his spawn point or for that matter whereever he would be at a given time, to a targeted PathNode?
I have tried for a few hours to make sure I have set mindist, maxdist, leash, etc.., to all type combos to see if they where preventing him from moving, with no success. Of course it would appear that the first question
regarding the IF statement syntax must be understood in order to expect
the guts of the if test statements to run correctly.
thanks for any help on these questions. I am being verbose to make sure
anyone that might help understands that I have set the targetname of the pathnode correctly, and as you see above, appear to be using the IF
statement correctly. Incidentally, when I use the IF statement for setting up a friendly player, it works the way I would expect it to. That is, the
guts of the IF statement get executed if the AI is alive, put another way,
the IF statement returns a TRUE to the command: if (isAlive level.friendly.1).
thanks in advance for any help....