Assigning and object a value

This forum is currently in read-only mode.
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • I have used create object by name, and in the same event or subevent, i want to give that object some values.

    Is it possible and how would i do it?

  • You just solved your problem right there. Under the "create object" action, make some "set value to _" actions. There are probably other ways but this seems to be working fine for me..doesn't just work with values either.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • how do i set value to _???

  • Set a private variable to your value.

  • yeah, but how do i give it to the object if i cannot select the object in the actions by name.

  • Run Script - ObjectName.VariableName = x should help.

  • it doesnt work it says, system is not an object name

    Tank.value('nameofthecreated').id = Tank.uid

    wait ill make an example...

    http://www.mediafire.com/?w2zrig8ycmos5k3

    ok here you go... as you can see i cannot set the value properly

  • The created object Sprite.Value('c1'), not Sprite.Value('create1') (pv does not exist), should be placed into the SOL automatically after its created.

  • I dont understand but it creates the object by the name of the create1 var... the c1 is just so the event doesnt loop. The point is, i want to set the value id to the uid of the sprite to the created object(smiley) ...

    I mean is there a way to change the selected object to the one created within the actions, and giving it a value...

  • Question is why do you need to create the object?

    http://dl.dropbox.com/u/666516/idtouid.cap

  • I need to create the objects... mostly because they are weapons that go on player and enemy ships, and can be changed and destroyed without a host ship, and it would be quite good if i could set the value the way that i wanted as shown in the example cause otherwise i would need to make events for all weapons in the game, lets say around 20-30weapons *8 so around 100-200 events... instead of just 8 events this way...

    I mean its quite simple,

    create object by name "kifla",

    set "kifla" value to something,

    but i dont know how to set values based upon the name of the object. Isn't there some python thing or whatnot to do that?

  • Don't use create by name if you want to modify the object right after it's created. In this situation it's easy enough to just add a few more events. It will only be one extra event per object.

    <img src="http://dl.dropbox.com/u/5426011/pics/events.GIF">

    p.s. mspaint makes some retro looking GIFs.

  • I see. Yeah you can't reference that object since the duplicate instance is already in the sol.

    You will need to use a dummy instead.

    Pretty sure you cant place an object in the sol, and then remove it in the same event.

  • Rojohound i just said that i would need atleast 200 events if i were to do that.

    But anyway i found a solution, a subevent with overlap... ill post example if anyone interested.

    Here:

    http://www.mediafire.com/?xmeib98no5o27n6

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