当前位置:网站首页>UE4 random generation of items
UE4 random generation of items
2022-07-24 06:11:00 【It's really all right, duck】
This is just a brief explanation of the probability of item generation , You can expand on this basis according to your own needs
Create two structural blueprints

Respectively represent the position of the object and the object model to be generated
stay ST_Location Create a Vector Variable

stay ST_Item Create two variables inside

They are the probability of the current item and the probability of this item Actor quote
Then according to the blueprint of these two structures , Create two data tables


stay DT_Location Add five lines to it
Then we're going to set positions for these five lines
Drag five cubes out of the map , Set the positions of the five cubes to DT_Location


The location can be copied and pasted directly


Then pull out five cubes
Create four actor The blueprint ( add to StaticMesh, And then put Mesh Change it to the model you want ), Model casual , Not the same
Here is a blueprint for demonstration , But if you have to generate a lot of items, it will be troublesome , The solution is to create a parent blueprint through the item ID To modify the blueprint StaticMesh

Then set it up DT_Item

BluePrint Set them to the four item blueprints just created , The probabilities are 10,20,30,40
And then create a GameMod

Change the game mode in the world outline to MyGameMod

We are GameMod It realizes the operation of generating items
Create a function , Name it GenerationItem, Traverse the previously created location data table

Every time you get a location, you randomly generate an item , Create another function named RandomItem, This function is used to randomly generate a class reference of an item
Create a local variable in this function Arr, The type is Actor Reference array

The principle is Arr The number of corresponding probabilities of items added to the array , And then we'll make a random item

Then back GenerationItem This function is called in the function to generate items

In the event icon begin play Call back GenerationItem that will do

Run to generate items as follows

If there is anything wrong, please correct it in the comment area
If you have any questions, you can ask me in the comment area
边栏推荐
- 《剑指Offer》 二维数组的查找 C语言版本
- Unity(二) 更多API和物理引擎
- Qt新手入门级 计算器加、减、乘、除、应用
- 单播、组播、广播、工具开发、QT Udp通讯协议开发简介及开发工具源码
- Deepsort summary
- JUC concurrent programming foundation (9) -- thread pool
- MySql与Qt连接、将数据输出到QT的窗口tableWidget详细过程。
- ue4 换装系统 2.换装系统的场景捕捉
- [deep learning] handwritten neural network model preservation
- HoloLens2开发:使用MRTK并且模拟眼动追踪
猜你喜欢
![[MYCAT] related concepts of MYCAT](/img/44/99d413d47828252267b5242c64960b.png)
[MYCAT] related concepts of MYCAT

JUC并发编程基础(7)--多线程锁

Day3 jvm+ sorting summary

Use QT to connect to MySQL and create table numbers, write data, and delete data

Learning rate optimization strategy

ue4 瞄准偏移

HoloLens2开发:使用MRTK并且模拟眼动追踪

The problem that the user name and password are automatically filled in when Google / Firefox manages the background new account

PDF Text merge

JVM系统学习
随机推荐
用指针访问二维数组
Qt 使用纯代码画图异常
Draw contour cv2.findcontours function and parameter interpretation
碰壁记录(持续更新)
STM32 standard peripheral Library (Standard Library) official website download method, with 2021 latest standard firmware library download link
Learning rate optimization strategy
Common methods of array
Calculation steps of principal component analysis
HoloLens 2 中文开发文档 MRTK v2
MySQL基础---约束
[deep learning] handwritten neural network model preservation
day4-jvm
PDF Text merge
Detailed explanation of KMP code distribution
使用Keras实现CNN+BiLSTM+Attention的多维(多变量)时间序列预测
Conversion of world coordinate system, camera coordinate system and image coordinate system
day2-WebSocket+排序
Write the list to txt and directly remove the comma in the middle
[MYCAT] related concepts of MYCAT
CRC-16 MODBUS code