randomly's Recent Forum Activity

  • [quote:3117olom]What's also weird is when I upload it to the scirra arcade it is totally fine the first time you play but if you refresh the page it stops working

    First of all, this doesn't happen to me.

    Works perfectly after reloading the page.

    Must be a local issue.

    _______________________________________

    [quote:3117olom]When I run my game preview in a browser it works perfectly fine, but when I export it and upload it it stops working! I get a blank screen and can only hear audio. You can try it here: http://robert-kent.com/trainerwreck/

    Also, this doesn't happen when I open the link.

    There are some white flashes on the screen when the enemies collide with the server, but neither does the screen stay white nor does a blank screen appear.

    And when I opened your .capx, I saw that the short flashes are intended.

    The issues you encounter seem to be connected to your browser, since it works perfectly for me.

    (Btw, I'm using Waterfox, a modified version of Firefox)

  • Currently, there is no way to do this with the "Scroll To" behaviour.

    But you can do the following:

    • Remove the ScrollTo behaviour
    • Add an event "Every tick"
    • Under that event, add the action "System: Scroll to position
    • As X and Y, insert the X and Y coordinates of your player. Now, you can add the offset

    This could look like this:

    Every tick:
    -----Scroll to    Player.X+50 ,  Player.Y
    [/code:vbuw0rm6]
  • Here you go:

    Download .capx

    Important:

    This is a very rough and unfinished version, not very backend-friendly.

    It is not commented, so it probably is quite confusing.

    I don't have the time to comment it yet, so I will add that later.

    You will also have to understand XML to understand how the program works.

    You won't need it though to add new recipes, since XML is easy to edit.

    There is also one quite big issue:

    Recipes with more than one ingredient of the same kind (like Sharp Stone, 2xStone) will be crafted with one ingredient only and will cause other recipes with the same ingredient to stop working correctly.

    I'll probably address this in the future, if you can't fix it yourself.

    It is possible, but quite tedious.

    This is my first use of XML in a project, so keep in mind that there might be better solutions than the one I used.

    You may want to bump this thread if you think you need more help.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just to let you know, I'm working on an example for you.

    By the way, it's in XML, I think that's more suiting for a crafting system than an Array.

  • [quote:1b7rhigt]Apparently, there is a problem with sending a variable as a message.

    Try wrapping a "str()" tag around the global variable.

    So that the message is 'str(variable)'.

    _____________________________________________-

    [quote:1b7rhigt]As you can see in my .capx, I already have a "Creatures" family with all the sprites in it

    Tried to look at your .capx, your file doesn't exist anymore under the link you posted.

    Please update the link.

    ____________________________________________

    [quote:1b7rhigt]I tried your idea of "picking "Creature" by evaluating "Index = Spawn" but that did not work

    This is exactly how it should work.

    Put the whole family in the picking event and set the condition as "Self.Index = [your_variable]".

    If that doesn't work, then it's the Spawn variable that is the problem.

    _____________________________________________

    [quote:1b7rhigt]But that wouldn't work since "Groupgenerator.Next" is a number and not a string (damn, that limitation is troublesome).

    I see, you are not familiar with "str()" and "int()" yet.

    You can remove number or string limitations by putting "str()" or "int()" around your variable.

    So when the expression needs to be a number, use "int(variable)".

    This will automatically take all the numbers that are in the string and make a number out of that.

    When you need a string, use "str(variable)".

    This will convert numbers or anything else to a string so you can e.g. send it via Multiplayer.

    Just remember to convert it back when receiving a message if needed.

    _________________________________________

    [quote:1b7rhigt]Here is another idea I just tried, but it failed (too bad! I was confident this time ah ah) : I created a "GlobalValues" dictionnary. The host task is to add a "Timer" key every second with the value "Timer" (global variable's current value), and add a key "Group" on peer connected, with the value "GroupGenerator.Next". Then, broadcast a message every second, tag "Timer", message "GlobalValues.Get(Timer)" and send a message on peer connected, ID "Multiplayer.FromID", tag "Group", message "GlobalValues.Get(Group)". For the peers : on peer message, tag "Timer"/"Group", set "Timer/Group" (Global variable) to "Multiplayer.message".

    May I ask what the "timer" variable is for?

    And what the exact purpose of the dictionary and the whole process around it is?

    I don't seem to grasp it yet.

    Broadcasting and using dictionary values shouldn't be too hard, so if you tell me what the purpose of it is, I can help you with it more easily.

    [quote:1b7rhigt]Then, broadcast a message every second, tag "Timer", message "GlobalValues.Get(Timer)"

    Also, why don't you just broadcast the variable directly?

    Why does it have to be in the dictionary first?

    ________________________________________________________

    [quote:1b7rhigt]But I have troubles with this whole "host transforms into JSON > send to peers > Peers transform back to dictionnary objet" process. I think I would need a concrete example on that one.

    As simple as this:

  • We definitely need either your .capx or a screenshot of your event sheet to solve this,

    since this is no common problem but a specific issue.

  • Okay, without the .capx, this will be a bit more difficult. But I understand that your project is quite big already and cutting it properly will take long.

    Anyways, as I said, debugging from the distance is quite hard.

    So let's start some tests.

    • Did you try not restarting the layout on death, but instead scrolling to the start point?
    • Do you have any other events that set "stagearea"?
    • You probably already looked at "stagearea" in the debug view right? If you didn't yet, go ahead and see how and whether it changes when entering rooms
    • Try adding "Trigger once while true" to the last condition in your screenshot. Just to make sure, this isn't what causes the problem

    That's about everything I can think of now without looking at the .capx.

  • Sorry that I didn't reply earlier.

    I don't get a notification when you edit your post without mentioning my username.

    Let's go through your questions one by one:

    From the first post:

    [quote:30npxdth]I see no way to ask for the "first" value in the meaning of "the first of the randomly generated string of value" but only in the meaning "lowest possible value (the opposite of end value)"

    [quote:30npxdth]asking for the "next" value for the first time will actually give the first value in the string

    Since Smart Random's Expression "next" starts at the minimum of the second value and only "start" returns the first value, you won't be able to simply always use "next".

    I suppose you use a function.

    You will call the function with the parameter of the random number index you want.

    (If you want the first random number, call the function with parameter 1, for the second, choose parameter 2 and so on)

    The function itself will check what the parameter ( Function.Param(0) ) is.

    If it is 1, it will set the function's return value to "SmartRandom.Start".

    If it is bigger than 1, it will set the function's return value to "SmartRandom.Next".

    Like this, you can simply call this function with the appropriate parameter when you need a new random number.

    _______________________________________

    [quote:30npxdth]Actually I have trouble now I am using families

    Try this .capx I created:

    Capx Download

    _________________________________________

    From the second post:

    [quote:30npxdth]I can't find a way to synchronize the "timer" global value. Everybody should have the host "timer", but I see no way to broadcast a number value.

    When the "timer" value is changed by the host, add an action "Multiplayer: Broadcast message".

    • From ID: Leave this like it is, since "" indicates that the message comes from the host, which is what we want
    • Tag: Change to what you like, for example "timer"
    • Message: Obviously, you put your global variable in this.
    • Mode: Leave this like it is too. This is only really important for real-time games (e.g. Multiplayer Shooter)

    Also, make sure that you add an event for the peers:

    "Multiplayer: On message "timer": Set timer to: 'Multiplayer.Message'".

    And make sure, no other action apart from this changes the global variable when you aren't the host.

    __________________________________

    [quote:30npxdth]I can't find a way to send to each peer, upon connection

    There are multiple ways to do this.

    First of all,

    add this event:

    "Multiplayer: On peer connected".

    This triggers when somebody joins the same room.

    Then, under that event, you can save the ID of the player that just connected or any other information you want by using "Multiplayer.From____" (e.g. FromID, FromAlias). This will return the information of the peer that just connected.

    Instead, you could also use "Multiplayer: PeerAliasAt(PeerCount-1)/PeerIDAt(PeerCount-1).

    This will return the same values since the player that just connected has to be the most recent player in the room and therefore, this will return his information. ("-1" since PeerAliasAt needs an index which starts at 0 and the PeerCount starts at 1)

    When you saved those values (to a dictionary, for example), you can send the needed information, e.g. the group number, to this peer using the aforementioned values.

    You need to add an action "Multiplayer: Send message" under the "On peer connected" event.

    As the peer ID, use the values mentioned above.

    The rest is the same as above.

    (Note: you don't have to save the ID/Alias, but it might be useful later)

    __________________________________________

    [quote:30npxdth]Is there a way to simplify the list of 30 events for spawning creatures using family ?

    See the .capx I posted above.

    _________________________________________________________-

    [quote:30npxdth]I feel like dictionnaries and arrays will come in handy here, but I am not yet familiar with those. Anyway, next step will be implementing the scoring system, so I will have to learn about it quite soon.

    Just tell me where you need help if the C2 manual didn't help you.

    Dictionary manual entry

    Array manual entry

    ________________________________________________________

  • cristiart

    Since r240, this error always happens for me when launching C2.

    I don't know what it causes, but I simply press "Retry" and no further problems appear.

  • Or, even better, adding a condition directly to the event/previous condition.

    (By clicking "Add condition" in the "events" bar)

    Most of the times, this is more useful than adding a sub-event, but that depends on your needs.

  • Nothing is impossible. ;)

    What I can tell from your screenshot looks fine to me.

    The problem probably lies in the way you "restart" the stage.

    Are you restarting the layout?

    Or are you scrolling to a specific point in the layout?

    Because when restarting, the stagearea variable should be set to the stage's checkpoint number, correct?

    If your current game isn't too big, a .capx would be very helpful too.

    Also, adding a "Trigger once while true" to the last condition in your screenshot would be good too.

    (It probably doesn't solve the problem, but it's a nice habit to add it to conditions that don't have to trigger every tick)

  • Awesome!

    Thanks very much!

randomly's avatar

randomly

Member since 26 Sep, 2016

Twitter
randomly has 1 followers

Trophy Case

  • 8-Year Club
  • Email Verified

Progress

9/44
How to earn trophies