[Plugin] Nickname, [Behavior] Nickname

  • rexrainbow

    Thanks for your help with all of this.

    Is there a way to see an object's nickname in the debug preview?

  • Update:

    • Now the nicknames and their names of object-type will be shown in debug panel.
    • Parameter of picked object-type could be normal object-type or a family object-type.

    justifun

    Here it is.

  • Hi rexrainbow

    I was wondering it it's normal or a bug that the bnickname behaviour only works if that object is already present in the layout, whereas the 'assign nickname' action works fine without.

    Currently I'm keeping all my object types in separate layouts for organization, (the game creates levels from scratch in a blank layout) and I'm using a huge list of 'assign nickname' actions on start up. It works okay, but is problematic for other reasons and is just inelegant.

    Also, earlier in this thread you mentioned setting the nickname plugin to 'global' but I'm not seeing the setting either. Is that maybe related?

    thanks in advance.. also thanks for this plugin! this is essential for larger projects i think

  • keepee

    Behavior will be run only if object had been created. I did not have any other way to make it happen automatically, sorry.

    Or, you might have some resource layouts to place these objects. And only add one event

    + on start of (resource) layout

    • go to game layout

    So that these objects had been created again before game start.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • rexrainbow, good idea this works okay thanks!

  • Update

    rex_nickname plugin: fix a possible SOL bug after creating object.

  • 404 not found.

  • I'm having problems using this. Not sure if I might be using it the wrong way!

    I create a new Sprite (Sprite1).

    Add the behaviour "Nickname".

    Copy the object (now having 2 instances of it in the layout, both with the "Name" of "Sprite1").

    The first one i "Nickname": "button_1" and the second: "button_2".

    Then i select the action: "Pick matched instances" and enter "button_1" as the nickname to be matched.

    Then i select the action to set visibility of "Sprite1" to invisible.

    Run the preview.

    Both of them are invisible.

    Is this intended behaviour?

    Thank you, rexrainbow

  • Whyser

    Here is a sample capx of "Pick matched instances".

  • In your example all the instances (Sprites) are of a different "Object type" (A, B and C). My scenario is that I have one Object type: "Sprite1" and clone this, but assign different Nicknames.

  • Whyser

    Sorry, that could not work. Nickname is a name of an object type.

    You might use instance variable in your case.

  • Okay thank you, then I know!

  • I think I'm missing something here. How can I create an object using nickname and then select that object?

    As an example: I have a gun that I want to create a projectile by using nickname. Then since all projectiles are in a projectile family I want to grab the object that I just created and do some more configuration on it (set the projectile's angle, set the UID of the weapon that spawned it, etc) Is there any way to do this?

    for your example :

    that's basic coding

    if u create a new bullet just add a event with the actions u want to do they are available by default using C2

    E.G when mouse is pressed > spawn bullet on layer 1 at point 0 of wep u want to spawn on.. if u want to record a UID then just call the uid of the wep and do a instance variable on the bullet and set the variable to the wep uid if u want to use it later for something else but uid's usually they are not necesarely for use unless u have some AAA game ... then i guess ur bullet has a bullet behavior for movement ( just add the action under the condition above sayng bullet>bulletbehavior> angle of motion set to speed set to etc and will do that instantly when the bullet is created

    be sure that the actions u give to the bullet to be under him not above cause then wont happen nothing... cause there is no bullet on screen to perform those action (always customize a bullet or a character after u gived the comand to spawn it)

    unless Ur thinking on something else

    rexrainbow nice plugin usefull

  • Thank you for this amazing plugin/behavior. It helped me solving problems I was facing to on almost every project I've worked on with Construct.

    I just have one question. Instead of "creating" an instance of a selected sprite with a specific nickname, would it be possible to just select this sprite ?

    I'll give an exemple to my issue, which is not really an issue, but you'll see what I mean :

    Imagine I have a monster family, which contains :

    • troll
    • skeleton
    • justinBieber

    It also their nicknames.

    Now I have also a gibs family which contains this :

    • trollGibs1
    • trollGibs2
    • skeletonGibs1
    • skeletonGibs2
    • skeletonGibs3
    • skeletonGibs4
    • justinBieberGibs1
    • justinBieberGibs2

    These are their nicknames too.

    Now here are my events spawning gibs for any enemy :

    [attachment=0:1h38umtg][/attachment:1h38umtg]

    That's pretty simple. If the dying enemy is names "skeleton", the loop will look for sprites which have a nickname like "skeletonX" where X is the loop index.

    Basically, it will pick the nicknames skeleton1, skeleton2, skeleton3, skeleton4, spawning the current gibs at each stop of this loop, and when it can't find skeleton5, the loop will stop.

    It works perfectly, exept I don't know how many gibs will spawn when I create the first instance, It even could be 0, so I must destroyed the instance I had just created in my actions in order to launch the while loop which will decide how many gibs (0 to arbitrary number) must be spawned.

    I don't know if I explain well, I'm not fluent in english !

    Well, basically, ma question is : instead of having "nickname : create [instanceName]" would it be possible to have something (action or condition) like "nickname : select/pick [instanceName]" ?

    I guess it's not, because you can't access any sprite property if there is no existing instance… Am I right ?

  • le Canapin

    "Action:Pick all instances", "Action:Pick matched instances" or "Condition:Pick instances", "Condition:Pick matched instances" might be the solution. It needs to assign nickname for object type first, too.

    Or you might use private variable to pick matched instances.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)