x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Blutility - Construction script and mouse input

I'm gonna try make this short, I'm currently making a grid based strategy game using 4.17.2. The grid consists of one actor that spawns every tiles in its construction script. In addition to that every tile can be modified via several arrays (i can delete, rise, lower, add resources and building on any specific tile). I was looking at ways to easily select individual tiles (which are the actor's components) in editor.

So I managed to make a blutility blueprint that lets me customise the grid. I have a range of "Call in editor" functions that get the position of the camera and line traces down to the grid to select individual tiles (by casting to the grid I can get the hit components) and edit corresponding arrays. However, sometimes when I edit the grid, it won't re run its construction script until I manually open its blueprint and compile it.

Do you know if there is any way to run or refresh a construction script through blueprints?

I was also wondering if there was any ways to get mouse input (buttons would be awesome but simple conversion from screen to world of the coordinates is enough) within a blutility blueprint?

I know I can get the mouse's position on viewport but I can't convert it to world space without a player controller. I tried looking at ways to calculate it manually but from what I understood I need the camera's matrix which I don't know how to get in blueprints.

The pictures simply shows the blutility functions, the linetrace down and some of the tile customisation. I know blutilities are still experimental but I'm really curious of its capabilities. Sorry if this was too long to read, I couldn't think of otherways to explain myself ...

alt text

Product Version: UE 4.17
Tags:
more ▼

asked Feb 04 '18 at 08:35 PM in Blueprint Scripting

avatar image

Gamji
3 3 3 9

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

You probably should convert your construction script to a function/macro that is called in the construction script, and recalled when you detect mouse input

more ▼

answered Feb 04 '18 at 10:01 PM

avatar image

erik321123
403 17 15 31

avatar image Gamji Feb 05 '18 at 11:40 AM

I thought of that, but my construction script has a lot of local variables which would be a pain to move over. I want to keep that option as a last resort type of thing aha

avatar image erik321123 Feb 05 '18 at 11:43 AM

Have you tried the collapse to macro/function? It was a long time ago since I did BP, but perhaps it takes care of it for you.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question