Chalwk / HALO-SCRIPT-PROJECTS

:white_check_mark: Halo PC|CE - Add-ons for Phasor V2+ and SAPP :new_zealand:
Other
32 stars 13 forks source link

Upgrade System (attractive mod) for HPC|CE #40

Closed Chalwk closed 5 years ago

Chalwk commented 5 years ago

Upgrade System

Earn 'money' for:

Dark3211 commented 5 years ago

Dude

Will it work if I add the "god" custom command and can buy 30 seconds? (the "god" will be over after spending 30 seconds?)

Example

{ ["god2"] = { 'god', "100", "30", "Purchased (30 Seconds of God) for $%price%. New balance: $%balance%", -1 } },

Chalwk commented 5 years ago

Dude

Will it work if I add the "god" custom command and can buy 30 seconds? (the "god" will be over after spending 30 seconds?)

Example

{ ["god2"] = { 'god', "100", "30", "Purchased (30 Seconds of God) for $%price%. New balance: $%balance%", -1 } },

Sorry for the late response. OK. I have added that feature in the latest update. I had to hard-code a custom invulnerability timer. Seems to work fine. Let me know if you have any issues.

Dark3211 commented 5 years ago

@Chalwk77 Cool, thanks

Chalwk commented 5 years ago

No worries. Just a heads up: This mod is in final stages of development, which is why it's in the INDEV directory. When it's finished, it will be moved to SAPP >> ATTRACTIVE MODS.

Dark3211 commented 5 years ago

@Chalwk77 If I know, I am testing it if I find an error I will report it, but I think it would be better to give 5 or 10 of money for each kill.

Note: It is only my opinion.

Chalwk commented 5 years ago

[new update] [!] A couple of bug fixes. [+] Added stock weapons to the weapons table and options to enable/disable each one individually. [+] Added stock grenades (Plasma / Frags) to grenade table + options to enable/disable each one.

Dark3211 commented 5 years ago

the version released 22h ago, has a bug when the game ends and starts another on another map the script stops working, in the version released recently was this bug fixed?

Dark3211 commented 5 years ago

Script: V2.0 Error: stack traceback: [string "UpgradeSystem2.0"]:1252: in function <[string "UpgradeSystem2.0"]:1251> [C]: in function '__sub' [string "UpgradeSystem2.0"]:778: in function 'update' [string "UpgradeSystem2.0"]:1044: in function <[string "UpgradeSystem2.0"]:974> EventCallback >> OnPlayerKill >> Lua Error: [string "UpgradeSystem2.0"]:778: attempt to perform arithmetic on local 'balance' (a nil value)

Chalwk commented 5 years ago

Fixed.

CHANGES: [+] NEW COMMAND:

Command Syntax: /weapons Weapons table has been updated.

Output Format: (only shows weapons that the current map supports) - which is very intuitive.

/gold | $200 /brifle | $50 /pistol | $10 /sniper | $15 /pcannon | $35 /rlauncher | $35 /ppistol | $5 /prifle | $5 /arifle | $7 /fthrower | $7 /needler | $5 /shotgun | $10

The new /weapons command iterates through the entire weapons table and retrieves the command id, price and weapon tags automatically.

Command Entries are split into 5 columns automatically and rows are determined by the amount of entries, so it's neat and tidy.

New config options: local weapon_list = "weapons" local weapon_list_perm = -1 local max_columns, max_results = 5, 15 local startIndex = 1 -- <<--- do not touch local endIndex = max_columns -- <<--- do not touch local spaces = 2 -- Spaces between results local output_format = "/%command% | $%price%"

Dark3211 commented 5 years ago

Cool. I have a request, (if possible). I could do a new version without: Combo, Streaks and Assists. And get points for kill.

------Example------

modify this:

kills = {

[1] = { "5", "10", "Kills: (%kills%) +%upgrade_points% Upgrade Points" },

        [2] = { "10", "10", "Kills: (%kills%) +%upgrade_points% Upgrade Points" },

        [3] = { "20", "10", "Kills: (%kills%) +%upgrade_points% Upgrade Points" },

        [4] = { "30", "10", "Kills: (%kills%) +%upgrade_points% Upgrade Points" },

        [5] = { "40", "10", "Kills: (%kills%) +%upgrade_points% Upgrade Points" },

        [6] = { "50", "10", "Kills: (%kills%) +%upgrade_points% Upgrade Points" },

        [7] = { "60", "10", "Kills: (%kills%) +%upgrade_points% Upgrade Points" },

        [8] = { "70", "10", "Kills: (%kills%) +%upgrade_points% Upgrade Points" },

        [9] = { "80", "10", "Kills: (%kills%) +%upgrade_points% Upgrade Points" },

        [10] = { "90", "20", "Kills: (%kills%) +%upgrade_points% Upgrade Points" },

        [11] = { "100", "30", "Kills: (%kills%) +%upgrade_points% Upgrade Points" },

    },

to this:

kill = {

[1] = { "10", "KILL (+%upgrade_points% points)" },

}, (if it is possible)

Chalwk commented 5 years ago

ADDED NEW KILL TABLE

    -- Every kill will now reward X amount of points.
    on_kill = {
        -- POINTS | MESSAGE
        enabled = true, -- Set to 'false' to disable
        {"10", "Kill (+%upgrade_points% Upgrade Points)"}
    },

You can configure this table (on or near) line 235.

You can also now enable or disable the combos, streaks, assists and kills tables.

Dark3211 commented 5 years ago

Bug

Error:

stack traceback: [string "UpgradeSystem2.0"]:1383: in function <[string "UpgradeSystem2.0"]:1382> [C]: in function '__add' [string "UpgradeSystem2.0"]:902: in function 'update' [string "UpgradeSystem2.0"]:575: in function 'AddRemove' [string "UpgradeSystem2.0"]:617: in function <[string "us"]:450> LuaEventCallback >> OnServerCommand >> Lua Error: [string "UpgradeSystem2.0"]:902: attempt to perform arithmetic on a nil value

Dark3211 commented 5 years ago

Bug

He does not let me buy frag grenades/plasma grenades, he says "That does not command work on this map." Test map: "BloodGulch" and "RatRace"

Dark3211 commented 5 years ago

[Bug]

Error:

stack traceback: [string "UpgradeSystem2.0"]:1383: in function <[string "UpgradeSystem2.0"]:1382> [C]: in function '__sub' [string "UpgradeSystem2.0"]:904: in function 'update' [string "UpgradeSystem2.0"]:1160: in function <[string "UpgradeSystem2.0"]:1088> EventCallback >> OnPlayerKill >> Lua Error: [string "UpgradeSystem2.0"]:904: attempt to perform arithmetic on local 'balance' (a nil value)

Chalwk commented 5 years ago

BUG FIXES:

This update will require overwriting the entire script with the new one because of the nature of the update. I will do my best to avoid changing the config section in the future.

Script Version is now v1.26

Below is a link to the entire commit history for this mod. Quite a lot has changed over the past 15 hours. There a good chance that the bugs you experienced have been fixed. https://github.com/Chalwk77/HALO-SCRIPT-PROJECTS/commits/master/SAPP%20SCRIPTS/ATTRACTIVE%20MODS/Upgrade%20System%202.0.lua

@Dark3211

What is your server name?

Dark3211 commented 5 years ago

Ok, (HCE) Server name: "!ROCKETS »BLOODGULCH«"

the purchase of "weapons" does not work on my server. the gametype is not "all weapons"

currently the script is disabled.

Chalwk commented 5 years ago

@Dark3211 You can enable and disable each individual weapon in the weapons table. Set "true" to "false" to disable the ones you don't want players to have access to.

Dark3211 commented 5 years ago

I know, I have most of the weapons disabled

Dark3211 commented 5 years ago

[Bug]

Script Version: 1.26

this error was fixed in version 1.35?

stack traceback: [string "UpgradeSystem"]:1390: in function <[string "UpgradeSystem"]:1389> [C]: at 0x011d6090 [C]: in function 'update' [string "UpgradeSystem"]:1175: in function <[string "UpgradeSystem"]:1092> EventCallback >> OnPlayerKill >> Lua Error: [string "UpgradeSystem"]:1175: money:update() -> Unable to get "balance".

Chalwk commented 5 years ago

Do you have "save_money" set to TRUE or FALSE?

Updated to version 1.37

Also, just out of curiosity, what is your game name so I can look out for you?

Dark3211 commented 5 years ago

save_money: false

My name in the game is: "LilPump" or "_!GoD", I play saturdays and sundays mostly.

out of curiosity, why did I want to know my name in the game?

Chalwk commented 5 years ago

[Bug]

Script Version: 1.26

this error was fixed in version 1.35?

stack traceback: [string "UpgradeSystem"]:1390: in function <[string "UpgradeSystem"]:1389> [C]: at 0x011d6090 [C]: in function 'update' [string "UpgradeSystem"]:1175: in function <[string "UpgradeSystem"]:1092> EventCallback >> OnPlayerKill >> Lua Error: [string "UpgradeSystem"]:1175: money:update() -> Unable to get "balance".

@Dark3211

FIXED.

Updated to version 1.46

QUOTE: "out of curiosity, why did I want to know my name in the game?"

So I can find you in the game and talk to you (:
Dark3211 commented 5 years ago

I tried version 1.46 and it does not give errors in the console, however when doing many kills it does not give me the points.

(After about 20 kills)

Dark3211 commented 5 years ago

I found these errors.

(These errors were shown when the server was full)

Mistakes:

stack traceback: [string "UpgradeSystem"]:1504: in function <[string "UpgradeSystem"]:1503> [C]: at 0x011d6090 [C]: in function 'update' [string "UpgradeSystem"]:1283: in function <[string "UpgradeSystem"]:1201> EventCallback >> OnPlayerKill >> Lua Error: [string "UpgradeSystem"]:1283: money:update() -> Unable to get "balance".

stack traceback: [string "UpgradeSystem"]:1504: in function <[string "UpgradeSystem"]:1503> [C]: at 0x011d6090 [C]: in function 'update' [string "UpgradeSystem"]:1272: in function <[string "UpgradeSystem"]:1201> EventCallback >> OnPlayerKill >> Lua Error: [string "UpgradeSystem"]:1272: money:update() -> Unable to get "balance".

Script Version: 1.46

Chalwk commented 5 years ago

@Dark3211 I was unable to reproduce the same error. As such, it is very difficult to ascertain the circumstances under which are causing this problem. I have made some changes in hopes that it will fix the issue but there are no guarantees at this point. Script version is now 1.47.

All of the changes can be seen here: https://github.com/Chalwk77/HALO-SCRIPT-PROJECTS/commit/a3d32cf7970ebfbe1332eaca7912f307f5c25e68

Dark3211 commented 5 years ago

Ok I understand, if this helps, I have all the weapons disabled and also combos, streaks, assists and "total kills"

Chalwk commented 5 years ago

Let me know if you continue to have the same problem.

Dark3211 commented 5 years ago

Well, at the moment the server is full and has not presented any errors.

Chalwk commented 5 years ago

Thank you to everybody who helped test this and find errors. @RoadHog, @Dark3211, @VicFirth, @iAirPirate, @TheManyRandomPlayers

Dark3211 commented 5 years ago

@Chalwk77 The players that enter my server and some of my clan informed me that the money does not work correctly, (they say that almost nobody passes the 100 points), the console does not present any error. My question is, what can I do to prevent this from happening?

Chalwk commented 5 years ago

Something to note: If 'save_money' is disabled, player points are reset to 0 (by design) when they quit. When they rejoin the server and discover their points are gone, this is why.

Change: local starting_balance = 0 (on or near line 34), to suit your needs.

Beyond that, I can only recommend increasing the points received for kills, etc. Everything is working fine for me.