Model Creature Script

Error message

Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /var/www/pied-piper.ermarian.net/includes/common.inc).
AuthorTopic: Model Creature Script
Apprentice
Member # 5757
Profile Homepage #0
I'm making a "Model Creature Script", which is basically a template you can use for custom character scripts or just insert into your scenario as a good creature script. I wrote out a list of memory cell values and their functions below, so I wouldn't forget them while I'm scripting. This script is going to be kind of long, because it handles multiple combat and movement possibilities, but ok. I'll post again once I finish it. Probably in May. I'm about 20% done, just so you know.

// Memory Cell Values

// Memory Cell 0: Creature Sight
// Stores Creature Sight (See Cell 1 for Information)

// Memory Cell 1: Creature Mobility
// 0: Wander Randomly (Attacks enemy creatures if they come within sight)
// 1: Don't Move (Does not move no matter what)
// 2: Patrol (Moves to a waypoint and back to start and attacks enemy creatures if they come within sight and
// then returns to the patrol route when they leave it's sight)
// This won't cause the creature to move exactly to your waypoint, but within 1 space of it.
// 3: Approach (Approaches party from start and attacks them if they come within sight)
// 4: Gaurd (Waits at start and attacks party if they come within sight and returns if they leave it)
// 5: Wait (Waits at start and attacks party if they come within sight)
// 6: Scout (Approaches party from start and flees to a waypoint if they come within sight)
// 7: Pace (Randomly moves to a location within a distance from start and doesn't attack)

// Cell 2: Mobility Variable (What this does varies by the value of Cell 0)
// 0: Does Nothing
// 1: Does Nothing
// 2: Waypoint to Patrol to
// 3: Does Nothing
// 4: Does Nothing
// 5: Does Nothing
// 6: Waypoint to Flee to
// 7: Distance from Start

// Cell 3: Creature Combat Type
// 1: Kamikaze Soldier (Attacks any target and fights to the death)
// 2: Soldier (Attacks any target and flees when critical)
// 3: Coward Soldier (Attacks any target and flees when damaged or outnumbered)
// 4: Kamikaze Support (Attacks a wounded target and fights to the death while maintaing a distance from the party)
// 5: Support (Attacks a wounded target and flees when critical while maintaing a distance from the party)
// 6: Coward Support (Attacks a wounded target and flees when damaged or when outnumbered while maintaing a // distance from the party )
// 7: Kamikaze Assassin (Attacks a heavily wounded target and fights to the death)
// 8: Assassin (Attacks a heavily wounded target and flees when critical)
// 9: Coward Assassin (Attacks a heavily wounded target and flees when damaged or when outnumbered)
// 10: Mercenary (Attacks after being attacked at any target and flees when damaged or when outnumbered)
// 11: Wizard (Casts mage spells at any target and flees when critical or when outnumbered)
// 12: Support Wizard (Casts mage spells at a wounded target and flees when critical or when outnumbered while // maintaining a distance from the party)
// 13: Coward Wizard (Casts mage spells at a wounded target and flees when damaged or when outnumbered // while maintaining a distance from the party)
// 14: Healer (Casts priest spells at friends and flees when critical or when outnumbered)
// 15: Support Healer (Casts priest spells at friends and flees when critical or when outnumbered while // maintaining a distance from the party)
// 16: Coward Healer (Casts priest spells at friends and flees when critical or when outnumbered while maintaining // a distance from the party)
// 17: Boss (Attacks any target and fights to the death, broadcasts a message when killed)
// 18: Boss Minion (Attacks a wounded target and fights to death while the boss is still alive, otherwise it
// disappears)

// Cell 4: Combat Variable (What this does varies by the value of Cell 2)
// 1: Does Nothing
// 2: Does Nothing
// 3: Does Nothing
// 4: Distance to Maintain
// 5: Distance to Maintain
// 6: Distance to Maintain
// 7: Does Nothing
// 8: Does Nothing
// 9: Does Nothing
// 10: Does Nothing
// 11: Does Nothing
// 12: Distance to Maintain
// 13: Distance to Maintain
// 14: Does Nothing
// 15: Distance to Maintain
// 16: Distance to Maintain
// 17: Does Nothing
// 18: Boss Character Number

// Cell 5: Talk Node
// The node to select if you choose to talk to the creature.
// 0 : "Talking: Does Not Respond"

// Cell 6: Kill Effect Column
// The column of the SDF to set to done when the creature is killed.

// Cell 7: Kill Effect Row
// The row of the SDF to set to done when the creature is killed.

// Cell 8: Flee Distance
// Distance to flee.

By the way, I'm too lazy to uncomment this stuff. So, I hope you don't have a problem.
Just a note, but support refers to using missile weapons (I should have called it Archer), since they maintain a certain distance away from the nearest party member. It's also in my script.

--------------------
You have been arpeggiated!
Posts: 23 | Registered: Tuesday, April 26 2005 07:00
Apprentice
Member # 5757
Profile Homepage #1
BTW, critical means less than 1/5 of maximum health.

--------------------
You have been arpeggiated!
Posts: 23 | Registered: Tuesday, April 26 2005 07:00
BANNED
Member # 4
Profile Homepage #2
It would be nice- my only question is how slow the game would be. I wouldn't complain if you kept it simple, but could you?
I'd use it if you made it.

--------------------
*
Posts: 6936 | Registered: Tuesday, September 18 2001 07:00
Off With Their Heads
Member # 4045
Profile Homepage #3
Be sure to make heavy use of different states so that BoA doesn't have to go through large amounts of code every turn. (Like what TM said, sorta.)

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Apprentice
Member # 5757
Profile Homepage #4
Okay. I'll go back in and do that state stuff. BTW, I just finished the creature move script portion(but, I've got to back and add the states). I never though of doing the states like that. Thanks for the tip.
But don't worry, that won't take long to do.

Hmm. I though I couldn't do #7, but I figured out a way. Although I'm fairly sure it would be inefficient.

have the creature fidget chance at 100, but check to see if his distance is greater than the maximum distance away from start before each movement. if he is, then fidget chance will be at zero and he'll return to start. (this actually won't be what happens, because as soon as he gets back within the distance, he'll start fidgeting again, because if he is not out of the range, fidget chance will be set to 100 anyway-that will work too because he won't start outside the distance.)

Does anyone have a more efficient way to do this (if there is)? If so, post a reply (and include the other way). You're still free to post your comments, though(even if you don't know how). :confused:

wow, i really overuse parentheses (duh).

--------------------
You have been arpeggiated!
Posts: 23 | Registered: Tuesday, April 26 2005 07:00
Apprentice
Member # 5757
Profile Homepage #5
Okay.
I finished that states dealy for the creature mobility check. I also worked out a better way for mobility type 7. So I'm good.
(Disregard my post before.)

I also got rid of the creature sight memory cell and replaced it with a level storage cell. This should make annoying stuff like making scripts for creature levels a lot easier.

I didn't realize there was a ninth memory cell, as well, does anyone have any suggestions as to what to put in it?
Please post your ideas!

--------------------
You have been arpeggiated!
Posts: 23 | Registered: Tuesday, April 26 2005 07:00
Shock Trooper
Member # 4445
Profile #6
Use it for an "item vulnerability."

Use who_hit_me(), then use char_has_item_of_class_equip(). If the character who last damaged the creature has a scenario-specific item equipped, call a state.

like so:

if(who_hit_me()>=0){
if(char_has_item_of_class_equip(who_hit_me(), get_memory_cell(9), 0){
set_state_continue(whatever);
}
}
EDIT: This code goes in the START_STATE...

[ Wednesday, April 27, 2005 08:04: Message edited by: PoD person ]
Posts: 293 | Registered: Saturday, May 29 2004 07:00
Cartographer
Member # 995
Profile #7
you probably want him to use "run_town_script(get_memory_cell(9));" rather than set_state_continue because, unless I'm missing the point, the idea would be you could drop this script in your scenario folder and then never modify this script - just set some memory cells and go.
Posts: 206 | Registered: Thursday, April 18 2002 07:00
Shock Trooper
Member # 4445
Profile #8
No, the memory cell holds the item class. The user would have to write his own state in the creature script. If there were two extra memory cells, maybe one could serve the purpose you describe, but I think the state belongs in the creature script, anyway.

[ Wednesday, April 27, 2005 08:03: Message edited by: PoD person ]
Posts: 293 | Registered: Saturday, May 29 2004 07:00
Apprentice
Member # 5757
Profile Homepage #9
Okay, that's not a bad idea.
By default, the damage for this item class will be double(But if you want to modify the script, you can change this). I'll also add a long list of commented code to afflict the creature with negative status effects as well, from which they can prune and add the ones they want, if they want to modify the script code, that is.
Okay, I'll get to work on that combat script portion (I've only finished code for the first three types).

(edit)

Also, if the value for this memory cell is over 1000, it will be the number of the item that can instantly kill the creature. You could also change this code to something to that effect or whatever, but okay.

[ Wednesday, April 27, 2005 15:50: Message edited by: The Arpeggiator ]

--------------------
You have been arpeggiated!
Posts: 23 | Registered: Tuesday, April 26 2005 07:00
Apprentice
Member # 5757
Profile Homepage #10
Okay, tonight I didn't finish that Item Weakness part yet, but I did set up the inflict status ailment code to be added into it.

I finished the Combat Type Check (long list of IF statements about combat type and what state to go to when they are equal to certain things).

I also had to change the code for the first 3 combat type statements slightly to accomodate for the state changes.

And I added the fourth combat type statement.

Just so you know, I'll report my progress every night. I'm also not working as fast or as much as I could during weekdays, because I have homework and I'm trying to finish "Chronicle" (my scenario entry, to the contest) before June 1st.

But usually, I only have to divide up my time between Chroncle and the script on saturday (plus social activities), but I can get a lot more done at night, since I can sleep in the next day.

(edit)

BTW, regardless of the time shown above the post, it's actually 10:57 PM here.

[ Wednesday, April 27, 2005 18:58: Message edited by: The Arpeggiator ]

--------------------
You have been arpeggiated!
Posts: 23 | Registered: Tuesday, April 26 2005 07:00
Apprentice
Member # 5757
Profile Homepage #11
I didn't get anything done last night because I had a test in physics the next day (damn those quantitative models of energy!!).
But hopefully I'll do some stuff tonight, since it's friday.

--------------------
You have been arpeggiated!
Posts: 23 | Registered: Tuesday, April 26 2005 07:00
Apprentice
Member # 5757
Profile Homepage #12
Okay, I've changed the script slightly, but I've also finished some more of the combat types script portions. First, the changes:

-Sorry, but no more item weakness, because the need for a creature sight arises signifigantly in the higher combat types, which I hadn't realized before. (Since I hadn't finished them yet.) So now, Memory Cell 9 is creature sight (sorry to whoever suggested this).
-Also, I've gotten rid of the boss combat type. Since it is the same as the ones before and I don't need to send a message to kill the creatures.
-I also went back and checked a bunch of my code and separated the code into further portions and edited for the new changes, as well as slightly changed the flee conditions and commands to where it checks for the condition before attacking.

I finished the Combat Types 4-10, so I'd say I'm coming along pretty well.
I've been working a lot on my scenario, so I haven't had too much time to finish the script. Though, I should, since basically every creature in my scenario uses it.

I may not be able to access my computer for several days, however. So that will definetly impede progress. Other than that, I'd say I'm about 50% done.

--------------------
You have been arpeggiated!
Posts: 23 | Registered: Tuesday, April 26 2005 07:00
Apprentice
Member # 5757
Profile Homepage #13
Okay, I'm back now. Sorry for the delay.

I can't work now because I have a history paper to do, but I'll try to squeeze some time in during the rest of the week and I'll definetly finish the script this weekend!
There's still testing, though. But that shouldn't take long. When I post again, I'll have finished the script, okay?

--------------------
You have been arpeggiated!
Posts: 23 | Registered: Tuesday, April 26 2005 07:00
Apprentice
Member # 5757
Profile Homepage #14
DONE!!!
I finished the script after much procrastination on my part.
Now all that's left is testing.

--------------------
You have been arpeggiated!
Posts: 23 | Registered: Tuesday, April 26 2005 07:00