Jump to content

Bourbon

Member
  • Posts

    97
  • Joined

  • Last visited

Posts posted by Bourbon

  1. I am trying it out right now. HUGE Thanks for the help! I got some fucked up shit everywhere in this mod because I am trying a lot of things with the mod. It isnt anywhere near to release state.

    My Plan was to get the recipies and eject brass + loot distribution in order and releasing it. Of Course you will get mentioned because you did a lot of work!

     

    Unfortunatly It does not run on my game, did you copy the right code?

  2. @tommysticks tried your code, still no error code, nothing in console :/ The item is where it should be. It linked a debug function for spawning brass next to the player on "O".

     

    I will now try to copy the functions into the new ISReloadManager from PZCode. Old Code might be the problem as you said.

     

    This is the mod as it is right now, if you want download it and try something in the code directly. "O" is debug for the casespawning, "P" is for all the items.

    http://www.mediafire.com/file/ana7k23j3hbq12r/HandloadingMod.zip

     

    You have been a HUGE help :D honestly thank you.

  3. Hallo Everyone, i am trying to get Rausheims Reloading mod up to date. But i ran into a wall there. I tried to get his old code working, but there is an Error occouring when you fire the shot. (Error Code below) I am pretty much stuck here. I am happy for anyone helping :)

     

    [spoiler][code]require "ISBaseObject"
    require "Reloading/ISReloadUtil"
    require "Reloading/ISRackAction"
    require "Reloading/ISReloadAction"
    
    ISReloadManager = ISBaseObject:derive("ISReloadManager");
    
    --************************************************************************--
    --** ISReloadable:initialise
    --**
    --************************************************************************--
    function ISReloadManager:initialise()
    
    end
    
    -- CUSTOM FUNCTION FOR EJECTING BRASS
    -- Called from: ISReloadManager:fireShot below.
    local function addEmptyBrass(wielder, weapon)
    	
    	local player = wielder;	-- gets the player shooting
                    
    	-- Get the name.
    	local weapon = weapon;			--The Weapon
    	local name = weapon:getName();	--The Weapon Name
    	
                    
    	-- Compare the name (string) to the weapon strings
    	if name == "Pistol" then
    		player:getCurrentSquare():AddWorldInventoryItem("handloading.emptybrass9mm", 0.0, 0.0, 0.0);	-- This is 9mm brass
    	elseif name == 'Shotgun' then
    		player:getCurrentSquare():AddWorldInventoryItem("handloading.emptyshell12ga", 0.0, 0.0, 0.0);	-- This is shotgun shells, rename the item to what it is called.
    	elseif name == 'Varmint Rifle' then
    		player:getCurrentSquare():AddWorldInventoryItem("handloading.emptybrass223", 0.0, 0.0, 0.0);	-- .223, rename to what it is in your code.
    	elseif name == 'Hunting Rifle' then
    		player:getCurrentSquare():AddWorldInventoryItem("handloading.emptybrass308", 0.0, 0.0, 0.0);	-- .308, rename to what it is in your code.
    	end
    end
    
    --************************************************************************--
    --** ISReloadManager:new
    --**
    --************************************************************************--
    function ISReloadManager:new(player)
    	local o = {}
    	setmetatable(o, self)
        self.__index = self
    	o.reloadAction = nil;
    	o.reloadStarted = false;
    	o.reloadWeapon = nil;
    	o.rackingStarted = false;
    	o.chainReload = false;
    	o.spaceIsPressed = false;
    	o.rIsPressed = false;
    	--o.kIsPressed = false; -- debugging tool
    	o.difficulty = 1;
    	o.reloadAction = nil;
    	o.rackingAction = nil;
    	o.reloadable = nil;
    	o.playerid = player;
    	o.lastClickTime = 0
    
    	-- Debug hooks
        --o.managerDetails = function()
    	    --return ReloadManager:printManagerDetails();
    	--end
    	--Events.OnPlayerUpdate.Add(o.managerDetails);
    
        return o;
    end
    
    aaa = {}
    
    aaa.startRackingHook = function(pl)
        if pl then
    	    return ReloadManager[pl:getPlayerNum()+1]:checkRackConditions();
        else return ReloadManager[1]:checkRackConditions(); end
    end
    Events.OnPlayerUpdate.Add(aaa.startRackingHook);
    
    aaa.startReloadHook = function(pl)
        if pl then
      	    return ReloadManager[pl:getPlayerNum()+1]:checkReloadConditions();
        else return ReloadManager[1]:checkReloadConditions(); end
    end
    Events.OnPlayerUpdate.Add(aaa.startReloadHook);
    
    aaa.fireShotHook = function(wielder, weapon)
    	return ReloadManager[wielder:getPlayerNum()+1]:fireShot(wielder, weapon);
    end
    Events.OnWeaponSwingHitPoint.Add(aaa.fireShotHook);
    
    aaa.checkLoadedHook = function(character, chargeDelta)
    	return ReloadManager[character:getPlayerNum()+1]:checkLoaded(character, chargeDelta);
    end
    Hook.Attack.Add(aaa.checkLoadedHook);
    
    
    
    --************************************************************************--
    --** ISReloadManager:checkLoaded
    --**
    --** Checks whether the DoAttackMethod may begin (i.e whether a weapon)
    --** has a round loaded.
    --**
    --************************************************************************--
    --************************************************************************--
    function ISReloadManager:checkLoaded(character, chargeDelta)
        local weapon = character:getPrimaryHandItem();
        if(ReloadUtil:setUpGun(weapon) == true) then
            self.reloadable = ReloadUtil:getReloadableWeapon(weapon, character);
    		if(self.reloadable:isLoaded(self.difficulty) == true) then
    			ISTimedActionQueue.clear(character)
    			if(chargeDelta == nil) then
    				character:DoAttack(0);
    			else
    				character:DoAttack(chargeDelta);
                end
            else
                character:DoAttack(chargeDelta, true, self.reloadable.clickSound);
    --	    elseif Calendar.getInstance():getTimeInMillis() - self.lastClickTime > 250 then
    --		    getSoundManager():PlayWorldSound(self.reloadable.clickSound, character:getSquare(), 0, 4, 1.0, false);
    --		    self.lastClickTime = Calendar.getInstance():getTimeInMillis()
            end
    	else
            character:DoAttack(chargeDelta);
    	end
        self.reloadable = nil;
    end
    
    --************************************************************************--
    --** ISReloadManager:fireShot
    --**
    --** Checks whether weapon is reloadable and performs any necessary
    --** actions after the weapon is fired
    --**
    --************************************************************************--
    function ISReloadManager:fireShot(wielder, weapon, difficulty)
    	self.reloadable = ReloadUtil:getReloadableWeapon(weapon, wielder);
    	if(self.reloadable ~= nil) then
    		self.reloadable:fireShot(weapon, self.difficulty);
    		addEmptyBrass(wielder, weapon);	-- HERE WE EJECT OUR BRASS
    	end
    	self.reloadable = nil;
    end
    
    --************************************************************************--
    --** ISReloadManager:isWeaponReloadable
    --**
    --** Performs various checks to make sure that the equipped item is
    --** reloadable
    --**
    --************************************************************************--
    function ISReloadManager:isWeaponReloadable()
    	self.reloadWeapon = getSpecificPlayer(self.playerid):getPrimaryHandItem();
    	if(self.reloadWeapon == nil) then
            return false;
    	end
    
    	self.reloadable = ReloadUtil:getReloadableWeapon(self.reloadWeapon, getSpecificPlayer(self.playerid));
    	if self.reloadable == nil then return false; end
    	local isReloadable = self.reloadable:canReload(getSpecificPlayer(self.playerid));
    	self.reloadable = nil;
        return isReloadable;
    end
    
    --************************************************************************--
    --** ISReloadManager:stopReload
    --**
    --** Resets variables after a cancelled reload timed action.
    --**
    --************************************************************************--
    function ISReloadManager:stopReload(noSound)
        if self.reloadable.bulletOutSound and self.reloadable.currentCapacity > 0 and not noSound then
            getSoundManager():PlayWorldSound(self.reloadable.bulletOutSound, getSpecificPlayer(self.playerid):getSquare(), 0, 10, 1.0, false);
        end
    	self.reloadStarted = false;
    	self.reloadAction.javaAction = nil;
    	self.reloadWeapon = nil;
    	self.reloadable = nil;
    	self.chainReload = false;
    end
    
    --************************************************************************--
    --** ISReloadManager:stopReloadSuccess
    --**
    --** Determines whether further reload actions should be performed and
    --** resets variables after a reload timed action completes successfully.
    --**
    --************************************************************************--
    function ISReloadManager:stopReloadSuccess()
    	self.chainReload = ReloadUtil:getReloadableWeapon(self.reloadWeapon,getSpecificPlayer(self.playerid)):isChainReloading();
    	if(self.reloadWeapon ~= nil and self.chainReload == true and self.reloadStarted == true) then
    		self.reloadStarted = false;
    		if(self.reloadable:canReload(getSpecificPlayer(self.playerid))) then
    			self:startReloading();
            else
                if self.reloadable.bulletOutSound and self.reloadable.currentCapacity > 0 then
                    getSoundManager():PlayWorldSound(self.reloadable.bulletOutSound, getSpecificPlayer(self.playerid):getSquare(), 0, 10, 1.0, false);
                end
            end
    	elseif(self.chainReload == false) then
    		self:stopReload();
    	end
    end
    
    --************************************************************************--
    --** ISReloadManager:checkReloadConditions
    --**
    --** Checks for the reload key being pressed and starts the reload if
    --** conditions are suitable
    --**
    --************************************************************************--
    function ISReloadManager:checkReloadConditions()
    	if((isKeyDown(Keyboard.KEY_R) == true or getSpecificPlayer(self.playerid):isLTPressed()) and self.reloadStarted == false
            and self.rackingStarted == false) then
    		self.reloadWeapon = getSpecificPlayer(self.playerid):getPrimaryHandItem();
    
    		if not(self.difficulty == 3 and isKeyDown(Keyboard.KEY_SPACE)) then
    		    if(self:isWeaponReloadable() == true) then
    			    self:startReloading();
    		    end
    		end
    	end
    end
    
    --************************************************************************--
    --** ISReloadManager:startReload
    --**
    --** Sets up and starts the reload timed action
    --**
    --************************************************************************--
    function ISReloadManager:startReloading()
    	-- prep the reload information
    	local player = getSpecificPlayer(self.playerid)
    	local moodles = player:getMoodles();
    	local panicLevel = moodles:getMoodleLevel(MoodleType.Panic);
    	self.reloadable = ReloadUtil:getReloadableWeapon(self.reloadWeapon, player);
    	self.reloadAction = ISReloadAction:new(self, player, player:getSquare(),
    		(self.reloadable:getReloadTime()*player:getReloadingMod())+(panicLevel*30))
    	self.reloadStarted = true
    	if not self.chainReload then
            ISTimedActionQueue.clear(player)
        end
    	ISTimedActionQueue.add(self.reloadAction)
    end
    
    --************************************************************************--
    --** ISReloadManager:startReloadFromUi
    --**
    --** Sets up and starts the reload timed action from the UI
    --**
    --************************************************************************--
    --function ISReloadManager:startReloadFromUi(item)
    --	if(self.reloadStarted == false and self.rackingStarted == false) then
    --		self.reloadWeapon = item;
    --		self:startReloading();
    --	end
    --  end
    function ISReloadManager:startReloadFromUi(item)
    	if(self.reloadStarted == false and self.rackingStarted == false) then
    		self.reloadWeapon = item;
    		self:startReloading();
    	end
    end
    
    --************************************************************************--
    --** ISReloadManager:checkRackConditions
    --**
    --** Checks for the rack key being pressed and starts racking if
    --** conditions are suitable
    --**
    --************************************************************************--
    function ISReloadManager:checkRackConditions()
    	if(isKeyDown(Keyboard.KEY_SPACE) == true and self.rackingStarted == false
            and self.reloadStarted == false) then
    	    if(self.difficulty == 3 and isKeyDown(Keyboard.KEY_R) == false) then
    	        self.reloadWeapon = getSpecificPlayer(self.playerid):getPrimaryHandItem();
    		    if(self.reloadWeapon == nil) then
                    return false;
                end
                self.reloadable = ReloadUtil:getReloadableWeapon(self.reloadWeapon, getSpecificPlayer(self.playerid));
                if(self.reloadable ~= nil) then
                    self:startRacking();
                else
                    self:stopRacking();
                end
    		end
    	end
    end
    
    --************************************************************************--
    --** ISReloadManager:startRackFromUi
    --**
    --** Sets up and starts the rack timed action from the UI
    --**
    --************************************************************************--
    function ISReloadManager:startRackFromUi(item)
    	if(self.reloadStarted == false and self.rackingStarted == false) then
    		self.reloadWeapon = item;
    		self:startRacking();
    	end
    end
    
    --************************************************************************--
    --** ISReloadManager:startRacking
    --**
    --** Sets up and starts the racking timed action
    --**
    --************************************************************************--
    function ISReloadManager:startRacking()
    	-- prep the racking information
    	local player = getSpecificPlayer(self.playerid)
    	local moodles = player:getMoodles();
    	local panicLevel = moodles:getMoodleLevel(MoodleType.Panic);
    	self.reloadable = ReloadUtil:getReloadableWeapon(self.reloadWeapon, player);
    	self.rackingAction = ISRackAction:new(self, player, player:getSquare(),
    		(self.reloadable:getRackTime()*player:getReloadingMod())+(panicLevel*30));
    	self.rackingStarted = true;
    	ISTimedActionQueue.add(self.rackingAction)
    end
    
    --************************************************************************--
    --** ISReloadManager:stopRacking
    --**
    --** Resets variables after a racking timed action.
    --**
    --************************************************************************--
    function ISReloadManager:stopRacking()
    	self.rackingStarted = false;
    	self.rackingAction = nil;
    	self.reloadWeapon = nil;
    end
    
    --************************************************************************--
    --** ISReloadManager:setDifficulty
    --**
    --** Sets the Difficulty to the value provided. Valid difficulties are:
    --** 1 = EASY
    --** 2 = MEDIUM
    --** 3 = HARDCORE
    --**
    --** @param newDifficulty a number representing the new difficulty
    --**
    --************************************************************************--
    function ISReloadManager:setDifficulty(newDifficulty)
    	self.difficulty = newDifficulty;
    end
    
    --************************************************************************--
    --** ISReloadManager:getDifficulty
    --**
    --** Gets the Difficulty value currently set. Will return a number between
    --** 1 and 3 where each number corresponds with the following
    --** difficulties:
    --**
    --** 1 = EASY
    --** 2 = MEDIUM
    --** 3 = HARDCORE
    --**
    --************************************************************************--
    function ISReloadManager:getDifficulty()
    	return self.difficulty;
    end
    
    --************************************************************************--
    --** ISReloadManager:getDifficultyDescription
    --**
    --** Returns the text that should appear in the MainOptions screen to
    --** describe the reload difficulty setting.
    --**
    --************************************************************************--
    function ISReloadManager:getDifficultyDescription(difficulty)
    	if(difficulty == 1) then
    		return 'Reloading handguns refills the weapon provided there is ammunition available.';
    	elseif(difficulty == 3) then
    		return 'Reloading handguns ejects or inserts a magazine. The magazine must be reloaded separately.\nWeapons must be racked before firing to ensure a round is chambered.';
    	else
    		return 'Reloading handguns ejects or inserts a magazine. The magazine must be reloaded separately.';
    	end
    end
    
    function ISReloadManager:printManagerDetails()
        if(isKeyDown(Keyboard.KEY_K) == true) then
            self.kIsPressed = true;
            print('***************************************************************');
            print('Reload Manager state');
            print('***************************************************************');
            local outString = '';
            if(self.reloadStarted ~= nil) then
                outString = outString..', reload Started: '
                if(self.reloadStarted == true) then
                    outString = outString..'true';
                else
                    outString = outString..'false';
                end
            else
                outString = outString..', reload Started == nil';
            end
            if(self.reloadWeapon ~= nil) then
                outString = outString..', reload Weapon: '..self.reloadWeapon;
            else
                outString = outString..', reload Weapon == nil';
            end
            if(self.rackingStarted ~= nil) then
                outString = outString..', rackingStarted: '
                if(self.rackingStarted == true) then
                    outString = outString..'true';
                else
                    outString = outString..'false';
                end
            else
                outString = outString..', racking Started = nil';
            end
            if(self.chainReload ~= nil) then
                outString = outString..', chain reloading: ';
                if(self.chainReload == true) then
                    outString = outString..'true';
                else
                    outString = outString..'false';
                end
            else
                outString = outString..', chain reloading == nil';
            end
            if(self.spaceIsPressed ~= nil) then
                outString = outString..', space Is Pressed: ';
                if(self.spaceIsPressed == true) then
                    outString = outString..'true';
                else
                    outString = outString..'false';
                end
            else
                outString = outString..', space Is pressed = nil';
            end
            if(self.rIsPressed ~= nil) then
                outString = outString..', r Is Pressed: ';
                if(self.rIsPressed == true) then
                    outString = outString..'true';
                else
                    outString = outString..'false';
                end
            else
                outString = outString..', r Is pressed = nil';
            end
            if(self.difficulty ~= nil) then
                outString = outString..', difficulty: '..self.difficulty;
            else
                outString = outString..', difficulty = nil';
            end
            print(outString);
            print('self.reloadable: ');
            print(self.relodable);
            print('Reload Action:')
            print(self.reloadAction)
            print('Racking Action:')
            print(self.rackingAction)
            print('***************************************************************');
            print();
            print();
            self:printReloadableDetails();
            self:printWeaponModDetails();
            self.kIsPressed = false;
    	end
    end
    
    function ISReloadManager:printReloadableDetails()
            local weapon = getPlayer():getPrimaryHandItem();
            if(weapon ~= nil) then
                local reloadable = ReloadUtil:getReloadableWeapon(weapon, getSpecificPlayer(self.playerid));
                if(reloadable ~= nil) then
                    reloadable:printReloadableWeaponDetails();
                end
            end
    end
    
    function ISReloadManager:printWeaponModDetails()
            local weapon = getPlayer():getPrimaryHandItem();
            if(weapon ~= nil) then
                local reloadable = ReloadUtil:getReloadableWeapon(weapon, getSpecificPlayer(self.playerid));
                if(reloadable ~= nil) then
                    reloadable:printWeaponDetails(weapon);
                end
            end
    end
    [/code][/spoiler]

     

    STACK TRACE

    Callframe at: se.krka.kahlua.integration.expose.MultiLuaJavaInvoker@6a0cdb41

    function: checkLoaded --file: ISReloadMAnager.lua line # 90

  4. I am tinkering atm with Rausheims Reloading mod, in the script files i found this:

     

    item emptyshell12gabox
        {
            Weight = 0.5,
            Type = Normal,
                    Count = 1,               <---------What TF is this?
            UseWhileEquipped = FALSE,
            DisplayName = Bag of empty shotgun shell,
            Icon = empty12ga.png,

    }

     

    item emptyshell12ga
        {
            Weight = 0.005,
            Type = Normal,
                    Count = 12,    <-------and this?
            UseWhileEquipped = FALSE,
            DisplayName = Empty shotgun shell,
            Icon = empty12ga.png,
        }

     

    I would like to know what this does.

     

    Thanks for the help.

  5. I am trying to get Rausheims Reloding (Handloading) Mod up and running again.

    But i am not so great at scripting, if someone wants to look into that and share some ideas how to get this running again i would be thankful. After we get it running, we could make it ORGM-compatible.

  6. An accidantal suicide could be eliminated if you bind the action to three buttons at once. For Example: Both Shift and F. So you would have to move your hand from the standard position.

  7. On 6.9.2016 at 2:44 PM, Keshash said:

    Well, you can already load ammo in magazines and magazines in guns (Check settings). And already 4 ammo types for 4 guns. Not sure about new guns, though.

     

    On 6.9.2016 at 6:39 PM, Teesee said:

    Hand loading is already a thing I think. You just have to set the reloading mode to "hardcore" in the options. You're right about the ammo though, but I remember reading something from the devs about a possible small weapons overhaul. (don't quote me on that) 

     

    Handloading is a process where you create your own ammunition. Loading a Magazine with bullets is not called handloading.

    To Handload you usally use gunpowder, empty shells, and a new bullet and a new primer. You would need special tools to do it. It is not uncommon for some shooters to handload their own ammo, because it is cheaper than buying it.

    New Guns are already on the way!

     

  8. 6 minutes ago, Demonic_Kat said:

    Hm. Perhaps it was two swallows. Do you suppose they could have strung it up between them?

    Might be a flock of swallows found a net and carried a lot of them to KY and Germany. Would explain the whole Timetravel disaster in ´92.

  9. 4 hours ago, Demonic_Kat said:

    But how would a coconut get to KY?

     

    Do you suppose a swallow could have carried it?

    Didnt someone import them in ´93? I mean i live in Germany, Coconuts dont grow here but i can buy them in most Markets.

×
×
  • Create New...