DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • July 19, 2019, 02:58:31 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] Bladebiter  (Read 5429 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 07, 2007, 07:28:42 PM »

This probably breaks more rules... but that's not all Grin There's an ever-increasing chance that a monster using this script will break the player's weapon! The debug (and previous line) can be removed... was needed for testing. The trio of variables following that are used for the debuglog (so you can see exactly what was lost).

It won't break your weapon if you don't have one - technically, if your weapon has 0 power Roll Eyes Increase $limit to reduce the chance of occuring. Give it to a monster on level 10-14 to give wealthy players something to do with their gold.


Code:
global $badguy, $session;

if ($session['user']['dragonkills'] > 5 && ($session['user']['gold'] > 4000 || $session['user']['gems'] > 0) && $session['user']['weapondmg'] > 0) {
if (!isset($badguy['spellpoints'])) {
$badguy['spellpoints'] = 0;
}
$limit = 25;

if($badguy['spellpoints'] <= $limit) {
$badguy['spellpoints']++;
}
$chance = e_rand($badguy['spellpoints'], $limit);

$magic = $badguy['spellpoints'];
debug("spellpoints: $magic, chance: $chance");

$weapon = $session['user']['weapon'];
$weapondmg = $session['user']['weapondmg'];
$weaponvalue = $session['user']['weaponvalue'];

if ($chance == $limit) {
output("`n`\$The %s `\$bites down hard on your %s`\$, and you hear a heart-wrenching `bsnap`b!`n`n", $badguy['creaturename'], $session['user']['weapon']);
debuglog("a $weapon, power $weapondmg, worth $weaponvalue, was broken by a monster");
$session['user']['weapon'] = translate("Fists", "ai");
$session['user']['attack'] -= $session['user']['weapondmg'];
$session['user']['weapondmg'] = 0;
$session['user']['weaponvalue'] = 0;
}
}
« Last Edit: December 01, 2007, 02:19:26 AM 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 07, 2007, 10:53:24 PM »

Code:
$session['user']['weapon'] = translate_inline("Fists", "ai");

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 07, 2007, 11:07:28 PM »

What, exactly, does that do? And is it needed every time you change a weapon, or only in A.I. scripts? (Every time I think I understand translations... >_<)
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 07, 2007, 11:28:34 PM »

"Fists" is neither German nor French nor Polish nor Spain nor Russian... So you need to translate the name.
And yes, everytime you assign a weapon name in a module you should translate it first (same for armor).
Logged

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

Posts: 370


Dying is the easy part.


View Profile
« Reply #4 on: July 07, 2007, 11:55:31 PM »

Okay, I understand about modules... but if it's in an A.I. script, why can't admins just translate it within the script? <_<
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 #5 on: July 08, 2007, 12:52:40 AM »

Yes, okay. they can. Alright. Smiley But think of those admins, that are barely able to copy & paste...
* XChrisX searches for arguments. Ah, there! under that stone. ...
Logged

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

Posts: 370


Dying is the easy part.


View Profile
« Reply #6 on: December 01, 2007, 02:24:52 AM »

Tweaked the original script and wrote an accompanying 'armor thief' script, per request. Smiley

Code:
global $badguy, $session;

if ($session['user']['dragonkills'] > 5 && ($session['user']['gold'] > 4000 || $session['user']['gems'] > 0) && $session['user']['armordef'] > 0) {
if (!isset($badguy['spellpoints'])) {
$badguy['spellpoints'] = 0;
}
$limit = 25;

if($badguy['spellpoints'] <= $limit) {
$badguy['spellpoints']++;
}
$chance = e_rand($badguy['spellpoints'], $limit);

$magic = $badguy['spellpoints'];
debug("spellpoints: $magic, chance: $chance");

$armor = $session['user']['armor'];
$armordef = $session['user']['armordef'];
$armorvalue = $session['user']['armorvalue'];

if ($chance == $limit) {
$newarmor = translate("T-Shirt", "ai");
output("`nThe sound of shattering glass fills the air.  You stoop down to pick up a shard of mirror and see that your armour has been replaced with a %s.`n`n", $newarmor);
debuglog("a $armor, power $armordmg, worth $armorvalue, was lost to a mirror");
$session['user']['armor'] = $newarmor;
$session['user']['defense'] -= $session['user']['armordef'];
$session['user']['armordef'] = 0;
$session['user']['armorvalue'] = 0;
}
}
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."
Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Welcome to DragonPrime - The LoGD Resource Community!

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