Pages: 1
  Print  
Author Topic: Inheriting an object with a instance local variable gives error.  (Read 5188 times)
Offline (Unknown gender) crxtrdude
Posted on: December 26, 2015, 09:56:02 am
Member
Joined: Dec 2015
Posts: 22

View Profile WWW
Hey guys, I've got this thing that was quirking me here. Not sure where to put it, but I'll just place it here.

To replicate, I made a local float like this:

Code: [Select]
local float hsp;
hsp = 0;

...

Now supposed if that code was in the create of a parent entity.

We then make a child for it, obj_player for example then in the  creation script, we want to inherit what was there:

Code: [Select]
event_inherited();
...

When I do that, an error gives off like this:

Code: [Select]
error: invalid initialization of reference of type 'float&' from expression of type 'var'
       case obj_player: return ((OBJ_obj_player*)inst)->hsp;
                                                        ^

Just an heads up for you guys.
Logged
Pages: 1
  Print