FightingFantasyAddict
Guest
|
Post by FightingFantasyAddict on Mar 30, 2010 19:16:37 GMT
How would I make someone fight say a wolf as in it's a wolf you will have to fight him..... Cold someone please help with the coding thanks
|
|
|
Post by Zaphod Beeblbrox on Mar 31, 2010 11:24:03 GMT
Hi 1) First make sure you have included the following libraries in your book: GeneralLib FFLib FFCombat To do this, go to the Function editor in the Adventure Creator home page. In the box list 'Your Book SEL files' Highlight the book you are creating and click 'Load' at the bottom of the box. The page will refresh, then go to the 4 boxes right at the bottom of the page (2 columns Included and Excluded), in the row marked 'Hosted' Library there should be 5 items in the 'Excluded' box column (i.e. the bottom right box). Hold down Cntrl on your keyboard and click on the three files 'General Lib', 'FFLib', 'FFCombat', then scroll back up to the main editing box, below which is the button 'Save', click on that. If everything has gone well, the three files should now be in the 'Included' column at the bottom. This makes all the functions in those files available to all the pages in your adventure (i.e. you only have to do this once for the whole adventure). Most mportantly it activates the Fighting Fantasy combat routines (when I get round to making Lone Wolf Libraries there will be similar LoneWolfCombat libraries etc.) 2) Add this to your page on which you want the combat: <SCRIPT script="&combat_1on1(123,1,0,'Wolf'',8,10);"></script> <IF condition="$combat[7] eq 'won';" reval="yes">If you win, <TT ref="100">Turn to 100</TT></IF> Replace the 123 with the reference name/number your combat is actually on (i.e. the page you enter that code). If the reference is a named reference, not just a number, enclose it in single apostrophes (i.e. 'wolf combat page'). The 1 is an index of the combat number on that page (i.e. if you had more than one combat on that page you would increase that number with each combat). The 0 is the escape flag (0=no escape allowed, 1=allow escaping, 2=escape allowed enemies automatically hit you). The 8 and the 10 are Skill and Stamina. Finally the IF tag simply checks the state of the special flag variable $combat[7] to see if you win the combat, and only activates the Turn To tag when you do. Note that if you allow escaping you will have to add another test for $combat[7] eq 'escaped', i.e.: <IF condition="($combat[7] eq 'won') or ($combat[7] eq 'escaped');" reval="yes">If you win, or escape the fight, <TT ref="100">Turn to 100</TT></IF> Simples
|
|
FightingFantasyAddict
Guest
|
Post by FightingFantasyAddict on Apr 1, 2010 8:20:46 GMT
Thank you, sorry to be a pain but this code doesn't seem to work could you please help if it helps find out the problem when i click the link to this page it comes up with: Unknown function: GetItem, called in function: main at exec_code.pl line 346. <EVENT event="&GetItem('rabbit')">you pick up the fruit of you labor</EVENT> thanks again
|
|
|
Post by Zaphod Beeblbrox on Apr 2, 2010 13:40:08 GMT
Ah - that would be my fault. The example function &GetItem I mentioned in the guide doesn't actually exist - it was just meant as an example of how to use a SEL function (any function). I really should replace that example with &addtolist which does exactly what you are hoping for. The list of built in functions is avaiable in the section 'SEL Functions' of the guide pages.
To achieve what you are trying to do there, try this:
1) Make a permanent variable right at the start of your adventure (reference 0 perhaps) to store the list of items. e.g.
<EVENT event="&permvar $items;"></EVENT>
2) Add a display instruction to your charsheet file to display items in the variable $items e.g.
Items: <INFO info="$items"></INFO>
There is a better function for doing this, &display_compact_list, available in the library GeneralLib, if you want to try this, include that library in your adventure as detailed earlier, and put the following in your charsheet file:
Items: <SCRIPT script="&display_compact_list('\n',$items);"></SCRIPT>
3) Whenever you want to get an item use the following method:
<EVENT event="&addtolist $items,'rabbit';">You pick up a rabbit</EVENT>
Actually there is a function &gain_item availble in the PaperDoll library, but that requires knowing how to use that entire set of functions which I haven't documented yet, as I am still working on the PaperDoll library (the PaperDoll library makes all the equipment management, equipping/unequipping, dropping and using of items that are seen in Trial Of Allibors Tomb possible). I'll write a guide as soon as it is complete to my satisfaction.
|
|