iFAction游戏制作工具

iFAction游戏制作工具

评价数不足
Random Loot Chest Guide
由 PorkChip 制作
Tired of the predictability of opening the same old chest to find the same old rusty longsword sitting there time after time? Fear not, for with a few minutes work I can show you how to randomise your goodies! Here's how...
   
奖励
收藏
已收藏
取消收藏
Step 1
Step 1:
Choose your Trigger tool from the top bar. Right click anywhere in your scene (preferably near your start point so you can do a few test runs) and choose Create/Change Trigger.
Double click the graphics box and browse the image folder to find D - Object and then select Treasure chest. Click confirm.
Uncheck only the Parallel box for now.
Double click to Add and then go to Logic tab and select Control Variables.
Double click to Add a new variable. Give it a name like Loot Chest or something similar. It's type should be Number and leave the default at 0. Now click Confirm.
On the next screen make sure the operation is set at =Equal, then enter Random 1-100. Click Confirm.
Double click below the variable command and find the Action Tab, then select Set Actor/Trigger Action.
Now, where it reads Actor/Trigger, select This Trigger from the drop down menu. Under commands, choose Set Action and then select choose a custom action from the drop down menu and then find your treasure chest under D - Object and set the action to Opened. After all, it does help if we actually open the damn thing! Confirm everything.
Step 2
Step 2:
Here's where the magic happens...
Under the action you just made, Double Click to add and then go to Logic tab and select Conditional Branch.
Double click to add and then find your Random Loot variable. Click confirm.
Underneath in Comparison, select >= (greater than or equal to) from the drop down menu. Then, set Operand Constant at 90. Confirm everything.
Now you have a Conditional Branch with two outcomes. Double click underneath where it reads: Then in blue (Not else) and find the Others Tab and choose Change Item. Find whichever item you wish to be your RARE drop and confirm everything.
Entirely optional but underneath your change item command you could now add text say you found Excalibur or whatever...
Now double click under where it reads: Else in blue (Not then) and repeat the steps above to make another Conditional Branch.
However this time, make Operand Constant set at >= 70.
Then exactly as above, select which item you would want but for your second prize (never bad are they?)
Then, underneath Else in this Conditional Branch, rinse repeat as above and set Operand Constant to >= 40.
This will get you your common item. Better than a kick in the teeth, no?
Lastly, underneath Else in this Conditional Branch, leave it blank since the player gets nothing, chest was empty. Those thieving little ****$! You could also leave a message rubbing the player's face in it.
Essentially this is done now. So the logic in the numbers for the operands on the variables read:

Rare: => 90 (10% chance)
Uncommon: => 70 (20% chance)
Common: => 40 (30% chance)
Nothing: =< 40 (40% chance)

This is just an example. Play around with the numbers 'til your heart's content. Just make sure it makes mathematical sense (that's why I base the range from 1-100 so you can convert them into percentage). You could have hundreds, potentially thousands of outcomes depending on how much work you want to put it. Better you than me...
Now all that remains is to test it. You should find you are getting different outcomes...
When you are happy with your work all that remains to be done is going back into your trigger and unchecking the Reiterative box so that the event only fires the once.
Here is just the basic example of the power of variables and conditional branches. Happy experimenting!
2 条留言
Tarkus1971 2021 年 1 月 20 日 下午 3:27 
great stuff, very useful
GrungeBro 2020 年 8 月 31 日 下午 11:20 
amazing guide thanks mate