3DMGAME 3DM首页 新闻中心 前瞻 | 评测 游戏库 热门 | 最新 攻略中心 攻略 | 秘籍 下载中心 游戏 | 汉化 购买正版 论坛

注册 登录

QQ登录

只需一步,快速开始

楼主: 3dm_29331450
打印 上一主题 下一主题

[修改] 【修改】让玩家的 HP 和 MP自动再生,设置每秒恢复多少HP和MP

  [复制链接]

0

主题

107

帖子

169

积分

中级玩家

Rank: 3Rank: 3

贡献度
0
金元
1691
积分
169
精华
0
注册时间
2021-2-26
331#
发表于 2024-10-4 18:06 | 只看该作者
111111111111111
回复 支持 反对

使用道具 举报

0

主题

211

帖子

313

积分

高级玩家

Rank: 4

贡献度
0
金元
3126
积分
313
精华
0
注册时间
2013-5-4
332#
发表于 2024-10-4 18:23 | 只看该作者
1111111111111111
回复 支持 反对

使用道具 举报

0

主题

13

帖子

24

积分

新手玩家

Rank: 1

贡献度
0
金元
240
积分
24
精华
0
注册时间
2024-5-24
333#
发表于 2024-10-4 23:33 | 只看该作者
99999999999999999999999999999999
回复 支持 反对

使用道具 举报

2

主题

315

帖子

380

积分

高级玩家

Rank: 4

贡献度
0
金元
3797
积分
380
精华
0
注册时间
2018-3-7
334#
发表于 2024-10-5 02:11 | 只看该作者
嘟嘟嘟嘟嘟嘟滴答滴答滴答滴答
回复 支持 反对

使用道具 举报

23

主题

1430

帖子

1860

积分

游戏狂人

Rank: 6Rank: 6

贡献度
13
金元
18079
积分
1860
精华
0
注册时间
2011-4-14
335#
发表于 2024-10-5 17:29 | 只看该作者
看看什么来头
回复 支持 反对

使用道具 举报

0

主题

370

帖子

501

积分

高级玩家

Rank: 4

贡献度
0
金元
5009
积分
501
精华
0
注册时间
2017-12-25
336#
发表于 2024-10-7 14:19 来自手机 | 只看该作者
感谢分享感谢分享
回复 支持 反对

使用道具 举报

0

主题

110

帖子

167

积分

中级玩家

Rank: 3Rank: 3

贡献度
0
金元
1670
积分
167
精华
0
注册时间
2012-9-17
337#
发表于 2024-10-7 14:57 | 只看该作者
6666666666666666666666
回复 支持 反对

使用道具 举报

头像被屏蔽

15

主题

78

帖子

163

积分

禁止发言

贡献度
32
金元
350
积分
163
精华
0
注册时间
2023-11-30
338#
发表于 2024-10-7 15:58 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

0

主题

465

帖子

900

积分

超级玩家

Rank: 5Rank: 5

贡献度
0
金元
9000
积分
900
精华
0
注册时间
2021-1-3
339#
发表于 2024-10-7 16:06 | 只看该作者
看看支持下
回复 支持 反对

使用道具 举报

0

主题

98

帖子

121

积分

中级玩家

Rank: 3Rank: 3

贡献度
0
金元
1210
积分
121
精华
0
注册时间
2019-10-24
340#
发表于 2024-10-7 16:48 | 只看该作者
11111111111
回复 支持 反对

使用道具 举报

0

主题

254

帖子

359

积分

高级玩家

Rank: 4

贡献度
0
金元
3593
积分
359
精华
0
注册时间
2012-4-18
341#
发表于 2024-10-7 22:52 | 只看该作者
感谢分享
回复 支持 反对

使用道具 举报

1

主题

694

帖子

940

积分

超级玩家

Rank: 5Rank: 5

贡献度
6
金元
9156
积分
940
精华
0
注册时间
2019-11-6
342#
发表于 2024-10-8 22:08 | 只看该作者
谢谢分享
回复 支持 反对

使用道具 举报

0

主题

56

帖子

63

积分

初级玩家

Rank: 2

贡献度
0
金元
628
积分
63
精华
0
注册时间
2024-10-1
343#
发表于 2024-10-8 22:27 | 只看该作者
6666666666666
回复 支持 反对

使用道具 举报

4

主题

289

帖子

382

积分

高级玩家

Rank: 4

贡献度
0
金元
3824
积分
382
精华
0
注册时间
2016-1-20
344#
发表于 2024-10-8 22:53 | 只看该作者
666666666666666666666
回复 支持 反对

使用道具 举报

4

主题

4338

帖子

4639

积分

游戏精英

Rank: 8Rank: 8

贡献度
0
金元
46393
积分
4639
精华
0
注册时间
2020-12-21
345#
发表于 2024-10-11 05:58 | 只看该作者
6666666666666666666
回复 支持 反对

使用道具 举报

头像被屏蔽

0

主题

244

帖子

439

积分

禁止访问

贡献度
0
金元
4386
积分
439
精华
0
注册时间
2016-7-6
346#
发表于 2024-10-12 07:57 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

4

主题

322

帖子

543

积分

高级玩家

Rank: 4

贡献度
0
金元
5428
积分
543
精华
0
注册时间
2019-4-29
347#
发表于 2024-10-12 09:05 | 只看该作者
1111111111111111111
回复 支持 反对

使用道具 举报

5

主题

245

帖子

582

积分

高级玩家

Rank: 4

贡献度
6
金元
5580
积分
582
精华
0
注册时间
2019-11-10
348#
发表于 2024-10-17 08:26 | 只看该作者
xxfxxdsfds
回复 支持 反对

使用道具 举报

7

主题

814

帖子

908

积分

超级玩家

Rank: 5Rank: 5

贡献度
2
金元
9001
积分
908
精华
0
注册时间
2012-1-3
349#
发表于 2024-10-17 10:02 | 只看该作者
6666666666666
回复 支持 反对

使用道具 举报

0

主题

107

帖子

169

积分

中级玩家

Rank: 3Rank: 3

贡献度
0
金元
1691
积分
169
精华
0
注册时间
2021-2-26
350#
发表于 2024-10-19 16:10 | 只看该作者
-- Configuration --------------------------
local HPRegenerateValue = 5
local MPRegenerateValue = 5
local ActiveTurnBigorSmallMod = 1
local BigScale = 2.0
local SmallScale = 0.5
local BigAttackIncrease = 100
local SmallDefenceIncrease = 100
local MPCostForBig = 10
local MPCostforSmall = 10
-------------------------------------------

local SimpleCmdShared = require("scShared")
function FVector(x, y, z)
    return { X = x, Y = y, Z = z }
end
function FRotator(x, y, z)
    return { X = x, Y = y, Z = z }
end
SimpleCmdShared.GetMoveMent = "BGUCharacterMovementComponent"
SimpleCmdShared.GetSpringArm = "BUS_SpringArmComponent"
SimpleCmdShared.GetFollowCam = "UCameraComponent"
local wukong = nil
local wukongcontroller = nil
RegisterHook("/Script/Engine.PlayerController:ClientRestart", function(self, NewPawn)
    wukong = NewPawn:get()
    wukongcontroller = self:get()
    SimpleCmdShared.LogValue(wukong:GetFullName())
end)

local obj = nil
function getobj()
    if obj == nil then
        obj = StaticFindObject("/Script/b1-Managed.Default__BGUFunctionLibraryCS")
    end
    return obj
end

function getwukong()
    if wukong == nil then
        return FindFirstOf("Unit_Player_Wukong_C")
    end
    return wukong
end

function IsNilOrInvalid(obj)
    return obj == nil or not obj:IsValid()
end

-- 数值修正
local atkBase_Current = 0
local defBase_Current = 0
local condition = 0
local changetype = 0
local powerCD = 0
function valueModifier()
        local wukong = getwukong()
        local obj = getobj()
        if IsNilOrInvalid(wukong) or IsNilOrInvalid(obj) then
                return
        end
        local atkBase = obj:GetAttrValue(wukong, 103)
        local defBase = obj:GetAttrValue(wukong, 104)
        if defBase < 0 or atkBase < 0 then
                return
        end       
        if changetype == 1 then
                if condition ~= 1 then
                        local Setvalue = defBase_Current - SmallDefenceIncrease
                        if Setvalue >= 0 and condition > 1 then
                                obj:BGUSetAttrValue(wukong, 104, Setvalue)
                                defBase_Current = 0                       
                        end       
                        atkBase_Current = atkBase + BigAttackIncrease       
                        obj:BGUSetAttrValue(wukong, 103, atkBase_Current)                       
                        condition = 1                       
                end
        elseif changetype == 2 then
                local Setvalue = atkBase_Current - BigAttackIncrease
                if condition ~= 2 then
                        if Setvalue >= 0 and condition == 1 then
                                obj:BGUSetAttrValue(wukong, 103, Setvalue)
                                atkBase_Current = 0                       
                        end
                        defBase_Current = defBase + SmallDefenceIncrease       
                        obj:BGUSetAttrValue(wukong, 104, defBase_Current)                               
                        condition = 2                       
                end       
        elseif changetype == 0 then
                if condition ~= 0 then
                        if condition == 1 then
                                local Setvalue = atkBase_Current - BigAttackIncrease
                                if Setvalue >= 0 then
                                        obj:BGUSetAttrValue(wukong, 103, Setvalue)                       
                                end
                                atkBase_Current = 0
                        elseif condition > 1 then       
                                local Setvalue = defBase_Current - SmallDefenceIncrease
                                if Setvalue >= 0 then
                                        obj:BGUSetAttrValue(wukong, 104, Setvalue)                       
                                end                               
                                defBase_Current = 0                       
                        end
                        condition = 0
                end       
        end
end

function powerCoolDown()
        powerCD = 0
end

-- 放大
RegisterKeyBind(Key.OEM_PLUS, function()
        if powerCD ~= 1 and ActiveTurnBigorSmallMod ~= 0 then
                local newScale = FVector(BigScale,BigScale,BigScale)
                changetype = 1
                wukong:SetActorScale3D(newScale)
                if condition ~= 1 then
                        local wukong = getwukong()
                        local obj = getobj()
                        if not IsNilOrInvalid(wukong) and not IsNilOrInvalid(obj) then
                                local currentMP = obj:GetAttrValue(wukong, 152)
                                if currentMP > MPCostForBig then
                                        local Setvalue = currentMP - MPCostForBig
                                        obj:BGUSetAttrValue(wukong, 152, Setvalue)                                       
                                        valueModifier()                                       
                                        powerCD = 1
                                        ExecuteWithDelay(100, function()
                                                powerCoolDown()
                                        end)                               
                                end                       
                        end
                end       
                local movement = FindAllOf(SimpleCmdShared.GetMoveMent)
                for index, value in ipairs(movement) do
                        local fullName = value:GetFullName()
                        if string.find(fullName, "Unit_Player_Wukong_C") and string.find(fullName, "CharMoveComp") then
                                value["MaxStepHeight"] = 1000
                        end      
                end               
        end
end)

-- 缩小
RegisterKeyBind(Key.OEM_MINUS, function()
        if powerCD ~= 1 and ActiveTurnBigorSmallMod ~= 0 then
                local newScale = FVector(SmallScale,SmallScale,SmallScale)
                changetype = 2
                wukong:SetActorScale3D(newScale)
                if condition ~= 2 then
                        local wukong = getwukong()
                        local obj = getobj()
                        if not IsNilOrInvalid(wukong) and not IsNilOrInvalid(obj) then
                                local currentMP = obj:GetAttrValue(wukong, 152)
                                if currentMP > MPCostforSmall then
                                        local Setvalue = currentMP - MPCostforSmall
                                        obj:BGUSetAttrValue(wukong, 152, Setvalue)                                       
                                        valueModifier()                                       
                                        powerCD = 1
                                        ExecuteWithDelay(100, function()
                                                powerCoolDown()
                                        end)                               
                                end                       
                        end               
                end
                local movement = FindAllOf(SimpleCmdShared.GetMoveMent)
                for index, value in ipairs(movement) do
                        local fullName = value:GetFullName()
                        if string.find(fullName, "Unit_Player_Wukong_C") and string.find(fullName, "CharMoveComp") then
                                value["MaxStepHeight"] = 1000
                        end      
                end       
                powerCD = 1
                ExecuteWithDelay(100, function()
                        powerCoolDown()
                end)               
        end
end)

-- 还原
RegisterKeyBind(8, function()
        if powerCD ~= 1 and ActiveTurnBigorSmallMod ~= 0 then
                local newScale = FVector(1,1,1)
                changetype = 0
                wukong:SetActorScale3D(newScale)
                if condition ~= 0 then
                        valueModifier()
                end
                local movement = FindAllOf(SimpleCmdShared.GetMoveMent)
                for index, value in ipairs(movement) do
                        local fullName = value:GetFullName()
                        if string.find(fullName, "Unit_Player_Wukong_C") and string.find(fullName, "CharMoveComp") then
                                value["MaxStepHeight"] = 1000
                        end      
                end       
                powerCD = 1
                ExecuteWithDelay(100, function()
                        powerCoolDown()
                end)
        end               
end)

-- 实时检查
local checkInterval = 1000
function CheckData()
    local wukong = getwukong()
    local obj = getobj()
        if not IsNilOrInvalid(wukong) and not IsNilOrInvalid(obj) then
                local currentMP = obj:GetAttrValue(wukong, 152)
                local MaxMP = obj:GetAttrValue(wukong, 2)
                if currentMP < MaxMP and currentMP >= 0 then
                        local DifferentMP = MaxMP - currentMP
                        if DifferentMP <= MPRegenerateValue then
                                obj:BGUSetAttrValue(wukong, 152, MaxMP)       
                        else
                                local SetMP = currentMP + MPRegenerateValue
                                obj:BGUSetAttrValue(wukong, 152, SetMP)       
                        end
                end
                local currentHP = obj:GetAttrValue(wukong, 151)
                local MaxHP = obj:GetAttrValue(wukong, 1)
                if currentHP < MaxHP and currentHP > 0 then
                        local DifferentMP = MaxHP - currentHP
                        if DifferentMP <= HPRegenerateValue then
                                obj:BGUSetAttrValue(wukong, 151, MaxHP)       
                        else
                                local SetHP = currentHP + HPRegenerateValue
                                obj:BGUSetAttrValue(wukong, 151, SetHP)       
                        end
                end               
                local currentScale = wukong:GetActorScale3D()
                local atkBase = obj:GetAttrValue(wukong, 103)
                local defBase = obj:GetAttrValue(wukong, 104)
                if currentScale.X == 1 and condition ~= 0 then
                        if condition == 1 and atkBase_Current == atkBase then
                                local newScale = FVector(BigScale,BigScale,BigScale)
                                wukong:SetActorScale3D(newScale)       
                                local movement = FindAllOf(SimpleCmdShared.GetMoveMent)
                                for index, value in ipairs(movement) do
                                        local fullName = value:GetFullName()
                                        if string.find(fullName, "Unit_Player_Wukong_C") and string.find(fullName, "CharMoveComp") then
                                                value["MaxStepHeight"] = 1000
                                        end      
                                end                               
                        elseif condition ==2 and defBase_Current == defBase then
                                local newScale = FVector(SmallScale,SmallScale,SmallScale)
                                wukong:SetActorScale3D(newScale)
                                local movement = FindAllOf(SimpleCmdShared.GetMoveMent)
                                for index, value in ipairs(movement) do
                                        local fullName = value:GetFullName()
                                        if string.find(fullName, "Unit_Player_Wukong_C") and string.find(fullName, "CharMoveComp") then
                                                value["MaxStepHeight"] = 1000
                                        end      
                                end                               
                        elseif (condition == 1 and atkBase_Current ~= atkBase) or (condition ==2 and defBase_Current ~= defBase) then
                                condition = 0                               
                        end       
                elseif currentScale.X > 1 and condition == 1 and atkBase_Current ~= atkBase then
                        atkBase_Current = atkBase
                elseif currentScale.X > 1 and condition == 2 and defBase_Current ~= defBase then
                        defBase_Current = defBas
                end
                ExecuteWithDelay(checkInterval, function()
                        CheckData()
                end)
        end
end

RegisterHook("/Script/Engine.PlayerController:ClientRestart", function(self, NewPawn)
    wukong = NewPawn:get()
    ExecuteWithDelay(checkInterval * 30, function()
        CheckData()
    end)
end)

回复 支持 反对

使用道具 举报

1

主题

165

帖子

193

积分

中级玩家

Rank: 3Rank: 3

贡献度
0
金元
1929
积分
193
精华
0
注册时间
2020-11-3
351#
发表于 2024-10-19 17:32 | 只看该作者
6666666666666666
回复 支持 反对

使用道具 举报

0

主题

264

帖子

386

积分

高级玩家

Rank: 4

贡献度
0
金元
3861
积分
386
精华
0
注册时间
2016-12-25
352#
发表于 2024-10-19 20:58 | 只看该作者
6666666666666666666666666
回复 支持 反对

使用道具 举报

1

主题

305

帖子

519

积分

高级玩家

Rank: 4

贡献度
6
金元
4948
积分
519
精华
0
注册时间
2013-10-24
353#
发表于 2024-10-21 10:27 | 只看该作者
让玩家的 HP 和 MP自动再生,设置每秒恢复多少HP和MP
回复 支持 反对

使用道具 举报

0

主题

878

帖子

1311

积分

游戏狂人

Rank: 6Rank: 6

贡献度
0
金元
13113
积分
1311
精华
0
注册时间
2013-8-21
354#
发表于 2024-10-24 17:57 | 只看该作者
111111111111111111111111
回复 支持 反对

使用道具 举报

5

主题

66

帖子

108

积分

中级玩家

Rank: 3Rank: 3

贡献度
0
金元
1077
积分
108
精华
0
注册时间
2018-6-4
355#
发表于 2024-10-24 22:01 | 只看该作者
666666666666666666666
回复 支持 反对

使用道具 举报

0

主题

288

帖子

464

积分

高级玩家

Rank: 4

贡献度
0
金元
4640
积分
464
精华
0
注册时间
2012-9-23
356#
发表于 2024-10-24 22:07 | 只看该作者
!!!!!!!!!!!!!!!!!
回复 支持 反对

使用道具 举报

5

主题

954

帖子

793

积分

超级玩家

Rank: 5Rank: 5

贡献度
6
金元
7688
积分
793
精华
0
注册时间
2009-10-17
357#
发表于 2024-10-24 23:02 | 只看该作者
感谢分享
回复 支持 反对

使用道具 举报

0

主题

70

帖子

90

积分

初级玩家

Rank: 2

贡献度
0
金元
903
积分
90
精华
0
注册时间
2019-3-21
358#
发表于 2024-10-25 00:11 | 只看该作者
1122112212
回复 支持 反对

使用道具 举报

51

主题

2376

帖子

9517

积分

勤勤恳恳

Rank: 12Rank: 12Rank: 12

贡献度
27
金元
94088
积分
9517
精华
0
注册时间
2016-5-1

忠实用户勤勤恳恳转载MOD达人上古探险家五河琴里

359#
发表于 2024-10-25 00:35 | 只看该作者
非常好资源
回复 支持 反对

使用道具 举报

0

主题

185

帖子

228

积分

中级玩家

Rank: 3Rank: 3

贡献度
0
金元
2283
积分
228
精华
0
注册时间
2017-12-29
360#
发表于 2024-10-25 09:37 来自手机 | 只看该作者
可以配置每秒恢复多少 HP 和 MP。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|3DMGAME ( 京ICP备14006952号-1  沪公网安备 31011202006753号

GMT+8, 2026-3-27 06:35 , Processed in 0.032734 second(s), 16 queries , Memcached On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表