qwerty12345 Posted February 9, 2014 Share Posted February 9, 2014 I understand that a script assigned to a creature runs continuously. How does it actually transform into actions? I mean, suppose there's a matching IF block containing RandomWalk(). When will the creature stop RandomWalk-ing? In the next round? Or never? If there's some action next to it in the same block, when will it be performed? Will it be performed at all? Link to comment
Jarno Mikkola Posted February 9, 2014 Share Posted February 9, 2014 I understand that a script assigned to a creature runs continuously. How does it actually transform into actions?I mean, suppose there's a matching IF block containing RandomWalk(). When will the creature stop RandomWalk-ing? In the next round? Or never? If there's some action next to it in the same block, when will it be performed? Will it be performed at all? The scripts have hierarchy, and then the script blocks have one too... So if the creature only has RandomWalk() in the blocks with true IF statement, then it will randomly walk, or until a higher hierarchy IF statement becomes true... now the states are checked every 2 frames, and the game usually runs with 30 Frames per second... so the frequency is lesser of a concern than the correct IF states... I would remember that the creatures script hierarchy goes according to the lowest bite mark in the .cre file... so first: Override, Class, Race, General, and then last and least Default -script. The scripts files hierarchy goes according the top downs notion, so if the first IF statement is true and it doesn't have the Continue() -action in the response before the END, then only the first block is executed, until the IF state becomes untrue. Link to comment
qwerty12345 Posted February 9, 2014 Author Share Posted February 9, 2014 The scripts have hierarchy, and then the script blocks have one too... So if the creature only has RandomWalk() in the blocks with true IF statement, then it will randomly walk, or until a higher hierarchy IF statement becomes true... now the states are checked every 2 frames, and the game usually runs with 30 Frames per second... so the frequency is lesser of a concern than the correct IF states... Do you mean that in something like IF (...) THEN RESPONSE #100 RandomWalk() DisplayStringHead(...) the string will never be displayed? Link to comment
Jarno Mikkola Posted February 10, 2014 Share Posted February 10, 2014 Do you mean that in something like IF (...) THEN RESPONSE #100 RandomWalk() DisplayStringHead(...) the string will never be displayed? Nope, quite the opposite, it will be displayed constantly ... but this wouldn't be: IF (...) THEN RESPONSE #100 RandomWalk() END IF (...) THEN RESPONSE #100 DisplayStringHead(...) END Link to comment
qwerty12345 Posted February 10, 2014 Author Share Posted February 10, 2014 Nope, quite the opposite, it will be displayed constantly Hmm I tried it and it actually isn't. Link to comment
Avenger Posted February 11, 2014 Share Posted February 11, 2014 RandomWalk will ever stop if some other script block's condition becomes true. 1. No action will be executed after RandomWalk in the same block. 2. No response block will ever be executed in a script, if some earlier block's condition evaluated true that didn't end with continue. Therefore, it is best to add RandomWalk to the end of the script, and add nothing after it (neither in the block, nor after the block). Link to comment
Ardanis Posted February 14, 2014 Share Posted February 14, 2014 Therefore, it is best to add RandomWalk to the end of the script, and add nothing after it (neither in the block, nor after the block). This works fine IF // searching for enemies THEN RESPONSE #100 RandomWalkContinuous() END IF // search timer expired THEN RESPONSE #100 MoveToSavedLocation("default_position","LOCALS") END Link to comment
Avenger Posted February 14, 2014 Share Posted February 14, 2014 I didn't say it would never work. But it is better to add blocks with a potential to break RandomWalk before it. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.