Scripting Question- Neutralize at 1/4

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: Scripting Question- Neutralize at 1/4
Shock Trooper
Member # 1444
Profile #0
Right, so I'm trying to learn Avernumscript...
Could someone explain how I would make a creature turn neutral/ friendly after it has lost one quarter (1/4) of its life? May be stupid but I want to know how it is done. Have to start somewhere.

[ Sunday, March 28, 2004 07:31: Message edited by: Bahamut ]
Posts: 250 | Registered: Saturday, July 6 2002 07:00
Triad Mage
Member # 7
Profile Homepage #1
There's the set_attitude call. For the HP part, you can use get_health and get_max_health calls. To be more efficient, get_max_health once and then store it in a variable.

--------------------
"At times discretion should be thrown aside, and with the foolish we should play the fool." - Menander
====
Drakefyre's Demesne - Happy Happy Joy Joy
Encyclopedia Ermariana - Trapped in the Closet
====
You can take my Mac when you pry my cold, dead fingers off the mouse!
Posts: 9436 | Registered: Wednesday, September 19 2001 07:00
Shock Trooper
Member # 1444
Profile #2
I figured that much, yeah, but I didn't get it to work... Oh well, thanks anyway Drakey, I'll keep experimenting.

EDIT: Ok, so it works. Well, works as in worked twice, didn't work the rest of the {insert large number here} times I tried it. Howcome, when I ask it to divide (using an if statment and the current health call before) x with 4 (x being the max health) that it only turns neutral when the health is 0 (or at least, when the health bar is fully red.) ?
Furthermore, can I prevent the monster from being killed? Like stoping the party member, friendly npc, whatever from reducing the monsters health to negativ?

[ Sunday, March 28, 2004 08:24: Message edited by: Bahamut ]
Posts: 250 | Registered: Saturday, July 6 2002 07:00
Lifecrafter
Member # 1768
Profile #3
You could do it so that it creates a new monster when it dies, an encounter perhaps to add talk. And you could clean up any blood or mess left.

Of course, I'm thinking in BoE terms, because…*sniff*…I use a PC. Anyway, that's the simple way to do it. You'd have to lower it's max health, though.

EDIT: Well, if it's one monster, it ought to be easy, just by using a constant for the health. If it's multiple types, however, that would require a more complex system, like the one you're talking about.

[ Sunday, March 28, 2004 10:33: Message edited by: Desert Plah ]

--------------------
"Oh, North Wind, why frighten others?
In Nature's family all are brothers.
Puff and blow and wheeze and hiss;
You can't frighten Shingebiss.
Bring your frost and ice and snow;
I'm still free to come and go.
You can never frighten me,
One who never fears is FREE!"
-Shingebiss, the mighty duck
Posts: 830 | Registered: Tuesday, August 20 2002 07:00
Shock Trooper
Member # 1444
Profile #4
quote:
Originally written by Desert Plah:

You could do it so that it creates a new monster when it dies, an encounter perhaps to add talk. And you could clean up any blood or mess left.

Of course, I'm thinking in BoE terms, because…*sniff*…I use a PC. Anyway, that's the simple way to do it. You'd have to lower it's max health, though.

Wouldn't that play the death animation, so it woulf fall/evaporate/dissolve/whatever one second and the next it would be standing/alt. laying (using alt. graphics).
Posts: 250 | Registered: Saturday, July 6 2002 07:00
BoE Posse
Member # 112
Profile #5
You could give it a custom graphic with no death animation.

--------------------
Rate my scenarios!

Areni
Revenge
To Live in Fear
Deadly Goblins
Ugantan Nightmare
Isle of Boredom
Posts: 1423 | Registered: Sunday, October 7 2001 07:00
Apprentice
Member # 4123
Profile #6
Well I STILL haven't taken the time to read all of the scripting info so this may be a really dumb idea, but... What if you made an item that "saves life" 100% of the time. You give the item to the character. Then, when you want the thing to die, just use some scripting magic to take it away.

*Shrugs* Just a thought, nothing more.
Posts: 21 | Registered: Saturday, March 20 2004 08:00
Shock Trooper
Member # 1444
Profile #7
@ The Creator: True, but wouldn't that leave a gap, a flicker, or something?

@ Macman0: I don't know if it would work, and I dont have the skills yet to pull anything like that off, yet. Thanks anyway.
Posts: 250 | Registered: Saturday, July 6 2002 07:00
The Establishment
Member # 6
Profile #8
Items do have the lifesaver ability that has a 5% * item strength of working. So give an item one charge and 20 strength of life saving and it will do as you want.

--------------------
Your flower power is no match for my glower power!
Posts: 3726 | Registered: Tuesday, September 18 2001 07:00
Board Administrator
Member # 1
Profile Homepage #9
Look at the script t9griffon.txt in Diplomacy of the Dead. I think this is along the lines of what you're looking for.

The main risk is that the party will do so much damage in a round that the monster will die before it gets a chance to become friendly. If you really, really want this creature to live, you might want to have scripts watch for the creature being killed and respawn it if it dies before it has a chance to become friendly.

--------------------
Official Board Admin
spidweb@spiderwebsoftware.com
Posts: 960 | Registered: Tuesday, September 18 2001 07:00
BoE Posse
Member # 112
Profile #10
Put standard standing-up graphics in the death animation slots, then.

Or if you want to script it and make sure it doesn't die too soon, you could just give it way more health than it really should have.

--------------------
Rate my scenarios!

Areni
Revenge
To Live in Fear
Deadly Goblins
Ugantan Nightmare
Isle of Boredom
Posts: 1423 | Registered: Sunday, October 7 2001 07:00
Apprentice
Member # 4123
Profile #11
I've been testing my ideas here (I need the script practice) and I have the life saving item working... most of the time. And the turn friendly script working... pretty much all of the time. But I can't get the command to remove the object to work. It keeps saying "Peculiar Error. Undefined Function." Or something like that anyway.

if (char_has_item(ME,447))
char_take_item(ME,447);

What am I doing wrong in the above statement. The item exists, and the character DOES have it. If I just put a little print statement after the if line it goes through just fine and prints the line for me. So I think it's the char_take_item command. I just don't see what's wrong. :confused:
Posts: 21 | Registered: Saturday, March 20 2004 08:00
Shock Trooper
Member # 4154
Profile #12
Hm. Its possible that

A) The function char_take_item doesn't work on monsters.

B) ME doesn't work with char_take_item.

C) Something else is wrong.

If neither of the top two (which I am unable to test, as BoA hasn't arrived yet) is true, then I haven't the slightest as to what's wrong.

--------------------
You're a moron if you think I'm not.
Posts: 213 | Registered: Friday, March 26 2004 08:00
Apprentice
Member # 4123
Profile #13
Well... It's not the "ME" that won't work. Either way though, it seems to be a moot point. The 100% life saving objects only seem to work about 85% of the time so. So... good luck whoever needed help. I tried. :P
This "Peculiar Error. Undefined Function Called." thing really bugs me though. I can't find that error listed anywhere. So it really is a bit... peculiar.
Posts: 21 | Registered: Saturday, March 20 2004 08:00
Triad Mage
Member # 7
Profile Homepage #14
It should be if (char_has_item(ME,447) == 1)

--------------------
"At times discretion should be thrown aside, and with the foolish we should play the fool." - Menander
====
Drakefyre's Demesne - Happy Happy Joy Joy
Encyclopedia Ermariana - Trapped in the Closet
====
You can take my Mac when you pry my cold, dead fingers off the mouse!
Posts: 9436 | Registered: Wednesday, September 19 2001 07:00
Apprentice
Member # 4123
Profile #15
It doesn't make a difference either way it would seem. I still get the same error. It is in the char_give_item / char_take_item calls. At least I think so. The if statement works fine. I put a little print call right after it to test if it does actually work, and that's not the problem.

if (char_has_item(my_number(),447) == 1) {
@@@@@print_str("Yep");
@@@@@print_big_str("I am ",my_number()," !");
@@@@@char_take_item(my_number(),447);
@@@@@}

(@ characters to fill in space)
Posts: 21 | Registered: Saturday, March 20 2004 08:00
Shock Trooper
Member # 1444
Profile #16
*Looks through t9griffon.txt .* Hmm, yeah... Thanks, that helps! Next time I'll look through the scripts before I ask something stupid.
Posts: 250 | Registered: Saturday, July 6 2002 07:00