Rotghroth Rhapsody Duck in a Top Hat Posted April 15, 2009 Share Posted April 15, 2009 I keep trying to have things happen in my character scripts, like the enemy gets healed every turn, or kills off the party if you don't kill it in a time limit, but they never work. The calls in the START_STATE do not get performed every turn, and the effects don't happen! Twice I've had to move the effects to the town script, and that just bugs me, because half of the effects will not work in a town script (Damage_nearby, etc.). Does anyone know what could be the problem? There were no bugs in the scripts, or they wouldn't have worked in the town script. Here are both scripts. The first one works fine in a town script, but does not work in a Creature Script, the desired location: Code: if(get_flag(10,4)==1) { if (get_flag(10,5)==0) { message_dialog("The enemy cackles and gathers energy from the machinery. If it builds up, who knows what would happen?",""); set_flag(10,5,1); } print_str_color("The enemy charges up energy.",4); trns = trns + 1; if (trns == 5) { message_dialog("The enemy has built up enough energy. It unleashes it on you in a storm of fire. There is no way you will survive.",""); damage_char(0,1000,4); damage_char(1,1000,4); damage_char(2,1000,4); damage_char(3,1000,4); //killing blow damage_char(0,1,4); damage_char(1,1,4); damage_char(2,1,4); damage_char(3,1,4); } } The first SDF flag is set to 1, and the integer 'trns' has been properly declared. And the next script doesn't work in a Creature script either, and fails to do any damage (or did the last time I checked, but I have done something to fix this, and will update if it works[still doesn't work]) even when I put it in a town script. Code: if (get_flag(20,1) == 1) { dizz = dizz + 1; if (dizz == 3) { print_str_color("The enemy emits a blast of fire.",4); damage_nearby(50,5,1,0); dizz = dizz - 3; } } Quote Link to comment Share on other sites More sharing options...
Hatchling Cockatrice Lilith Posted April 15, 2009 Share Posted April 15, 2009 The script may not have any errors, but that doesn't mean it doesn't have bugs. Post it. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted April 15, 2009 Share Posted April 15, 2009 Does it work sometimes, but not always? It could be you simply forgot to set the script mode. A terrain script is not called every turn by default unless you are nearby, but that can be changed. Quote Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Enraged Slith Posted April 15, 2009 Share Posted April 15, 2009 Creature scripts are probably the most complicated of the basic scripts. I'm still pretty rusty at them. From what I understand, creature scripts will call what ever state they're set to every turn, until specified otherwise. If you just pasted that into the start state, it could be that the creature set it's state to it's attack state, which would account for why it isn't working. Also, if creature scripts aren't constructed properly, the creature will just shut down. Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Ishad Nha Posted April 16, 2009 Share Posted April 16, 2009 Have you read Chapter 2.12: Creating Creature Scripts in the Editor help file? If that does not help remember that BoA is full of quirks and some bugs, read the posts in this forum. You must read the BoA Script Reference - Wiki.htm file continually too. Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk nikki. Posted April 16, 2009 Share Posted April 16, 2009 Yes, I'd suggest dumping that code into the ATTACK_STATE (is that state 3?) of the creature script. Then try it. Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted April 16, 2009 Share Posted April 16, 2009 It's worth noting, tangentially, that there's not really such a thing as 'ATTACK_STATE'. It is merely Jeff's convention to use state 3 for a creature's fighting logic. (In fact, he doesn't even do this strictly, as basicnpc will actually make attacks while still in the START_STATE just before switching to state 3.) It is entirely possible to write a creature script so that all combat and peaceful logic is contained within the START_STATE, so that it has multiple states used while fighting, or even so that the START_STATE handles combat and the creature switches to a different state when not fighting, and so on. That being said, if you use basicnpc as a template, you do need to think carefully about the effects of the creature switching between states 2 and 3. Quote Link to comment Share on other sites More sharing options...
Unflappable Drayk Lazarus. Posted April 16, 2009 Share Posted April 16, 2009 What Niemand said. State switching caused me no end of problems for my first creature scripts, consider taking out the attack state. Creature scripts are pretty much always a pain. If it's not state switching screwing things up it's message calls or any number of annoying quirks. Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk Ephesos Posted April 16, 2009 Share Posted April 16, 2009 Creature scripts are the devil. Anything that can simplify them is a blessing. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.