ZeldaVerde's Recent Forum Activity

  • I'm trying to create an object from a family by it's name:

    const newObject = runtime.objects["name"].createinstance(<parameters>);

    This works, but I wanted to do so using a name stored in a variable:

    let objName = "name";

    const newObject = runtime.objects[objName].createinstance(<parameters>);

    TypeScript won't let me do this because it is afraid "objName" won't be a valid value.

    How should I go about this then?

    Thanks in advance.

  • Every time I make any changes on my scripts and hit preview, it crashes. After restarting, it all works with the new change until I make a new change and hit preview again. Please help!

    Here is the crash log:

    Error report information

    Type: unhandled rejection

    Reason: Error: Cannot read properties of null (reading 'setValue') TypeError: Cannot read properties of null (reading 'setValue') at t.Iy (https://editor.construct.net/r427/projectResources.js:1:238684)

    Stack: TypeError: Cannot read properties of null (reading 'setValue') at t.Iy (https://editor.construct.net/r427/projectResources.js:1:238684)

    Construct version: r427

    URL: editor.construct.net/r427

    Date: Tue Feb 18 2025 16:17:35 GMT-0300 (Brasilia Standard Time)

    Uptime: 1109.9 s

    Platform information

    Product: Construct 3 r427 (beta)

    Browser: Edge 133.0.3065.69

    Browser engine: Chromium

    Context: webapp

    Operating system: Windows 11

    Device type: desktop

    Device pixel ratio: 1

    Logical CPU cores: 12

    Approx. device memory: 8 GB

    User agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36 Edg/133.0.0.0

    Language setting: en-US

    WebGL information

    Version string: WebGL 2.0 (OpenGL ES 3.0 Chromium)

    Numeric version: 2

    Supports NPOT textures: yes

    Supports GPU profiling: no

    Supports highp precision: yes

    Vendor: Google Inc. (NVIDIA)

    Renderer: ANGLE (NVIDIA, NVIDIA GeForce GTX 1050 Ti (0x00001C82) Direct3D11 vs_5_0 ps_5_0, D3D11)

    Major performance caveat: no

    Maximum texture size: 16384

    Point size range: 1 to 1024

    Extensions: EXT_clip_control, EXT_color_buffer_float, EXT_color_buffer_half_float, EXT_conservative_depth, EXT_depth_clamp, EXT_disjoint_timer_query_webgl2, EXT_float_blend, EXT_polygon_offset_clamp, EXT_render_snorm, EXT_texture_compression_bptc, EXT_texture_compression_rgtc, EXT_texture_filter_anisotropic, EXT_texture_mirror_clamp_to_edge, EXT_texture_norm16, KHR_parallel_shader_compile, NV_shader_noperspective_interpolation, OES_draw_buffers_indexed, OES_sample_variables, OES_shader_multisample_interpolation, OES_texture_float_linear, OVR_multiview2, WEBGL_blend_func_extended, WEBGL_clip_cull_distance, WEBGL_compressed_texture_s3tc, WEBGL_compressed_texture_s3tc_srgb, WEBGL_debug_renderer_info, WEBGL_debug_shaders, WEBGL_lose_context, WEBGL_multi_draw, WEBGL_polygon_mode, WEBGL_provoking_vertex, WEBGL_stencil_texturing

    Tagged:

  • I thought construct's sync used some other faster method of communication, didn't think messages where the right thing to use here. Thanks Ashley, keep up the awesome work.

  • (Reposted because I realized this should be under "Scripting")

    I RTFM and couldn't find ways to add client input value or sync objects thru scripting. What's up with that? Thanks in advance.

  • You do not have permission to view this post

  • I mean, is there even a way? Doesn't seem like it, can't find it in the manual.

  • WAIT YOU CAN DO THAT??? OMG I WAS LISTENING FOR EVERY OBJECT CREATION EVER AND THEN TRYING TO FILTER IT.

    thanks man lol .___. I'm dumb

  • Thank you thank you dop2000!! You're always so helpful.

    However what I want is to translate an "On <family name> created" condition:

    I added an event listener for objects being created, and now have to check if they belong to that family.

    Or is there another way to translate that that you'd suggest?

    edit: also I just realized my approach doesn't even make sense because an object can be in many families. But still, how'd you go about that then?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You could do it using two families that have the same objects in them (for you to reference the correct uids) like so:

    shooter_team has LOS to shooter_team2(or whatever name)

    for each shooter team

    -----shooter_team.UId not equal to shooter_team2.UId --> team targets team 2

    -----(whatever whatever whatever conditions)

    (srry I don't know how to format it in a pretty way)

    maybe also try removing the for each, seems like it should work

    and also maybe you can just use the same family, cause I feel like objects won't detect LOS to themselves but I'm not sure

  • I've searched everywhere in the forum and documentation but can't find any mention on how to reference families in scripting. I'd like to know how to get the family name of an object I have a reference to, and how to reference a family for doing stuff.

    I SWEAR I RTFM

  • I don't know if I get exactly what you ask, but I've recently created a very modular system for something similar and I'm very proud of it.

    In my roguelike dungeon crawler, I've put every entity (as in the player, enemies, and even stuff like breakable pots and crates but that is irrelevant here) into an Entities family. Then, one of the variables for that is Target, which contains the UId of another entity this entity desires to attack. Then all the logic that controls the entities always uses the target variable to define what they are attacking, walking towards, or anything really. So all the enemies' Target is defaulted to the player's UId, but I can make any of them fight any of them if I really want to. AND THAT IS AWESOME!

    edit: oh and I forgot a very important bit: every weapon an entity can use shoots a projectile (even if it's melee, it's just a shorter ranged one), and that has a variable that contains the UId of entity who fired it. That way, damage is "signed", and can therefore only damage other entities. That logic also applies to "teams". All enmies, for example, also sign their damage as the "enemies" team, and then each weapon may define if it's bullet has friendly fire or not. If it has not, that will only damage entities on other teams. So enemies can even target and destroy crates on the layout if I include so in their AI.

    Man I love this system, hope it helps.

  • Thank youuuuuuuuuuuuuuu!!!

ZeldaVerde's avatar

ZeldaVerde

Member since 11 Nov, 2018

None one is following ZeldaVerde yet!

Trophy Case

  • 6-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

10/44
How to earn trophies