Use text variable for object in a function?

Get help using Construct 2

Post » Wed Aug 28, 2013 3:40 pm

Hi everyone,

I'm planning on making an rpg similar to pokemon - in that you have 9 monsters that you can summon during a battle (only 1 at a time).

What I would like to know is, if it is possible to use a text variable inside a function.

for example: I have a knock back function

global var: current_monster = "monster_1" (and I have a sprite called monster_1 and monster_2)
global car: enemy_monster = "monster_2"

+on function "knockback"

current_monster set bullet enabled
current_monster set speed round(random(100,300))
current_monster set angle of motion to angle(enemy_monster.x, enemy_monster.x, current_monster.x, current_monster.y)
Etc, etc

At the moment I'm pretty sure it is not possible, however I am only using the free version. Is this possible with the full version or not at all?

Posts: 1
Reputation: 202

Post » Wed Aug 28, 2013 5:22 pm

Object referencing is usually done via UID. But you need families to be able to reference through multiple kind of object at once, thus the need to upgrade to the paid version.

There IS a way without it though, but you'd have to do one of the two possible alternatives :
-All "monsters" are the same sprite object (with multiple animations)
-Duplicate all events for each kind of monster
Posts: 1,029
Reputation: 21,143

Return to How do I....?

Who is online

Users browsing this forum: dop2000, JoniArtha and 2 guests