[Plugin] Nickname, [Behavior] Nickname

Post your completed addons to share with the community

Post » Mon Feb 09, 2015 10:10 am

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.
B
4
Posts: 12
Reputation: 224

Post » Mon Feb 09, 2015 10:21 am

@Whyser

Sorry, that could not work. Nickname is a name of an object type.
You might use instance variable in your case.
B
97
S
22
G
176
Posts: 4,109
Reputation: 103,021

Post » Mon Feb 09, 2015 12:58 pm

Okay thank you, then I know! :)
B
4
Posts: 12
Reputation: 224

Post » Mon Feb 09, 2015 3:38 pm

noonche wrote: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 :D
ImageImageImageImage
B
47
S
12
G
43
Posts: 1,096
Reputation: 28,028

Post » Sun Feb 15, 2015 10:08 am

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 :
gibs.png


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 ?
You do not have the required permissions to view the files attached to this post.
B
12
S
7
G
7
Posts: 446
Reputation: 4,268

Post » Sun Feb 15, 2015 3:05 pm

@Coin-coin 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.
B
97
S
22
G
176
Posts: 4,109
Reputation: 103,021

Post » Thu Feb 19, 2015 11:38 am

I'll give a try, thank you :)
B
12
S
7
G
7
Posts: 446
Reputation: 4,268

Post » Sat Mar 07, 2015 11:01 am

Update:
Add Expression:LastCreatedInstUID



Change properties of this created instance
Sample capx
Get this created instance UID by "Expression:LastCreatedInstUID". User might change properties of this instance by rex_uid2prop plugin. Only common properties (x,y,angle,opacity) could be assigned.
B
97
S
22
G
176
Posts: 4,109
Reputation: 103,021

Post » Tue Mar 10, 2015 12:44 am

I installed both plugins and tried your sample file, but it gives me this :

Image
You do not have the required permissions to view the files attached to this post.
B
11
S
3
G
3
Posts: 206
Reputation: 2,379

Post » Tue Mar 10, 2015 3:15 am

@Kan

Sorry, test OK in my side.
I upload rex_nickname plugin and rex_uid2prop plugin again.
B
97
S
22
G
176
Posts: 4,109
Reputation: 103,021

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 4 guests