Giter Club home page Giter Club logo

Comments (13)

segabl avatar segabl commented on August 26, 2024

Depends entirely on what you're doing

from pd2-hoplib.

BreakinBenny avatar BreakinBenny commented on August 26, 2024

What I did was modify the local name that should rename the then capitalized tweak table for enemies. First I did this with "fbi_heavy_swat" (internal name for MFRs), only to have it crash, next I tried doing it with "fbi_heavy" instead… here's an example of what I tried:

local name = tweak:gsub("_female", ""):pretty(true):gsub("fbi_heavy", "MFR"):gsub("Swat", "SWAT"):gsub("Fbi", "FBI")

And guess what? It still crashes. My point is that the FBI Heavy SWAT (which they're even called if they're brought in by GenSec's units on Mayhem/Death Wish) should be named MFRs, since otherwise it'd be a bit strange... But since there's also a seperate FBI officer enemy, problems arise.

from pd2-hoplib.

segabl avatar segabl commented on August 26, 2024

I don't know why it crashes but it won't find "fbi_heavy" after the call to pretty(true) since that removes underscores and capitalizes names. the easiest solution would be to just add the name to self._names like:
fbi_heavy_swat = { default = "MFR Swat" }

from pd2-hoplib.

BreakinBenny avatar BreakinBenny commented on August 26, 2024

Here's my crashlog from yesterday:

Wed Mar 14 18:29:48 2018

Application has crashed: C++ exception
mods/HopLib/HopLib.lua:27: attempt to index local 'provider' (a nil value)

SCRIPT STACK

set_joker_name() @mods/Keepers Joker Names/joker_names.lua:108
check_peer_name_override() @mods/Keepers Joker Names/joker_names.lua:120
kpr_original_unitnetworkhandler_markminion() @mods/Keepers Joker Names/joker_names.lua:187
@mods/Keepers/lua/unitnetworkhandler.lua:11


Callstack:

     payday2_win32_release  (???)     ???                                                 
     payday2_win32_release  (???)     zip_get_name                                        
     payday2_win32_release  (???)     zip_get_name                                        

Current thread: Main


System information:
Application version : 1.87.537.
CPU : Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz (2 cores); SSE; SSE2; SSE3; SSSE3; SSE4.1; SSE4.2
DirectX : 12.0
GPU : NVIDIA GeForce GTX 960 / nvldumd.dll[23.21.13.9101]
Language : english
Memory : 8132MB 48KB
OS : 6.2.9200 () 0x100-0x1 (64 bits)
Physics : threaded
Renderer : DX9 threaded
Sound : Microsoft (Högtalare (High Definition Audio Device))

Since I couldn't get it to work, I hope you can

from pd2-hoplib.

segabl avatar segabl commented on August 26, 2024

Well, seems like you somehow created syntax error in NameProvider that causes it to not load properly

from pd2-hoplib.

BreakinBenny avatar BreakinBenny commented on August 26, 2024

Doing it this way causes a crash:

function NameProvider:_init_names()
self._names = {
fbi_heavy_swat = { default = "MFR" },

from pd2-hoplib.

segabl avatar segabl commented on August 26, 2024

Asumming the other entries are still there it should be fine, if it's just that though, then of course it would crash due to invalid syntax

from pd2-hoplib.

BreakinBenny avatar BreakinBenny commented on August 26, 2024

But it doesn't make sense; heavy_swat and fbi_heavy_swat are two different types of Heavy SWAT units, the former is a green shoulder pad-adorning MPD/ZEAL SWAT, the latter is a Maximum Force Responder donning a tan vest.

My theory is that since the FBI unit already exists and the fbi_swat unit already end up being capitalized, HopLib goes insane and crashes because it's already altered how to print "fbi_heavy_swat" because both "swat" and "fbi" are taken, and thus it refuses to re-print "FBI Heavy SWAT" in comparison to when I made the GenSec/City Elite unit read out like the latter. I hope you have better luck getting the MFRs to print properly than I do, @segabl. I won't hold my breath for it though.

from pd2-hoplib.

segabl avatar segabl commented on August 26, 2024

No, that's not how the code works at all. First it checks the self._names table if the name already exists and uses that one, if it doesn't, then it constructs a new name from the tweak_table id and puts it into self._names. A crash is most likely caused by some syntax error or some other code problem.

from pd2-hoplib.

BreakinBenny avatar BreakinBenny commented on August 26, 2024

You can check my forked version of NameProvider.lua and verify what I'm doing wrong then, since I find grasping your system is as difficult as grasping the true form of Giygas' attack.

How should I insert fbi_heavy_swat inside the gsubs anyway? How's this? I was very unsure of what to do, until I decided I would try like how you made the "Female" part of the female cop enemy not be printed.

NameProvider = NameProvider or class()

function NameProvider:init()
  self:_init_names()
  self._current_level_id = managers.job and managers.job:current_level_id() or "default"
end

function NameProvider:_init_names()
  self._names = {
    spooc = { default = "Cloaker" },
    tank_green = { default = "Bulldozer" },
    tank_black = { default = "Blackdozer" },
    tank_skull = { default = "Skulldozer" },
    tank_medic = { default = "Medic Bulldozer" },
    tank_mini = { default = "Minigun Bulldozer" },
    tank_hw = { default = "Headless Titandozer" },
    swat_van_turret_module = { default = "SWAT Turret" },
    ceiling_turret_module = { default = "Ceiling Turret" },
    mobster_boss = { default = "The Commissar" },
    old_hoxton_mission = { default = "Hoxton", berry = "Vernon Locke", rvd = "Mr. Blonde" },
    chavez_boss = { default = "Chavez" },
    hector_boss = { default = "Hector Morales" },
    biker_boss = { default = "Biker Boss" },
    drug_lord_boss = { default = "Ernesto Sosa" },
    escort_undercover = { default = "Taxman", run = "Matt", rvd = "Reservoir Dog" }
    escort_chinese_prisoner = { default = "Kazuo" },
    escort_cfo = { default = "CFO" },
    spa_vip = { default = "Charon" },
    phalanx_vip = { default = "Neville Winters" },
    phalanx_minion = { default = "Phalanx Shield" },
    bank_manager = { default = "Bank Manager", dah = "Ralph Garnet" },
    deathvox_shield = { default = "ZEAL Shield" },
    deathvox_heavyar = { default = "ZEAL Heavy AR" },
    deathvox_lightar = { default = "ZEAL Light AR" },
    deathvox_guard = { default = "G-Man" },
    deathvox_lightshot = { default = "ZEAL Light Shotgunner" },
    deathvox_heavyshot = { default = "ZEAL Heavy Shotgunner" },
    deathvox_taser = { default = "ZEAL Taser" },
    deathvox_sniper_assault = { default = "ZEAL Assault Sniper" },
    deathvox_cloaker = { default = "ZEAL Cloaker" },
    deathvox_medic = { default = "ZEAL Medic" },
    deathvox_grenadier = { default = "ZEAL Grenadier" },
    deathvox_greendozer = { default = "ZEAL Shotgun Bulldozer" },
    deathvox_blackdozer = { default = "ZEAL Saiga-12 Bulldozer" },
    deathvox_lmgdozer = { default = "ZEAL M249 Bulldozer" },
    deathvox_medicdozer = { default = "ZEAL Medicdozer" }
  }
  self._names.ceiling_turret_module_no_idle = self._names.ceiling_turret_module
  self._names.hector_boss_no_armor = self._names.hector_boss
  self._names.drug_lord_boss_stealth = self._names.drug_lord_boss
  self._names.spa_vip_hurt = self._names.spa_vip
end

function NameProvider:_create_name_entry_from_tweak_data_id(tweak)
  if not tweak then
    return
  end
  local name = tweak:gsub("_female", ""):tweak:gsub("fbi_heavy_", "MFR "):pretty(true):gsub("Swat", "SWAT"):gsub("Fbi", "FBI")
  self._names[tweak] = { [self._current_level_id] = name }
  return name
end

function NameProvider:name_by_id(tweak)
  if not tweak then
    return
  end
  return not self._names[tweak] and self:_create_name_entry_from_tweak_data_id(tweak) or self._names[tweak][self._current_level_id] or self._names[tweak].default
end

from pd2-hoplib.

BreakinBenny avatar BreakinBenny commented on August 26, 2024

Further testing shows that the MFR unit spawns without problem, but shortly after one appears PAYDAY 2 crashes with this message after I changed NameProvider.lua:

function NameProvider:_create_name_entry_from_tweak_data_id(tweak)
  if not tweak then
    return
  end
  local name = tweak:gsub("_female", ""):gsub("fbi_heavy_", "MFR "):pretty(true):gsub("Swat", "SWAT"):gsub("Fbi", "FBI")
  self._names[tweak] = { [self._current_level_id] = name }
  return name
end
Mon Mar 19 22:19:39 2018


Application has crashed: C++ exception
mods/HopLib/HopLib.lua:27: attempt to index local 'provider' (a nil value)

I mean, what? Why does it not accept the "fbi_heavy_" part but will gladly eat that "_female" shit?

from pd2-hoplib.

segabl avatar segabl commented on August 26, 2024

suggests the name provider hasn't been created (probably due to syntax errors in name provider), you should check the blt log for errors

from pd2-hoplib.

BreakinBenny avatar BreakinBenny commented on August 26, 2024

Aha! A comma is missing after the one for escort_undercover, now I see. From now on I should check the log, not just the console when a developer.txt file is in the mods folder.

from pd2-hoplib.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.