Jump to content
  • Advertisement
Sign in to follow this  

Reference object with properties

This topic is 2377 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts


I have a Npc class like this

class Npc
int hp;
int Jump();

i dont want to register it as value since Ai module handles all npc objects. i wont create or destroy any npc objects in AngelScript neither.

i just want to pass around this npc pointer between c++ and angelscipt, with no garbage collecting.

i do something like this;

r = engine->RegisterObjectType("Npc", 0, asOBJ_REF | asOBJ_NOCOUNT); assert( r >= 0 );
r = engine->RegisterObjectProperty("Npc", "int hp", asOFFSET(Npc, hp)); assert( r >= 0 );
r = engine->RegisterObjectMethod("Npc", "int Jump()", asMETHOD(Npc,Jump), asCALL_THISCALL);assert( r >= 0 );

second line causes assertion: "Failed in call to Function RegisterObjectProperty".

what is the correct way of registering class properties in reference objects?

thank you.

fixed. i was using unsigned int :( (should be uint)
i have been looking this line for an hour but couldnt see my obvious mistake

Share this post

Link to post
Share on other sites
Hi saejox,

I'm glad you figured out the problem on your own.

However, I'll see if I can make the error message returned by AngelScript be more explicit to reduce the time to identify the problem. Thanks for the report.


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!