DragonPrime - LoGD Resource Community

Coding Support => Coding Support Desk => Topic started by: Jdrid on March 08, 2006, 08:48:42 PM



Title: New Response for Armor Shop items
Post by: Jdrid on March 08, 2006, 08:48:42 PM
For certain items, I would like to make the game sound more realistic. If I make an armor item called 'Full Body Mail' I want the user to not say, 'Won't i look silly wearing nothing but a full body mail?' since he has bought full armor. I am giving this a shot here, please tell me if I am doing this right...
Here is some code I think I should add in armor.php, tell me if it would be correct...
Code:
if $session['user']['armor'] = $row['what I named the armor'];
   output("What I want player to say to Peagasus.");
and I'd be adding this before line 81.

Or can I create a simple module to do this?
I'd rather make a module than edit code I know.
Also please tell me if I am way off. I'd like to know how to get better with php. Thanks


Title: Re: New Response for Armor Shop items
Post by: Dragon89 on March 08, 2006, 08:53:14 PM
Eth made a killer module called mystic shop.  It can do what you want and then some.  I would look at that if you want to see about doing your own thing.


Title: Re: New Response for Armor Shop items
Post by: Jdrid on March 08, 2006, 08:57:13 PM
Yes, but I wanted something to tie in with normal armor you buy fromt he armor shop. Not an addon shop. I may try this one out though.


Title: Re: New Response for Armor Shop items
Post by: Talisman on March 08, 2006, 09:55:37 PM
This is another place where you can accomplish a change using the translation tool.


Title: Re: New Response for Armor Shop items
Post by: Jdrid on March 08, 2006, 10:20:02 PM
yes I know this but I wished for it to only show up on certain armor, such as all 15 strentgh armor. I know I could change it witht he translator but I only wanted it to show up for those 15 strentgh armor items.


Title: Re: New Response for Armor Shop items
Post by: XChrisX on March 08, 2006, 10:53:15 PM
This can be done with a module...

you would need to hook into "header-armor"...

In the dohook part check if "httget('op') == 'buy'" and if (httpget('id') == 15". If this statement evaluates to "FALSE" let you module end, if "TRUE", continue with the following:

copy lines 64 till 97 to your modules code, change the text you want to change, and then (IMPORTANT) call page_footer() from within the dohook()-function.

This will stop the normal code (outside of your module) to be continued.

PS: You might need line 15, too ...


Title: Re: New Response for Armor Shop items
Post by: Jdrid on March 08, 2006, 11:00:11 PM
k thanks for telling me how, hopefully I'll get this done by tonight, if not tommorrow...


Title: Re: New Response for Armor Shop items
Post by: Kendaer on March 09, 2006, 07:02:28 PM
This can be done with a module...

you would need to hook into "header-armor"...

In the dohook part check if "httget('op') == 'buy'" and if (httpget('id') == 15". If this statement evaluates to "FALSE" let you module end, if "TRUE", continue with the following:

copy lines 64 till 97 to your modules code, change the text you want to change, and then (IMPORTANT) call page_footer() from within the dohook()-function.

This will stop the normal code (outside of your module) to be continued.

PS: You might need line 15, too ...

What XChrisX has suggested would break if there were any other header-armor hooks being used for something.   Be very careful any time you choose to 'break out' of the hook handling like this.


Title: Re: New Response for Armor Shop items
Post by: XChrisX on March 09, 2006, 09:25:10 PM
What XChrisX has suggested would break if there were any other header-armor hooks being used for something.   Be very careful any time you choose to 'break out' of the hook handling like this.
And the funny part (to search for such errors: The break would only happen when you buy a level 15 armor... ;D

In no other case... :)

you might want to add your hook with the "module_addhook_priority()"-function...

© 2018 DragonPrime - LoGD Resource Community
Email Talisman: talisman -at- gmail.com
&oeXs)2U7=V BmܲV.U e=;p\}eG )Jj} C5EH7ˤH=j } mo|*Ŋw{drV_@IV>/- TFQJ׀̀Ve}l1,V O iNYx͘$e$;
Forums: Powered by SMF 1.1.21 | SMF © 2006-2007, Simple Machines