Heroes4hire's Recent Forum Activity

  • "i could use dictionary and insert a name line by line. then random(1,30) on the x axis."

    is what i said. but you cant insert name line by line in a dictionary; i used the dictionary to store up to 8 values on picking up creatures to memorise their name and hp. so on dropping them i just spawn a new one with the same stats and name.

    i meant array.

    *i could use *array* and insert a name line by line. then random(1,30) on the x axis.

    * sorry if i confused the matter!

    i havent stored anything yet. wanted to know the best way TO store names.

    using an array, ill have to individually put in the names.. and.. its 30 names for imps.. each creature will have 30 names. so ill have to add hundreds of individual names into an array. possible.. but oof, that will take a day just to do that.

    is there a better method to add 30 names, per creature type? like clipboard, where i can just type out all names, and pick a random line of text.

    not a hard task, just wondering the most efficient way to do it.

    ty as always lionz

    the effect is. each creature will have its own name

  • yeah, ok. i hope i see what you want.

    box to follow the hoard (who is in the library. and to stay middle of the hoard. so when some leave, they are removed from the hoard.

    cos(B-C):\cos(C-A):\cos(A-B)

    one way of getting the centre of 3 points (triangle)

    but, thats just one way.... i think its the best, as it doesnt care what type of triangle it it

    omnicalculator.com/math/centroid

    (this website has a ton of math that you could try)

    Gₓ = (x₁ + x₂ + x₃ +... + xk) / k

    Gᵧ = (y₁ + y₂ + y₃ +... + yk) / k K is the number of zombies. G is center point

    this is the simplist i could find to get a center point for more zombies.

    so, that should find a mid point constanly between all zombies within a hoard.

    wow this takes all my time. i pray this works and i understood what you needed lol

  • yeah, on created, you need to give it a uidcheck variable. the uidcheck is for an instance of a zombie's uid. most likley the leader.

    then it always knows what instance of zombie it is specifically acting to.

    *edit* or.. is that the problem, its always choosing the same zombie, and you dont want it to choose any?

    is it you want it to set a midpoint for all zombies?

  • i have the layout scroll out with the mouse wheel.

    the hud doesnt scroll to this layout.

    sure its simple fix, but, great if i can get an answer so i can implement it tomorrow.

    ty all

  • ah yeah, i meant array. i used dictionary to store names on picked up objects.

    just seems like an hour of clicking and adding 1 to each event. but, if that is the best way im down to do it,

    ty

  • so. i want to store 30 names. then i want to call a random name on a creature spawned

    i could use dictionary and insert a name line by line. then random(1,30) on the x axis.

    but.. is that the most efficient way?

    could i use clipboard, local storage, file system: to achieve this easier?

    none of which i have experience on. so if i get the nod ill work on the favorable method.

    thanks

    Tagged:

  • ok so. heres the code i use to work out the mid point between 2 objects

    hoard.x+radius*((zombie.x-hoard.x)/sqrt((zombie.X-hoard.X)^2+(zombie.Y-hoard.Y)^2))

    that will give you x

    hoard.Y+radius*((zombie.Y-hoard.Y)/sqrt((zombie.X-hoard.X)^2+(zombie.Y-hoard.Y)^2))

    that will give you Y

    it basicly assumes the hoard box center is the mid point. then zombies will pathfind to a circumference in a circle around it based on where they are.

    you could give the zombies a IV for its own radius ( distance to the center on the hoard square) and adjust it randomly

    then, im thinking have them use 8D to always head to that point. as the hoard moves, they will move with it.

    hope its of use!

  • BaconSwagg yeah, i knew it may be in issue. its why i set the radius as a GV. maybe it just needs playing around with the figure. i tried a little, too small and they cant target the block, too big, and they can target further blocks.

    the blocks are 96x96 : radius should be 48! and that should barely let them get to the block... yet on 16, it seemed to be the perfect figure.

    i may go back to the drawing board at all on it... trying to rule out using raycasting with barely any experience on it.

    maybe i could give the blocks pathfinding... they wont move, but if they can find a path, the imps can target it.

    either way, the conversation on it helps me think, so its appreciated

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • honestly, the pathfinding will get you there. but. to constantly recalculate the path will cause lag with so many instances.

    using 8 direction will help more imo. you can just simulate movement to the point you want.

    im going out. more thoughts later

  • BaconSwagg

    youtube.com/watch

    code:

    for each impbase:

    is not boolean working

    is not boolean targetted

    pick become tile, become tile dig=1

    becometile. pick nearest imp base.

    (so if the imps dont have a job, they arent currently moving to something, and the tile is selected to be dug)

    becometile.x+radius*((impbase.x-becometile.x)/sqrt((impbase.X-becometile.X)^2+(impbase.Y-becometile.Y)^2))

    impbase.Uidcheck: set to become tile UID

    set boolean working true

    set boolean targetted true.

    the path finding code is explained in the video. i had another topic where i explain it. but, it just checks the center point of the tile, and calculates the closest point on the circumfrance to the imp.

    on arrived. impcheckuid>0 set digging boolean true.

    then the dig code is just do an animation based on a timer. and do damage to the becometile that has UID= impbase.uid check.

    just want to add, in the video, the imps stop when they cant reach the block to dig. they will continue to do other jobs when unselecting the block.

    priority is to drop off gold they have when full. dig, and then claim ground

  • ':D yeah, thought i may be shooting in the dark on a 5 year ago project.

    with lionz help i found out about families. been 6 years since i used that.

    but using families and a GV uid check i can pick up individual objects.

    1 more question, sorry bud.

    imps are digging tiles 1 behind the front line. they wont unless its the only option.

    it only happens occasionally. but, its a bug, maybe you faced?

    im using, pick nearest, find path. but despite it being an unreachable route, they do it anyway.

    are you still making c3 games?

  • i have a global variable, that calls the pick up items uid.

    instead of pick nearest, it just sets 1 value on click. worked for overlapping imps. should now work for overlapping familymembers.

    then i can just call the "pick up" conditions on a specific item that uid=GV:uidcheck

    *edit* yup works perfectly. family solved all my problems, legend bro

Heroes4hire's avatar

Heroes4hire

Member since 19 Mar, 2024

None one is following Heroes4hire yet!

Trophy Case

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

Progress

5/44
How to earn trophies