DragonPrime - LoGD Resource Community
Welcome Guest
  • Good afternoon, Guest.
    Please log in, or register.
  • May 18, 2013, 01:56:54 PM
Home Forums News Links Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
IRC Channels
Search

Pages: [1]   Go Down
  Print  
Author Topic: [AI Script] Experience Steal-n-Heal  (Read 4015 times)
0 Members and 1 Guest are viewing this topic.
KaosKaizer
Mod God
*****
Offline Offline

Posts: 1000


Love bites, but so do I!


View Profile
« on: April 09, 2011, 07:47:47 AM »

This gives a random chance to steal a random amount of the players experience and use that experience to heal the badguy.
(this is already included in the UpAI module if you want to use that.)

Code:
<?php
require_once("common.php");
global 
$session,$badguy;
$exp 100// max EXP to steal.
$mch 25// chance to steal EXP. Percentage based, IE, default of 25 = 4% chance.
$dks 0// dks needed before badguy can try to steal-n-heal.

if ($session['user']['dragonkills'] >= $dks){
$steal e_rand(1,$exp);
$chance e_rand(1,$mch);
if ($badguy['creaturehealth'] <= ($badguy['maxhealth']*0.75) && $chance == 1) {
  
$badguy['creaturehealth'] += $steal;
  
debug("$steal points of experience were stolen from {$session['user']['name']}");
  
$session['user']['experience'] -= $steal;
  
output("`n`#%s`% steals %s points of your experience and uses it to heal themself!`n",$badguy['creaturename'],$steal);
$badguy['spellpoints']++;
}
if ($badguy['creaturehealth'] > $badguy['maxhealth']) $badguy['creaturehealth'] = $badguy['maxhealth'];

// Because he can heal, let's increase his experience reward by a percentage every round.
debug($badguy['creatureexp']);
$pne $badguy['creatureexp'] * .01// 1%
$r e_rand(1,5);
if (
$r == 1$pne ceil($pne);
$badguy['creatureexp'] += $pne;
debug($badguy['creatureexp']);
}

The chance(mch) setting is percentage based, so here is a list of increments of ten(as well as numbers 5, 25, and 75, jic) of the percentage chances for each setting:
100 - 1%
90 - 1.11% (continuous)
80 - 1.25%
75 - 1.33% (continuous)
70 - 1.428%
60 - 1.66% (continuous)
50 - 2%
40 - 2.5%
30 - 3.33% (continuous)
25 - 4%
20 - 5%
10 - 10%
5 - 20%
1 - 100%
« Last Edit: April 14, 2011, 02:52:24 PM by KaosKaizer » Logged

My Mods
Like to read? "Like" my page. Smiley
For reasons I'd prefer not to explain, I will not be active until further notice. I will not make any posts and I will ignore all PMs.
Tomka92
Member

Offline Offline

Posts: 1


View Profile
« Reply #1 on: April 10, 2011, 10:27:30 AM »

Where i can download the newest Version?
Logged
KaosKaizer
Mod God
*****
Offline Offline

Posts: 1000


Love bites, but so do I!


View Profile
« Reply #2 on: April 10, 2011, 10:40:55 AM »

Where i can download the newest Version?

You can copy that into the AI section of the monsters, or you can download my UpAI module, which has a copy of this in it. In the UpAI, the file for this AI is "ai_steal-n-heal.php".
Logged

My Mods
Like to read? "Like" my page. Smiley
For reasons I'd prefer not to explain, I will not be active until further notice. I will not make any posts and I will ignore all PMs.
Anharat
Captain of the Guard
***
Offline Offline

Posts: 191


View Profile WWW
« Reply #3 on: April 13, 2011, 12:57:24 AM »

Maybe you should think about adding the stolen exp to the creatruesexp so players get that back on battleend. A healing enemy is harder than normal anyway and if you lose exp to while fighting, well, users might get upset.  Wink
Logged

In a World of Compromise, we don't!
KaosKaizer
Mod God
*****
Offline Offline

Posts: 1000


Love bites, but so do I!


View Profile
« Reply #4 on: April 13, 2011, 12:04:54 PM »

What if I were to just increase the creatureexp by a percentage every round, so the longer it takes to beat, the more the user gets back. This way, they could end up with a larger amount because the chances of the creature stealing is admin settable, but by default is a 4% chance of occuring.

I'll update it later, after testing.
Logged

My Mods
Like to read? "Like" my page. Smiley
For reasons I'd prefer not to explain, I will not be active until further notice. I will not make any posts and I will ignore all PMs.
windsummoner
Captain of the Guard
***
Offline Offline

Posts: 107



View Profile WWW
« Reply #5 on: April 13, 2011, 07:58:22 PM »

I think this AI is nice. I'm looking foward the update of it. ^^
Logged

Time waits for no one ~
KaosKaizer
Mod God
*****
Offline Offline

Posts: 1000


Love bites, but so do I!


View Profile
« Reply #6 on: April 14, 2011, 03:02:30 PM »

UPDATE!
I have added the change to experience I mentioned above. At the end of the turn, the badguy with this AI will get a 1% experience increase. If you want to change the 1%, just change .01 in the code below to what you want it to be. (20% = .2; 50% = .5; 3% = .03, et cetera)
Code:
$pne = $badguy['creatureexp'] * .01;
This is near the end of the AI script.
Logged

My Mods
Like to read? "Like" my page. Smiley
For reasons I'd prefer not to explain, I will not be active until further notice. I will not make any posts and I will ignore all PMs.
Afkamm
Mod God
*****
Offline Offline

Posts: 1563

MarcTheSlayer


View Profile WWW
« Reply #7 on: April 14, 2011, 04:23:05 PM »

This gives me an idea for a lodge module. Get a percentage increase on the experience gained after each fight for so many fights. Smiley
Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Play LoGD on Dragonprime

Support Us
$100 raised this year
Your help is greatly appreciated!
Who's Online
17 Guests, 0 Users
DragonPrime LoGD
Recent Topics
Home Forums News Links Downloads Login Register Advanced Search