[Plugin] Nickname, [Behavior] Nickname

  • Jase00 are you using the behavior, if so, i believe you can just check what the nickname property is, so if nickname = "" > its empty

  • vtrix , Ohh I'm using the plugin :P But thank you!

    My scenario involves having an item spawn from an Array, e.g. "hat" or "pistol", and I can use the Nickname plugin to spawn the item correctly (and if the array is blank, I do a "[Negate]Is Array (0,0,0) = "" " like you've sorta mentioned :P), but if for whatever reason an items' nickname doesn't actually exist, it glitches things up pretty bad as the following conditions that would affect the newly spawned item (setting the spawned objects properties), would go to ALL objects that exist within the family of the item I attempted to spawn.

    The reason this isn't TOO big of a problem, is because I don't really think there'll be much chance of the Array having an non-existant item within it, but if there does come some form of case (E.G, custom-made items in-game that a user can specify their own nickname for), then there would be a need for some form of "Does nickname exist?" action.

  • i suggest you use the behavior too, its just an addon to the plugin, you can better see what nickname each object has, (test it on a new project),

    but for you case, you could also just redo the random pick, if arrayvalue is "", or maybe.. they get nothing! <img src="smileys/smiley3.gif" border="0" align="middle" />

  • Update:

    Please update nickname plugin and nickname behavior

    • pick instances by invalid nickname now will clean the SOL of target family.
    • add condition: is nickname valid , return true if this nickname is valid.
    • add condition, action: pick instances by nickname matched

    Designer could pick instances (from more then one type) by nickname which matched the target string.

    Capx

    In this demo, there are 3 object types, these nicknames are "[obj][A]", "[obj][\B]", "[obj][C]".

    Pick the matched instances with "[A]" will get the instances with nickname "[obj][A]" only.

    Pick the matched instances with "[obj]" will get the instances with nickname "[obj][A]", "[obj][\B]", "[obj][C]".

    Jase00

    Have a nice day~

  • Update

    Please update nickname behavior.

    Add "Mode" property, It had 2 mode,

    • "Manual" mode is older mode, assign nickname by user.
    • "SID" mode will assign an unique number (sid, generated by engine actually) automatically.

    Demo capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • vtrix

    Ohh, I didn't explain things properly; I'm using both the plugin + behaviour as required, and have implemented it into my game and it works perfectly, I need a way to detect if a nickname exists or not to prevent some unneccecary actions being fired/put up an error message or something :P

    rexrainbow

    Thank you so much, works perfectly! You are a legend!!

  • rexrainbow

    im having trouble with creating nicknamed instances from another layout

    (meaning a layout where i place my objects) previously i put all my objects in first layout, so it wasn't an issue

    but its getting to complex.

    i tested system create object and this works, so my question, is it a plugin limitation or something that could be fixed/added ?

  • i just created an example of usage for automatic nickname

    with this you can put all you objects from a family in a list and create from list, without any naming

    in example

    a "for each sort" (sort by object.x )

    put automatic sid to array, make dropdownlist from array

    create object from list

    https://dl.dropboxusercontent.com/u/61666915/objectlist_nickname.capx

  • vtrix

    About the fail of instance creating.

    You might use nickname behavior to register the nickname (and it's mapping object-type), and it need to be run once. (In your case, it had not been run once.)

    A solution is using nickname plugin's action: assign nickname to force register the nickname. Or preload (run once) these object-type before create it.

  • thanks!, tested and working

  • Great plugin and behavior Rexrainbow! Thanks for all of your excellent work.

    I'm writing this quick note to save others some grief. I spent a couple of hours struggling with the SID mode of the nickname behavior before I realized that all nicknames must be passed as strings, even in SID mode (where the variable returned is a number). So, to call the SID properly, you need to wrap Family.Nickname.Nickname in a str() function or it won't work. Of course, once I realized this, I checked the API and of course discovered that Nickname is listed as a string.

    Live and learn.

  • joeykid6

    SID mode is just a lazy mode that user has a lot of object-types and does not care the real nickname of each object-type.

    For example , create the same type of instance at somewhere when touching object.

  • Just wanted to say this is the most amazing plugin ever! Thx rex!

  • Does this still work for the latest version? I get an error

    "Unable to load behavior in rex_nickname: Found 'GetBehaviorSettings' global, but it is not a function

    This behavior will not be available in the editor

  • Rex_nickname is a plugin, rex_bnickname is a behavior , you might put them into wrong folder.

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