DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • July 19, 2019, 03:57:09 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1]   Go Down
  Print  
Author Topic: [A.I. Script] - Bat  (Read 3376 times)
0 Members and 1 Guest are viewing this topic.
ThricebornPhoenix
Codemeister
****
Offline Offline

Posts: 370


Dying is the easy part.


View Profile
« on: July 04, 2007, 05:15:13 PM »

Give this to your bat enemies (by default, there's one for almost every level) if you want to help reduce your player's turns Smiley Every round, for the first three rounds, there's a 1 in 10 chance of the player losing a turn. Won't take the last turn.

Code:
global $badguy, $session;

if (!isset($badguy['spellpoints'])) {
$badguy['spellpoints'] = 3;
}

if ($badguy['spellpoints'] > 0) {
output("`n`7It's driving you batty...");
if (e_rand(0,9) == 0 && $session['user']['turns'] > 1) {
output("you feel like a dingbat!`n");
$session['user']['turns'] -= 1;
debuglog("lost a turn to a bat");
$badguy['spellpoints'] -= 1;
}
else {
output("`&but you resist it`7!`n");
$badguy['spellpoints'] -= 1;
}
}
« Last Edit: July 04, 2007, 09:29:45 PM by ThricebornPhoenix » Logged

"I was talking aloud to myself. A habit of the old: they choose the wisest person present to speak to; the long explanations needed by the young are wearying."
XChrisX
Global Moderator
Mod God
*****
Offline Offline

Posts: 4647

Be aware of the squirrel!


View Profile WWW
« Reply #1 on: July 04, 2007, 09:15:52 PM »

Not only the first three turns. Wink Throughout the whole battle you may loose turns. (and a debuglog entry would be nice Smiley )
Logged

Running for more than three years now:
ThricebornPhoenix
Codemeister
****
Offline Offline

Posts: 370


Dying is the easy part.


View Profile
« Reply #2 on: July 04, 2007, 09:24:48 PM »

Not only the first three turns. Wink Throughout the whole battle you may loose turns. (and a debuglog entry would be nice Smiley )

Hmm... would isset return false if the value was 0? I should revise the script if so. Otherwise, it will only run the first three rounds, since it deducts 1 point each round whether it works or not.

I don't know why I didn't think of a debuglog. I'll edit one in.
Logged

"I was talking aloud to myself. A habit of the old: they choose the wisest person present to speak to; the long explanations needed by the young are wearying."
XChrisX
Global Moderator
Mod God
*****
Offline Offline

Posts: 4647

Be aware of the squirrel!


View Profile WWW
« Reply #3 on: July 04, 2007, 09:32:51 PM »

ARGH. Yes. I missed the second $badguy['spellpoints'] -= 1; Wink

*D'oh!*
Logged

Running for more than three years now:
Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Version 1.1.2 is the current supported version and is available for download.

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
101 Guests, 1 User
Nightborn
Home Forums News Downloads Login Register Advanced Search