DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • September 19, 2018, 10:10:31 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1] 2 3   Go Down
  Print  
Author Topic: Healing potions to-go  (Read 8842 times)
0 Members and 1 Guest are viewing this topic.
Voratus
Guest
« on: March 29, 2004, 12:36:41 PM »

This is something I set up on Sunday, and I think I've finally got the bugs worked out. I basically rewrote the healer.php and stuck it in town.
This healer will now also sell healing potions: Lesser Healing, Normal Healing, and Greater Healing. A character can hold 10 potions total.
I took the healer out of the forest, but instead put up navs to use a potion (if the user has one or more).
So far I'm liking it, but I think I still need to modify it to balance out effect vs. cost. It should be more expensive than the healer (convenience charge tacked on), but shouldn't be too expensive to cause people not to use them at all.
There is also a fourth type of potion I introduced called the Full Healing, which can only be found in a couple of places (randomly, of course).
Lesser healing heals 25 points at a purchase price of 150 gp
Medium healing heals 50 pts at a cost of 250
Greater healing heals 100 at a cost of 450.

I may introduce a selling-back of potions, since there is a limited number which can be held at any given time, and at the same time make potions appear randomly (like after fighting monsters).

If anyone is interested in the cityhealer.php to see what I've done, I can upload it. I do expect to revisit it at some time and tweak it.

The changes I did also required the addition of 5 tinyint fields, one for each potion, and one for total potions (though the latter could be gotten around, I suppose, by simply adding the other four variables together when needing to check total potions) to keep track of the quantity held.

The potions cannot be used mid-battle, nor do I intend to change that.
Logged
sixf00t4
Mod God
*****
Offline Offline

Posts: 1916



View Profile WWW
« Reply #1 on: March 29, 2004, 02:28:39 PM »

funny that you mention this.  i have been working on this idea myself, only i am writing a "traveller's shop"  where people who are going on quest can buy supplies, like healing potions, food that lasts (thinking about adding the hunger mod) and maybe a tent or something so they can log out there.  i would love for you to upload your file.
Logged

Voratus
Guest
« Reply #2 on: March 29, 2004, 03:14:25 PM »

http://dragonprime.cawsquad.net/users/Voratus/cityhealer.zip

Thats the meat of it. I use the healing effects of the potions in forest.php (since thats where they are used), and I modified the template replace area (what a mess that is) of common.php to display under the character's vitals the numbers of potions carried.
Logged
sixf00t4
Mod God
*****
Offline Offline

Posts: 1916



View Profile WWW
« Reply #3 on: March 29, 2004, 03:40:45 PM »

so add:
potions
medheal
greatheal
and lessheal to the db.

how can one write a method that can refer the person back to where they were.  i would assume we could write heal() in common.php, and then call that function from anywhere with a link, but then how do we refer them back to where they were?  it would be a shame to have to include it in all the files.
Logged

bwatford
Guest
« Reply #4 on: March 29, 2004, 04:48:20 PM »

I've got this function already working in the castle, will post it as a stand alone as soon as I work out the last few bugs. Seems sometimes it works in certain areas but sometimes it don't. Have to find out why and then I'll post it.
Logged
lonnyl
Guest
« Reply #5 on: March 29, 2004, 05:44:16 PM »

something like this

function heal($location){
--->>> your heal code
addnav("continue","$location");
}

now call it as
heal(yourfile.php);

I think I covered it all, pulled that from the top of my head so it may not be perfect.
Logged
sixf00t4
Mod God
*****
Offline Offline

Posts: 1916



View Profile WWW
« Reply #6 on: March 29, 2004, 05:48:56 PM »

you still have to code in where they are that way though lonny.   think if someone where at filename.php?op1=operation?op2=oper  and you would have to code that each time you made a link to the heal function.  still, it is the best way as of yet.

what i was asking, if there was a way to track the referring page, and then output that.  so that you could call it from anywhere, and it would automatically give nav back.
Logged

lonnyl
Guest
« Reply #7 on: March 29, 2004, 06:21:37 PM »

why is it you need to return anyway, a function is called like it is part of the existing code.  

so your heal could simply be called within a routine

so just put the option in the file

if (HTTP_GET_VARS[op] == "heal"){
$option2=HTTP_GET_VARS[op2]
heal();
addnav("continue","yourfile.php?op=operation&op2=$option2");

etc...
Logged
Artte
Guest
« Reply #8 on: March 29, 2004, 06:30:20 PM »

If you look at stock code from 0.9.7, such as the Bio navs in the listing in the fields, the query strings &ret=pvp.php is put into the URL of the nav link. This lets the target php file put a "return whence you came" nav link to where you were at. The code looks like this taken from bio.php. I thought the answer was fairly obvious for that little issue.

Code:
if ($_GET[ret]==""){
    addnav("Return to the warrior list","list.php");
}else{
    $return = preg_replace("'[&?]c=[[:digit:]-]+'","",$_GET[ret]);
    $return = substr($return,strrpos($return,"/")+1);
    addnav("Return whence you came",$return);
}

I haven't looked at your code yet, Voratus, but I believe I will. This concept will work great in the mod I'm working on.. since a healer's hut just doesn't sound right for mine.
Logged
Voratus
Guest
« Reply #9 on: March 29, 2004, 09:36:52 PM »

I've since modified it again, adding a minor healing potion (and a minheal field to the db).
http://dragonprime.cawsquad.net/users/Voratus/cityhealer1_1.zip

And I suppose I should have mentioned this the first time, but the healer redirects you back to domarr.php when you leave, because that is my city page. It will, of course, need to be changed.
« Last Edit: March 29, 2004, 09:42:45 PM by Voratus » Logged
MattsShack
Guest
« Reply #10 on: March 30, 2004, 01:11:55 PM »

Hello All,

First off this is my first post to this board, and I would like to thank everyone here for their hard work.

Voratus great add-on for LoGD!  Smiley

I am VERY new to LoGD, and even newer to modding it, but I thought I would post this to contribute a little bit back to this board.

To add the potions to the vitals for your players:

Code:
In common.php find:
.templatereplace("statrow",array("title"=>"Gems","value"=>$u['gems']))

Add after:
.templatereplace("stathead",array("title"=>"Healing Potions"))
.templatereplace("statrow",array("title"=>"Minor","value"=>$u['minheal']))
.templatereplace("statrow",array("title"=>"Lesser","value"=>$u['lessheal']))
.templatereplace("statrow",array("title"=>"Normal","value"=>$u['medheal']))
.templatereplace("statrow",array("title"=>"Greater","value"=>$u['greatheal']))
.templatereplace("statrow",array("title"=>"Total Potions","value"=>"$u[potions]`0/10"))

Of course you can add these lines anywhere you want, this is just where I added them. I know this is simple but I thought It might help someone.

Thank you again to all on this board, and I hope to help contribute more in the future.
-Matt
http://www.mattsshack.com
Logged
Voratus
Guest
« Reply #11 on: March 30, 2004, 02:49:30 PM »

On my template_replace section, I didn't give the total (I assume players can add to 10 Wink ), and I also added one for Full Healing, since I have those availble to find (just not to purchase).
Logged
MattsShack
Guest
« Reply #12 on: March 30, 2004, 02:58:20 PM »

Oh, sorry if I duplicated your work. Shocked I did not know that was already available. Thanks for the great script.

-Matt
http://www.mattsshack.com
Logged
Voratus
Guest
« Reply #13 on: March 30, 2004, 03:04:07 PM »

I didn't post that change, nor the forest.php changes (as that is where the potions get used). Not really a duplication, since its really the most logical way to do it. Smiley
Logged
robert
Old Dog
Moderator
Mod God
*****
Offline Offline

Posts: 1047


LoGD Buff!


View Profile WWW
« Reply #14 on: March 30, 2004, 06:02:18 PM »

Will you be posting the rest of the install instructions?
Logged

Pages: [1] 2 3   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
30 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search