[開發日誌][UnrealEngine] PainCausingVolume如何結合GAS中的GameplayEffect使用

posted in: 開發日誌 | 12

最近在思考怎麼做毒沼澤的功能,發現引擎中內建PainCausingVolume還蠻符合自己需求的,我們可以在這個Volume上設定傷害數值,並且設定每隔幾秒才觸發事件。

不過由於我的測試專案高度集成GameplayAbilitySystem(GAS),因此會希望所有的角色的數值變化操作都透過系統中的GameplayEffect來執行。由於PainCausingVolume跟GAS系統並沒有相依關係,為了這個機制要另外刻一個Volume又感覺有點多餘。不過好加在GAS系統本身製作的彈性還蠻大的,因此是有方法可以把這種外部的傷害數值注入,後續的傷害計算跟數值的加減就可以延著原本系統設計的邏輯進行,不需要再製作另一套系統維護。

其實方法還蠻簡單的,主要就是要在我們的給PainCausingVolume用的GE中的Magnitude Calculation Type使用Set by Caller,並設定一個GamplayTag讓系統知道之後要拿傷害的時候就去找這個Tag拿就行了。下圖我的這個Tag是設定成:GameEffect.SetByCaller.IncomingDirectDamage。

然後在角色的AnyDamage Callback中,我們就可以做出這個GameplayEffect,使用AssignTagSetByCallerMagnitude把實際的數值指定給這個Tag,然後就可以把這個效果套用給角色產生傷害,如下圖:

12 Responses

  1. zoritoler imol

    I keep listening to the news lecture about getting boundless online grant applications so I have been looking around for the best site to get one. Could you tell me please, where could i find some?

  2. building company Naxxar

    naturally like your web-site but you have to check the spelling on several of your posts. A number of them are rife with spelling problems and I find it very troublesome to tell the truth nevertheless I will certainly come back again.

  3. nextogel

    Hello my loved one! I wish to say that this article is awesome, nice written and come with approximately all significant infos. I’d like to look more posts like this .

  4. togel 4d

    Wow, marvelous weblog structure! How long have you ever been running a blog for? you made blogging glance easy. The overall look of your site is magnificent, as neatly as the content material!

  5. slot gacor thailand

    Hi, I think your website might be having browser compatibility issues. When I look at your blog in Firefox, it looks fine but when opening in Internet Explorer, it has some overlapping. I just wanted to give you a quick heads up! Other then that, terrific blog!

  6. zabornatorilon

    I not to mention my friends ended up digesting the excellent information and facts found on the blog and suddenly I got an awful suspicion I had not thanked the website owner for those secrets. All the guys ended up certainly glad to learn all of them and already have honestly been loving those things. Many thanks for really being really considerate and also for utilizing this kind of high-quality issues millions of individuals are really wanting to be informed on. My very own honest apologies for not saying thanks to sooner.

Leave a Reply to Gelatin Trick for Weight Loss Cancel reply

Your email address will not be published. Required fields are marked *