Hello Dear All,
Here the challenge i`m trying to reach and update specific integer via slider but i cant figure out since couple days, please check video…
*there is a widget 3d blueprint which is player able to hold left click and drag order to change slider value (range 4)
*in another blueprint there is construction script and in there i have a variable as integer (range 4) which is my target !
*after set value>cast to blueprint (pinned ref blueprint)>set integer (no effect)
*after set value>get all actors of class (targetblueprintselected)>set integer (error)
In a nutshell, during sliding that slider how can i transmit value into integer ?
What is the another blueprint that holds the integer? Is it placed in the level manually?
Consider posting a screenshot of the above. It seems like the reference is invalid.
Hi there, @Everynone second blueprint (actor) is tower generator and inside this blueprint i have to reach floorgenerator integer as shown in attachment !
i just try to modify this awesome tutorial : UE4 - Constructing Buildings with Instanced Static Meshes [TUTORIAL] - YouTube
Wanna to change that integer via 3d widget slider inside the game (during play) !
Not going to watch a 40 min tutorial. Life’s too short
Is this tower generator an object you’ve placed in the level?
Yea tower generator placed on the lvl…
Ok, see if you can follow my logic here.
The widget *can *only work while the game is running. The construction script *cannot *be run while the game is running since you’ve manually placed the object in the level. Are you seeing the problem? Even if you send the integer value to the TowerGenerator, it is already too late to fire the Construction Script.
The construction scrips fires when you drag the object around in the editor. The construction scripts also fires when you spawn a new object dynamically.
You’d need to wrap the code you’ve shown in a function, and, optionally, hook it up to the Construction Script. Only then can you have the widget update the TowerGenerator’s integer and trigger the function.
Wow i didn`t expect that (construction script not reachable in gameplay), nevertheless thank you i will try to wrap and give an another shot…
Hey @Everynone, can you please point me any tutorial about wrapping function and hooking up as you meantion up there ?
Here you go:
It is probably easier than you think, though:
- create a new function with *int *input
- put your code inside
- get all actors of class (if you must) -> call function
Hi again @Everynone ,
I was keep trying to figure out, i tried as you showed me and here some results;
*first attempt: i cut construction script and create a new one maketower paste into it…
call that function from end of the slider/button for changing value purpose, the problem is in here i cant see any kind of component in viewport i believe that all my components are
instanced static mesh component only i can see structure when ever i interact with slider/button which is just spawning not changing floorgenerator value ! whenever keep clicking or rolling slider it`s keep spawning in front of me over and over again which is causing performance issue.
*second attempt (current one): i cut construction script and create a new one maketower paste into it…
call that function from construction script, with this way i can see the structure, but whenever keep clicking or rolling slider it`s keep spawning in front of me over and over again which is causing performance issue.
In this two way i cant reach my target, actually target is changing value of integer inside the function via 3d widget slider !! floorgenerator value/slider range is 0-4 (it means 5 step include 0!) and slider also have 5 step as you can see in the blueprint!
Here current status;
-I achieved edit to integer inside to function but only one way (+floorbutton) with buttons (3d widget buttons), (-floorbutton) nonfunctional i
m still trying to figure out why i can't decrease to integer variable (floorgenerator) value !.. -Another issue that after editing integer (floorgenerator) i have to exucute function 'maketower' again otherwise i cant see the result of update and its cause same updated structure spawn over and over again on exact position ! (after 100 click performance dead almost crash!)
-I already give up from slider widget because whenever press and hold slider handle, it`s keep firing and constantly giving value to integer variable despite has range (clamped) !(floorgenerator)-there is no way give integer numbers with snap to grid to slider !
In a nutshell i have to to find a way that, how can i edit function in gameplay and refreshing only updated values without respawning structure over and over again, i just need updated value results! If you guys (a specially you man @Everynone) have any idea please share with me i`m really stuck…
Thank you & Regards
I was away for a bit.
The slider updates constantly, but it’s an easy fix. In order to send the update only when the value changes, store the current int value and compare it to the one the slider is outputting. Update it only when the value is different than before:
When it comes to removing tower elements I can’t see you delete them anywhere, actually. You seem to call the make tower function again - this will simply create another smaller tower, rather than remove anything from the previous one.
Not sure how this is supposed to work. I’m assuming that you want to extend/collapse the existing tower with a slider. In this case, you’d need to start storing the created instances in an array. Extending adds a new element at the end while collapsing removes the last index.
Hey There @Everynone,
Yes exactly what i would like to do here as you thought; ’ I’m assuming that you want to extend/collapse the existing tower with a slider.’
Slider working great now as i wish, thank you very much for your time and effort… Here slider sample with snapping;
Have no idea where to start for storing created instances on my function (make a tower), i should study more about arrays i think…