Legendary Tales Official Website
News Search:
Home · Articles · Downloads · Discussion Forum · Old Forums (read only) · RegisterAugust 28 2008 04:46:26
Navigation
Home
Articles
Downloads
FAQ
Discussion Forum
Web Links
News
Contact Me
Screenshots
Search
Login
Username

Password

Save



Not a member yet?
Then register.

I forgot my password.

Why register?
Newsletter
Subscribe now to receive important news, game releases and site updates
Buy 3 Skulls only $9.99

Download a demo

Full version download immediately after purchase!

You can also use your credit card without a paypal account.

Visa Mastercard American Express Discover
Random Combat (by Kamakani)
In some instances you may want to implement random chances of combat? whether it's out of doors or in a dungeon. This can be done by scripting in a random roll when entering a location.

First go to the Creatures folder and create a new monster. Name it 'Spider' and set its Max Endurance to 2 and Endurance to 2. Go to the Battle tab and set the Damage Type to Pierce and Attack Type to Melee. Click on the Use Damage Table and set the values to 1,1,1,2,2,2. This will make the spider do 1 point of damage on a roll of 1-3 and 2 points of damage on a roll of 4-6.

Now go to the Locations folder and create a new location. Name this location "Attic" and link it to the Wild Rats Inn. Now click on the Script tab in the Attic and cut and paste this code into the script:

UseLib("def.js");

function OnEnter(){
i = Rnd(1,3); //a random number from 1 to 3
if ( i == 1){
AddContent(6001001,1001004,3,0); //add three rats
EnterCombat();
}
else if ( i == 2){
AddContent(6001004,1001004,2,0); //add two spiders
EnterCombat();
}else{
//do nothing here
}
return true;
}
function OnExit(){
foreach(4,"AlterVisibility(Current.ID,false);");
}

Here you have two functions. OnEnter and OnExit. OnEnter means every time you enter this location it will activate the code defined within the OnEnter function. In This code the OnEnter function is a Random Roll between 1 and 3. If the roll = 1 then 3 mice are placed into the location specified in the AddContent, and then they immediately engage you in combat. If the random roll is 2 then it adds 2 Spiders into the room and they immediately engage you in combat. On a roll of 3 since it is not defined, nothing happens.

OnExit means that every time you exit the location it will activate the code defined within the function. When exiting from this location the engine will do a search for each global variable defined in the def.js under Foreach. Here the search is for all Dead which are hidden when you exit the room using the altervisibility code. This is used so the random combat generators and OnEnter combat functions don't create so many dead corpses in a room that you have to sift through them to find the ones that have loot.

Now? Save your project and launch the engine to test your random generators.
Comments
Throndir on June 23 2007 00:02:34
For anyone looking to make a game. Random encounters a must. They make any game more interesting. (Late by a few months, but) Nice job on the script.
Terra on July 11 2007 21:37:58
Random everything can keep a project interesting. The same act with multiple different consequences give it a slight sense of reality too.
DNDREMIX on November 29 2007 20:04:04
Randomness is the spice of life, if a person play through a game twice, they don't want to see the same exact game again.
Post Comment
Please Login to Post a Comment.
Ratings
Rating is available to Members only.

Please login or register to vote.

Awesome! Awesome! 75% [3 Votes]
Very Good Very Good 25% [1 Vote]
Good Good 0% [No Votes]
Average Average 0% [No Votes]
Poor Poor 0% [No Votes]
Play Online Now
Play Now
Requirements and info
Terms of Service
Privacy Policy
RSS Newsfeed
Shoutbox
You must login to post a message.

Throndir
21/08/2008 10:54
Then read this tutorial. http://h1.ripway.com/thro
ndir/Delete After Files/Tutorial.zip


Throndir
21/08/2008 10:51
It depends what you're trying to do. If you want to create a textbased game, download the engine and editor.

jfreak
20/08/2008 02:52
how do i begin smiley?

MrHelem
17/08/2008 15:22
Nevermind, got it figured out.

MrHelem
17/08/2008 04:13
Hey, can anyone tell me how to set up a custom skill so it uses mana? I scanned the tutorials and didn't find anything.

Throndir
10/08/2008 13:33
Or check out legendarytales.wikispaces
.com


Throndir
10/08/2008 13:09
Yes. Post in the forums with your problem.

critchell
09/08/2008 17:46
i need some help with a particular script which adds a new member to a party, can anyone help?

Throndir
05/08/2008 14:24
Legendarytales is a game engine and editor. You basically create textbased games, or hope for any other person to create an adventure so you could play it..

Delphinus
05/08/2008 10:17
You create. Check the 'Downloads' page.

Shoutbox Archive
Copyright www.legendarytales.com © 2001 - 2008

Terms Of Service Privacy Policy
eXTReMe Tracker