DragonPrime - LoGD Resource Community
Welcome Guest
  • Good evening, Guest.
    Please log in, or register.
  • May 25, 2013, 11:26:58 PM
Home Forums News Links Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
IRC Channels
Search

Pages: 1 2 3 [4] 5   Go Down
  Print  
Author Topic: Creatures with A.I.  (Read 24076 times)
0 Members and 1 Guest are viewing this topic.
danbi
Codemeister
****
Offline Offline

Posts: 366


View Profile
« Reply #45 on: July 04, 2007, 01:33:58 PM »

Mea culpa Smiley I was searching for 'creaturescript' instead. The mention of ai.php has confused me.

This one was the last drop, so converting to 1.1.1 is inevitable Smiley Great!
Logged
ThricebornPhoenix
Codemeister
****
Offline Offline

Posts: 368


Dying is the easy part.


View Profile
« Reply #46 on: July 07, 2007, 08:13:26 PM »

Would be better if you didn't have to go back and forth between editor and forest when testing. *hint, hint*

<_<
Logged

"I'm no hand at casuistry, but I can't break my word to a modern pessimist. It's like breaking one's word to a child." ~ The Man Who Was Thursday, G. K. Chesterton
Iori
Mod God
*****
Offline Offline

Posts: 832


View Profile WWW
« Reply #47 on: July 07, 2007, 11:24:33 PM »

Would be better if you didn't have to go back and forth between editor and forest when testing. *hint, hint*

<_<


Use separate files for the scripts  Tongue
Logged

ThricebornPhoenix
Codemeister
****
Offline Offline

Posts: 368


Dying is the easy part.


View Profile
« Reply #48 on: July 07, 2007, 11:31:23 PM »

I do... on my local install. Online, though... that would require a lot more more FTP'ing, which lags my computer. Undecided
Logged

"I'm no hand at casuistry, but I can't break my word to a modern pessimist. It's like breaking one's word to a child." ~ The Man Who Was Thursday, G. K. Chesterton
Nightborn
Guest
« Reply #49 on: July 08, 2007, 12:00:55 AM »

if you want to use *one* script for different creatures, why not use in the editor:

require("scripts/killall.script");

and then put the script into that file? =)

if you then use no fixed names but the creature name, well, you have a script working for all creatures.
if you want all creatures to do many things, simply require in randomly...
Logged
ThricebornPhoenix
Codemeister
****
Offline Offline

Posts: 368


Dying is the easy part.


View Profile
« Reply #50 on: July 09, 2007, 05:01:40 AM »

All I want is to be able to edit a script, hit a button, and be in a battle with an enemy using that script. I think I started a module for that some months ago and quit when I realised that I hate forms Roll Eyes I may try again when I need a challenge.
Logged

"I'm no hand at casuistry, but I can't break my word to a modern pessimist. It's like breaking one's word to a child." ~ The Man Who Was Thursday, G. K. Chesterton
Nightborn
Guest
« Reply #51 on: July 09, 2007, 05:40:06 AM »

not too hard, you would need a simple battle module for that.

the "button" sets up the fight.

being an admin, you can put in options to quit the fight and stuff.
Logged
ThricebornPhoenix
Codemeister
****
Offline Offline

Posts: 368


Dying is the easy part.


View Profile
« Reply #52 on: July 10, 2007, 10:05:15 AM »

I haven't done much battle code yet, and nothing with forms in PHP... but yes, it could turn out to be easier than I expect. Smiley

About allowing scripts to run at certain times... would it be possible to specify 'sections' in scripts (sort of like the sections in templates, maybe), have them process at the beginning of the battle, and run each section when appropriate (e.g. start of battle, start of round, end of round, end of battle...)? Or is this not feasible due to requiring a major rewrite (or some other reason)?
Logged

"I'm no hand at casuistry, but I can't break my word to a modern pessimist. It's like breaking one's word to a child." ~ The Man Who Was Thursday, G. K. Chesterton
XChrisX
Global Moderator
Mod God
*****
Offline Offline

Posts: 4647

Be aware of the squirrel!


View Profile WWW
« Reply #53 on: July 10, 2007, 10:25:11 AM »

it would be feasible, but it would require a seperate block in the table for each section.
I could live with an additional "start of round"-script. (you can use this as a start-of-battle script,t oo with a proper counter. Smiley
Logged

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

Posts: 368


Dying is the easy part.


View Profile
« Reply #54 on: July 10, 2007, 10:51:02 AM »

I could live with an additional "start of round"-script.

I still would need a way to, e.g., unsuspend buffs or companions after a creature dies >_> but that would be great Smiley

(you can use this as a start-of-battle script,t oo with a proper counter. Smiley

Yes, of course... seems obvious now that you've pointed it out. Embarrassed
Logged

"I'm no hand at casuistry, but I can't break my word to a modern pessimist. It's like breaking one's word to a child." ~ The Man Who Was Thursday, G. K. Chesterton
aeanos
Militia
**
Offline Offline

Posts: 63



View Profile WWW
« Reply #55 on: October 13, 2008, 12:34:43 PM »

Alright... I'm trying to work on the creatures for my game, and seem to be running into a bit of a brick wall on the AI....

I know the answer to what I want to do lies in the Killer Bee Queen script below, but can't seem to figure out why it would call reinforcements every second round (as opposed to every round). To make a long story short, I simply want to be able to have more than one of a creature pop up at one time... For example a Rat Swarm, where 3 pop up at the beginning of the battle, with no more being called. If possible, I would also like to have a "random" variable for how many show up, such as 1-3, which I'm sure would be a simple array.

Any help you can offer would be greatly appreciated.

Killer Bee Queen, Level 12

Code:
global $session;
if ($session['user']['dragonkills'] > 7 && e_rand(0,1)) {
  global $needtostopfighting;
  $needtostopfighting = true;
  $bee = array(
    "creaturename"=>"`6Killer Bee`0",
    "creatureweapon"=>"Sting of Death",
    "creaturelevel"=>10,
    "creaturehealth"=>50,
    "creatureattack"=>19,
    "creaturedefense"=>14,
    "creaturegold"=>180,
    "creatureexp"=>57,
    "alwaysattacks"=>true,
  );
  require_once("lib/forestoutcomes.php");
  battle_spawn(buffbadguy($bee));
  battle_spawn(buffbadguy($bee));
  output("`^The Killer Bee Queen calls two of her minions for help!`0");
}
Logged

Come visit The Manifesting Mission of Christ, a Gnostic Christian healing and teaching ministry, located in Northern California.
Anharat
Captain of the Guard
***
Offline Offline

Posts: 191


View Profile WWW
« Reply #56 on: October 13, 2008, 01:57:09 PM »

I modifyed XChrisX's Script for the Killer Bee for your purpose, i hope he dont mind.  Smiley

I havenot tested it so i'm not sure if its works or not.

Code:
global $badguy;
if (!isset($badguy['spellpoints'])) {
  $badguy['spellpoints'] = 1;
}
if($badguy['spellpoints']==1){
  global $needtostopfighting;
  $needtostopfighting = true;
  $minion = array(
    "creaturename"=>"`7Rat`0",
    "creatureweapon"=>"Teeth",
    "creaturelevel"=>10,
    "creaturehealth"=>50,
    "creatureattack"=>19,
    "creaturedefense"=>14,
    "creaturegold"=>180,
    "creatureexp"=>57,
    "alwaysattacks"=>true,
  );
  require_once("lib/forestoutcomes.php");
  $rand = e_rand(1,3);
  for($i=0;$i < $rand;$i++){
    battle_spawn(buffbadguy($minion));
  }
  output("`^The XY (whatever) calls $rand of his/her minions for help!`0");
  $badguy['spellpoints']=0;
}

This spawns 1 to 3 minions at the beginning of the fight and no more... i hope Wink
Like i said i have not tested it.

greetings Anharat
« Last Edit: October 13, 2008, 02:13:48 PM by Anharat » Logged

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

Posts: 1568

MarcTheSlayer


View Profile WWW
« Reply #57 on: October 13, 2008, 02:28:59 PM »

Every second round probably had something to do with the e_rand() on the 2nd line.

I played around and came up with this, slight changes.
Code:
global $session;
// If you want bee support to arrive every round then remove e_rand from if().
if( $session['user']['dragonkills'] > 7 && e_rand(0,1) == 1 )
{
global $needtostopfighting, $badguy;
$needtostopfighting = true;
$bee = array("creaturename"=>"`6Killer Bee`0",
"creatureweapon"=>"Sting of Death",
"creaturelevel"=>10,
"creaturehealth"=>50,
"creatureattack"=>19,
"creaturedefense"=>14,
"creaturegold"=>180,
"creatureexp"=>57,
"alwaysattacks"=>true,
);
// How many bees? Between 2 and 4.
$rand = e_rand(2,4);
require_once("lib/forestoutcomes.php");
for( $i=0; $i<$rand; $i++ )
{
battle_spawn(buffbadguy($bee));
}
output("`n`b`^The %s `^calls to %s of her minions for help!`b`0`n`n",$badguy['creaturename'],$rand);
}

As you can see, I pick a random number between 2 and 4 and that's the bees that get created. I wouldn't increase that until you test it a good few times and see that it's very difficult to beat if 2 or more keep joining the fight every round. Smiley
Logged

aeanos
Militia
**
Offline Offline

Posts: 63



View Profile WWW
« Reply #58 on: October 13, 2008, 02:50:39 PM »

Hmmmm... Working off of those two answers, and going more with Afkamm's way of doing it... couldn't I just do this to have 1-3 pop up at once for the battle (as a group, not as reinforcements)?
Code:
global $session;
if( $session['user']['dragonkills'] > 7 && e_rand(1,3) == 1 )
{
global $needtostopfighting, $badguy;
$needtostopfighting = true;
$bee = array("creaturename"=>"`6Killer Bee`0",
"creatureweapon"=>"Sting of Death",
"creaturelevel"=>10,
"creaturehealth"=>50,
"creatureattack"=>19,
"creaturedefense"=>14,
"creaturegold"=>180,
"creatureexp"=>57,
"alwaysattacks"=>true,
);
require_once("lib/forestoutcomes.php");
}

It just seems like what I'm really trying to do is far simpler than the options I've been given... If this isn't right though, let me know, as (X)HTML and CSS are my strong suits... PHP is still a bit new.  Wink

One part I'm really not sure about on this one is the "e_rand(1,3) == 1 " up top... I have the feeling is should be (0,3). Also, I took off the "for( $i=0; $i<$rand; $i++ )", as I assumed it had something to do with the reinforcements phase.

As for how tough it would make a fight though, I only plan on using this for things that are weak and travel in packs like Rats, etc. to make things more "realistic". Basically make 1-3 rats with say 3 hitpoints each. I just need to figure out how to make them all pop up at once, as the rest is pretty straight forward.  Cool
« Last Edit: October 13, 2008, 02:59:40 PM by aeanos » Logged

Come visit The Manifesting Mission of Christ, a Gnostic Christian healing and teaching ministry, located in Northern California.
Afkamm
Mod God
*****
Offline Offline

Posts: 1568

MarcTheSlayer


View Profile WWW
« Reply #59 on: October 13, 2008, 04:29:25 PM »

e_rand(X,Y) is quite simple, it will take X and Y and choose a number between them. So it will either choose 1, 2 or 3. Doesn't matter what the numbers are. The lower X is and the higher Y is means a less chance of the IF statement being run.

for( $i=0; $i<$rand; $i++ ) simply loops through the code that's inside the curly brackets a certain amount of times. Saves on code if you're just repeating yourself.

battle_spawn(buffbadguy($bee)); is missing. You need this to add the badguy ($bee) to the fight. There are two parts to this, battle_spawn() which adds the badguy, and buffbadguy() which comes from 'forestoutcomes.php'. This is needed because of the $bee array which is new to the fight.

How many times do you want the 1-3 rats to appear? Once, twice, every round?
Logged

Pages: 1 2 3 [4] 5   Go Up
  Print  
 
Jump to:  


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

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