AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   WC3FT changing the scaling with level for shopmenu items. (https://forums.alliedmods.net/showthread.php?t=245909)

Indigoism 08-08-2014 15:20

WC3FT changing the scaling with level for shopmenu items.
 
I would like to disable the scaling with levels so items from shopmenu and shopmenu2 will always cost the same.

I looked into some of the Inc files but I could not find it. Any help will be greatly appriciated!

Indigo

PreDominance 08-08-2014 15:32

Re: WC3FT changing the scaling with level for shopmenu items.
 
war3ft/items.inl, line 61.
http://puu.sh/aKdFm/5f82b37a65.png

Indigoism 08-08-2014 15:43

Re: WC3FT changing the scaling with level for shopmenu items.
 
Thank you for your fast response. I did come across this but I didnt know how to edit it. I tried deleting the function but I couldnt it wouldnt compile war3ft.sma after. I also tried changing the values in the function. But now items from shopmenu are less expensive on lower levels. I want i to be equal on all.

While we're at it, I would also like to know a way so certain items dont stack with race abilities. For example:
Sock of Feather stacking with Undeads Levitate.

Any ideas?

PreDominance 08-08-2014 16:46

Re: WC3FT changing the scaling with level for shopmenu items.
 
You're going to have to look up some basic scripting to do that yourself. If you can't figure out how to change the cost of the item (you really tried just "deleting" a return statement?"), then I won't be of much help.

I can tell you how to do things, because I believe that the best way to do things is by yourself, so that you may learn.

Any time you buy a shop item that enhances a user (speed, gravity), check their current speed/gravity (cs_get_user_maxspeed, cs_get_user_gravity, maybe?). If this retrieved value differs from the normal values (-1.0, 1.0), then prevent them from buying the item.

Indigoism 08-08-2014 17:48

Re: WC3FT changing the scaling with level for shopmenu items.
 
Haha, I dont know anything about the coding. I just want to satisfy the players on my server and fix these two issues (mainly the first). I've tried several things now to make it work but I cant get it to do what I want.

PreDominance 08-08-2014 22:25

Re: WC3FT changing the scaling with level for shopmenu items.
 
It's as good a time as ever to learn, friend. I will give you a present but I expect that you learn how to modify this kind of stuff on your own.

items.inl, line 65
PHP Code:

public ITEM_CanBuyidiItem )
{
    if (
iItem == ITEM_BOOTS && (floatcmp(floatabs(get_user_maxspeed(id)), 1.0) != 0)) {
        
client_print(idprint_center"Your speed is already enhanced.");
        return 
false;
    } else if (
iItem == ITEM_SOCK && (floatcmp(get_user_gravity(id), 1.0) != 0) {
        
client_print(idprint_center"Your gravity is already enhanced.";
        return 
false;
    }
    
// User doesn't have the money
    
else if ( SHARED_GetUserMoneyid ) < ITEM_CostidiItem ) )
    {
        
client_printidprint_center"%L"id"INSUFFICIENT_FUNDS" );

        return 
false;
    }
    
    
// User already owns the item and it's not a chargeable item!
    
else if ( ITEM_HasidiItem ) > ITEM_NONE && !ITEM_CheckFlagiItemITEM_CHARGEABLE ) )
    {
        
client_printidprint_center"%L"id"ALREADY_OWN_THAT_ITEM" );

        return 
false;
    } 


You should be able to figure it out from here. I've added the two necessary blocks of code. Read what I did, and learn from it!

Indigoism 08-09-2014 08:57

Re: WC3FT changing the scaling with level for shopmenu items.
 
Thanks for taking the time to help me. Cant believe fixing the ratio was as simple as this.
PHP Code:

#define ITEM_COST_RATIO        1.0        // Changed from 0.7 to 1.0 

I tried adding the code you made for me to the items.inl but it wouldnt compile and I have something else to do right now. Ill report back later.

Indigo~

EDIT:
Alright, so I suppose you left out a few signs to make me look at it :D

PHP Code:

public ITEM_CanBuyidiItem )
{
    if (
iItem == ITEM_BOOTS && (floatcmp(floatabs(get_user_maxspeed(id)), 1.0) != 0)) {
        
client_print(idprint_center"Your speed is already enhanced.");
        return 
false;
    } else if (
iItem == ITEM_SOCK && (floatcmp(get_user_gravity(id), 1.0) != 0)) {
        
client_print(idprint_center"Your gravity is already enhanced.");
        return 
false;
    } 

That did the trick!

Thanks for the help its much appriciated.

PreDominance 08-10-2014 01:35

Re: WC3FT changing the scaling with level for shopmenu items.
 
I am evilly helpful :twisted:

If you need any additional help, feel free to add me on Steam, or post here. I will always take time to help someone learn, but after awhile I expect you can start to be independent.

Indigoism 08-10-2014 14:12

Re: WC3FT changing the scaling with level for shopmenu items.
 
Problem with your method: You can buy the items on a different race and then switch back to undead and you will keep the items and they will still stack.

Any ideas?

PreDominance 08-10-2014 16:05

Re: WC3FT changing the scaling with level for shopmenu items.
 
shared.inl, line 846
PHP Code:

        // Unholy Aura bonus
        
if ( iSkillLevel 0.0 )
        {
            
fNewSpeed p_unholy[iSkillLevel-1];
            if (
ITEM_Has(idITEM_BOOTS) > ITEM_NONE && (fNewSpeed >= (1.0 get_pcvar_float(CVAR_wc3_boots)))) 
            {
                
ITEM_RemoveID(idITEM_BOOTS);
                
client_print(idprint_chat"Unholy Aura's speed is greater than boots: removing.");
            }
        } 

This will verify that Unholy Aura's speed boost is greater than what boots, give, and if so, remove boots.

shared.inl, line 1096
PHP Code:

            // User has levitation + sock, lolnope.
            
if ( fGravityLevel 1.0 )
            {
                if (
fGravityLevel <= 0.5)
                {
                    
client_print(idprint_chat"Levitation's gravity is better than sock: removing.");
                    
ITEM_RemoveID(idITEM_SOCK);
                }
            } 

Levitation will remove boots if the skill's gravity reduction outdoes the sock's.
I expect you are learning from this, friend.


All times are GMT -4. The time now is 12:53.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.