Download

In-game point-purchase system

So I have a point system in my game setup and it goes up whenever I shoot an enemy AI. Now I want to make a system that allows me to open door or buy weapons if I have a certain amount of points. It will have to check to see how many points the player has, then have a set amount needed to do whatever. I’m just not how to and where the events will go.

If you wanted something a la CoD Zombies, you could have a sphere collision on the door or weapon box-thing, cast to the player BP, check it against a value of say 70, and if it’s more subtract 70 from the point value variable and if its less, don’ allow the player to open/buy
Here’s a working example:

In the character BP or equivalent, create an integer/float for your point value, then in the Door BP, check if the character is within distance of the door (For a la cod, i’d suggest a widget BP for thisThis would also remove the need for Event Tick if you instead used a Key input such as E), check if the player can pay the required amount and if so, remove points and open the door

Dotdog’s suggestion will work, but rather than having the event tick go to the branch, you should have the event tick go to the “Enter” on a gate, and the cast should go to “Open”, and then OnComponentEndOverlap should go to “Close” on the gate.

So yes they both work, but how would I make it a key pressed to open it instead of a event tick? I just tried a couple things, but i could’t get it to work. And how would I get the widget to show appear on the door when he collides with the door’s collision?

For getting the widget to appear when the player is inside the collision box, I’d suggest creating an empty widget with a text box that says ‘E to open door: $250’ or similar. The widget BP doesn’t necessarily require logic as the door handles most of it.
I’m working on an example, but UE decided to push an update so I’m waiting for that

Anybody know how or can show me how it should be set up for the widget to appear on the door when you collide with the triggerbox?


Begin Object Class=K2Node_ComponentBoundEvent Name="K2Node_ComponentBoundEvent_16"
   Begin Object Class=EdGraphPin Name="EdGraphPin_26364"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_26363"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_26362"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_26361"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_26360"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_26359"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_26358"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_26357"
   End Object
   Begin Object Name="EdGraphPin_26364"
      PinName="SweepResult"
      PinToolTip="Sweep Result
Hit Result Structure (by ref)"
      Direction=EGPD_Output
      PinType=(PinCategory="struct",PinSubCategoryObject=ScriptStruct'/Script/Engine.HitResult',bIsReference=True,bIsConst=True)
   End Object
   Begin Object Name="EdGraphPin_26363"
      PinName="bFromSweep"
      PinToolTip="From Sweep
Boolean"
      Direction=EGPD_Output
      PinType=(PinCategory="bool")
      DefaultValue="false"
      AutogeneratedDefaultValue="false"
   End Object
   Begin Object Name="EdGraphPin_26362"
      PinName="OtherBodyIndex"
      PinToolTip="Other Body Index
Integer"
      Direction=EGPD_Output
      PinType=(PinCategory="int")
      DefaultValue="0"
      AutogeneratedDefaultValue="0"
   End Object
   Begin Object Name="EdGraphPin_26361"
      PinName="OtherComp"
      PinToolTip="Other Comp
Primitive Component Reference"
      Direction=EGPD_Output
      PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/Engine.PrimitiveComponent')
   End Object
   Begin Object Name="EdGraphPin_26360"
      PinName="OtherActor"
      PinToolTip="Other Actor
Actor Reference"
      Direction=EGPD_Output
      PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/Engine.Actor')
   End Object
   Begin Object Name="EdGraphPin_26359"
      PinName="then"
      Direction=EGPD_Output
      PinType=(PinCategory="exec")
      LinkedTo(0)=EdGraphPin'K2Node_CreateWidget_7.EdGraphPin_26874'
   End Object
   Begin Object Name="EdGraphPin_26358"
      PinName="OutputDelegate"
      Direction=EGPD_Output
      PinType=(PinCategory="delegate")
   End Object
   Begin Object Name="EdGraphPin_26357"
      PinName="OutputDelegate"
      Direction=EGPD_Output
      PinType=(PinCategory="delegate",PinSubCategoryMemberReference=(MemberParent=BlueprintGeneratedClass'/Game/Assets/Helping_Internet/Door_Thing.Door_Thing_C',MemberName="BndEvt__Box_K2Node_ComponentBoundEvent_15_ComponentBeginOverlapSignature__DelegateSignature"))
   End Object
   DelegatePropertyName="OnComponentBeginOverlap"
   DelegateOwnerClass=Class'/Script/Engine.PrimitiveComponent'
   ComponentPropertyName="Box"
   EventReference=(MemberParent=Package'"/Script/Engine"',MemberName="ComponentBeginOverlapSignature__DelegateSignature")
   bInternalEvent=True
   CustomFunctionName="BndEvt__Box_K2Node_ComponentBoundEvent_15_ComponentBeginOverlapSignature__DelegateSignature"
   Pins(0)=EdGraphPin'EdGraphPin_26357'
   Pins(1)=EdGraphPin'EdGraphPin_26358'
   Pins(2)=EdGraphPin'EdGraphPin_26359'
   Pins(3)=EdGraphPin'EdGraphPin_26360'
   Pins(4)=EdGraphPin'EdGraphPin_26361'
   Pins(5)=EdGraphPin'EdGraphPin_26362'
   Pins(6)=EdGraphPin'EdGraphPin_26363'
   Pins(7)=EdGraphPin'EdGraphPin_26364'
   NodePosY=656
   NodeGuid=5836D27D487762E03FE86BAF4BB99858
End Object
Begin Object Class=K2Node_CreateWidget Name="K2Node_CreateWidget_7"
   Begin Object Class=EdGraphPin Name="EdGraphPin_26878"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_26877"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_26876"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_26875"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_26874"
   End Object
   Begin Object Name="EdGraphPin_26878"
      PinName="OwningPlayer"
      PinToolTip="Player Controller Reference Owning Player
The player that \'owns\' the widget."
      PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/Engine.PlayerController')
      LinkedTo(0)=EdGraphPin'K2Node_CallFunction_2978.EdGraphPin_26954'
   End Object
   Begin Object Name="EdGraphPin_26877"
      PinName="ReturnValue"
      PinToolTip="User Widget Reference Return Value
The spawned object"
      Direction=EGPD_Output
      PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/UMG.UserWidget')
      LinkedTo(0)=EdGraphPin'K2Node_CallFunction_2979.EdGraphPin_26957'
      LinkedTo(1)=EdGraphPin'K2Node_CallFunction_2991.EdGraphPin_27097'
   End Object
   Begin Object Name="EdGraphPin_26876"
      PinName="Class"
      PinToolTip="User Widget Class Class
The object class you want to spawn"
      PinType=(PinCategory="class",PinSubCategoryObject=Class'/Script/UMG.UserWidget')
   End Object
   Begin Object Name="EdGraphPin_26875"
      PinName="then"
      Direction=EGPD_Output
      PinType=(PinCategory="exec")
      LinkedTo(0)=EdGraphPin'K2Node_CallFunction_2979.EdGraphPin_26955'
   End Object
   Begin Object Name="EdGraphPin_26874"
      PinName="execute"
      PinType=(PinCategory="exec")
      LinkedTo(0)=EdGraphPin'K2Node_ComponentBoundEvent_16.EdGraphPin_26359'
   End Object
   Pins(0)=EdGraphPin'EdGraphPin_26874'
   Pins(1)=EdGraphPin'EdGraphPin_26875'
   Pins(2)=EdGraphPin'EdGraphPin_26876'
   Pins(3)=EdGraphPin'EdGraphPin_26877'
   Pins(4)=EdGraphPin'EdGraphPin_26878'
   NodePosX=368
   NodePosY=704
   NodeGuid=8C4BF87F43FE1E75F6E90DB94DEAC928
End Object
Begin Object Class=K2Node_CallFunction Name="K2Node_CallFunction_2978"
   Begin Object Class=EdGraphPin Name="EdGraphPin_26954"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_26953"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_26952"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_26951"
   End Object
   Begin Object Name="EdGraphPin_26954"
      PinName="ReturnValue"
      PinToolTip="Return Value
Player Controller Reference"
      Direction=EGPD_Output
      PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/Engine.PlayerController')
      LinkedTo(0)=EdGraphPin'K2Node_CreateWidget_7.EdGraphPin_26878'
   End Object
   Begin Object Name="EdGraphPin_26953"
      PinName="PlayerIndex"
      PinToolTip="Player Index
Integer"
      PinType=(PinCategory="int")
      DefaultValue="0"
      AutogeneratedDefaultValue="0"
   End Object
   Begin Object Name="EdGraphPin_26952"
      PinName="WorldContextObject"
      PinToolTip="World Context Object
Object Reference"
      PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/CoreUObject.Object')
      bHidden=True
   End Object
   Begin Object Name="EdGraphPin_26951"
      PinName="self"
      PinFriendlyName="Target"
      PinToolTip="Target
Gameplay Statics Reference"
      PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/Engine.GameplayStatics')
      DefaultObject=Default__GameplayStatics
      bHidden=True
   End Object
   bIsPureFunc=True
   FunctionReference=(MemberParent=Class'/Script/Engine.GameplayStatics',MemberName="GetPlayerController")
   Pins(0)=EdGraphPin'EdGraphPin_26951'
   Pins(1)=EdGraphPin'EdGraphPin_26952'
   Pins(2)=EdGraphPin'EdGraphPin_26953'
   Pins(3)=EdGraphPin'EdGraphPin_26954'
   NodePosY=848
   NodeGuid=18D3821B435266D19F2CF6AE321C7444
End Object
Begin Object Class=K2Node_CallFunction Name="K2Node_CallFunction_2979"
   Begin Object Class=EdGraphPin Name="EdGraphPin_26958"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_26957"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_26956"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_26955"
   End Object
   Begin Object Name="EdGraphPin_26958"
      PinName="ZOrder"
      PinToolTip="ZOrder
Integer

The higher the number, the more on top this widget will be."
      PinType=(PinCategory="int")
      DefaultValue="0"
      AutogeneratedDefaultValue="0"
      bAdvancedView=True
   End Object
   Begin Object Name="EdGraphPin_26957"
      PinName="self"
      PinFriendlyName="Target"
      PinToolTip="Target
User Widget Reference"
      PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/UMG.UserWidget')
      LinkedTo(0)=EdGraphPin'K2Node_CreateWidget_7.EdGraphPin_26877'
   End Object
   Begin Object Name="EdGraphPin_26956"
      PinName="then"
      Direction=EGPD_Output
      PinType=(PinCategory="exec")
   End Object
   Begin Object Name="EdGraphPin_26955"
      PinName="execute"
      PinType=(PinCategory="exec")
      LinkedTo(0)=EdGraphPin'K2Node_CreateWidget_7.EdGraphPin_26875'
   End Object
   FunctionReference=(MemberParent=Class'/Script/UMG.UserWidget',MemberName="AddToViewport")
   Pins(0)=EdGraphPin'EdGraphPin_26955'
   Pins(1)=EdGraphPin'EdGraphPin_26956'
   Pins(2)=EdGraphPin'EdGraphPin_26957'
   Pins(3)=EdGraphPin'EdGraphPin_26958'
   NodePosX=752
   NodePosY=688
   NodeGuid=41EDFEE64AB9BE5323695286C46F502F
   AdvancedPinDisplay=Hidden
End Object
Begin Object Class=K2Node_ComponentBoundEvent Name="K2Node_ComponentBoundEvent_23"
   Begin Object Class=EdGraphPin Name="EdGraphPin_27036"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_27035"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_27034"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_27033"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_27032"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_27031"
   End Object
   Begin Object Name="EdGraphPin_27036"
      PinName="OtherBodyIndex"
      PinToolTip="Other Body Index
Integer"
      Direction=EGPD_Output
      PinType=(PinCategory="int")
      DefaultValue="0"
      AutogeneratedDefaultValue="0"
   End Object
   Begin Object Name="EdGraphPin_27035"
      PinName="OtherComp"
      PinToolTip="Other Comp
Primitive Component Reference"
      Direction=EGPD_Output
      PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/Engine.PrimitiveComponent')
   End Object
   Begin Object Name="EdGraphPin_27034"
      PinName="OtherActor"
      PinToolTip="Other Actor
Actor Reference"
      Direction=EGPD_Output
      PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/Engine.Actor')
   End Object
   Begin Object Name="EdGraphPin_27033"
      PinName="then"
      Direction=EGPD_Output
      PinType=(PinCategory="exec")
      LinkedTo(0)=EdGraphPin'K2Node_CallFunction_2991.EdGraphPin_27095'
   End Object
   Begin Object Name="EdGraphPin_27032"
      PinName="OutputDelegate"
      Direction=EGPD_Output
      PinType=(PinCategory="delegate")
   End Object
   Begin Object Name="EdGraphPin_27031"
      PinName="OutputDelegate"
      Direction=EGPD_Output
      PinType=(PinCategory="delegate",PinSubCategoryMemberReference=(MemberParent=BlueprintGeneratedClass'/Game/Assets/Helping_Internet/Door_Thing.Door_Thing_C',MemberName="BndEvt__Box_K2Node_ComponentBoundEvent_22_ComponentEndOverlapSignature__DelegateSignature"))
   End Object
   DelegatePropertyName="OnComponentEndOverlap"
   DelegateOwnerClass=Class'/Script/Engine.PrimitiveComponent'
   ComponentPropertyName="Box"
   EventReference=(MemberParent=Package'"/Script/Engine"',MemberName="ComponentEndOverlapSignature__DelegateSignature")
   bInternalEvent=True
   CustomFunctionName="BndEvt__Box_K2Node_ComponentBoundEvent_22_ComponentEndOverlapSignature__DelegateSignature"
   Pins(0)=EdGraphPin'EdGraphPin_27031'
   Pins(1)=EdGraphPin'EdGraphPin_27032'
   Pins(2)=EdGraphPin'EdGraphPin_27033'
   Pins(3)=EdGraphPin'EdGraphPin_27034'
   Pins(4)=EdGraphPin'EdGraphPin_27035'
   Pins(5)=EdGraphPin'EdGraphPin_27036'
   NodePosY=1104
   NodeGuid=B07C8C984F89A3C1C086C8A835BF6B14
End Object
Begin Object Class=K2Node_CallFunction Name="K2Node_CallFunction_2991"
   Begin Object Class=EdGraphPin Name="EdGraphPin_27097"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_27096"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_27095"
   End Object
   Begin Object Name="EdGraphPin_27097"
      PinName="self"
      PinFriendlyName="Target"
      PinToolTip="Target
Widget Reference"
      PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/UMG.Widget')
      LinkedTo(0)=EdGraphPin'K2Node_CreateWidget_7.EdGraphPin_26877'
   End Object
   Begin Object Name="EdGraphPin_27096"
      PinName="then"
      Direction=EGPD_Output
      PinType=(PinCategory="exec")
   End Object
   Begin Object Name="EdGraphPin_27095"
      PinName="execute"
      PinType=(PinCategory="exec")
      LinkedTo(0)=EdGraphPin'K2Node_ComponentBoundEvent_23.EdGraphPin_27033'
   End Object
   FunctionReference=(MemberParent=Class'/Script/UMG.Widget',MemberName="RemoveFromParent")
   Pins(0)=EdGraphPin'EdGraphPin_27095'
   Pins(1)=EdGraphPin'EdGraphPin_27096'
   Pins(2)=EdGraphPin'EdGraphPin_27097'
   NodePosX=352
   NodePosY=1104
   NodeGuid=5C5DC512430D9E676BFF15B171F57CF1
End Object


If you copy paste that into your door BP it should be what you are looking for just set the widget class. I unfortunately lost the example I was working on when EGL decided to be mean to me. Will remake it tomorrow.

Yeah so what would that be in Blueprint?

http://blueprintue.com/view/Y_gtnGrx/
?
It checks if the player is inside of the door’s collision box, creates and disp’s the widget, then destroys on the player leaving

Oh I see. And it isn’t working for me. I set it up just like that and nothing happens.