Warning: preg_replace_callback(): Requires argument 2, '$func['entity_fix']('\2')', to be a valid callback in /nfs/c01/h06/mnt/10927/domains/dragonprime.net/html/Sources/Load.php(225) : runtime-created function on line 3

Warning: preg_replace_callback(): Requires argument 2, '$func['entity_fix']('\2')', to be a valid callback in /nfs/c01/h06/mnt/10927/domains/dragonprime.net/html/Sources/Load.php(225) : runtime-created function on line 3
[AI Script] Experience Steal-n-Heal
DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • September 20, 2019, 03:05:49 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

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

Posts: 1016


Zeno's Arrow never hits the mark.


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
I'm not currently a fully active member of DP, though I do respond to most 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: 1016


Zeno's Arrow never hits the mark.


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
I'm not currently a fully active member of DP, though I do respond to most PMs.
Anharat
Codemeister
****
Offline Offline

Posts: 283



View Profile
« 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
KaosKaizer
Mod God
*****
Offline Offline

Posts: 1016


Zeno's Arrow never hits the mark.


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
I'm not currently a fully active member of DP, though I do respond to most 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: 1016


Zeno's Arrow never hits the mark.


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
I'm not currently a fully active member of DP, though I do respond to most PMs.
MarcTheSlayer
Mod God
*****
Offline Offline

Posts: 1752


View Profile
« 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

Check My Modules for the latest versions.
Aeolus
Mod God
*****
Offline Offline

Posts: 1934


You're welcome.


View Profile WWW
« Reply #8 on: January 15, 2015, 04:45:11 AM »

Reviving an old thread... But does $badguy['maxhealth'] even exist? Debugging, I get it set to 0 (hence it auto-kills the creature in question), and nothing comes up in Code Search for it.
Logged

Sunday
Codemeister
****
Offline Offline

Posts: 406


So meme'd up.


View Profile
« Reply #9 on: January 18, 2015, 11:18:38 AM »

Reviving an old thread... But does $badguy['maxhealth'] even exist? Debugging, I get it set to 0 (hence it auto-kills the creature in question), and nothing comes up in Code Search for it.
A glimpse into OP's modified battle script. It has never existed.
Logged

Slowly progressing fork with PHP 7 support: https://github.com/stephenKise/Legend-of-the-Green-Dragon
Cheap VPS Hosting (10$ credit!): https://m.do.co/c/acde75b086c5

A new server in the making...
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
77 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search