PDA

View Full Version : [Question] Astar (a*) and SetAlive functions



RobsoN
23rd February 2014, 13:14
Hello, I want to ask how to use 2 functions: astar and setalive. What values ​​of closer id have those functions?
Could you give any examples of those 2 functions? Thanks in advance.

Regards, RobsoN.

Mitch
23rd February 2014, 13:27
Hello, I want to ask how to use 2 functions: astar and setalive. What values ​​of closer id have those functions?
Could you give any examples of those 2 functions? Thanks in advance.

Regards, RobsoN.

setAlive: http://killtube.org/downloads/libcod/std/entity.gsc

astar


switch (function)
{
#if COMPILE_PLAYER == 1
case 0: return gsc_player_velocity_set(); // todo: stackGetParamVector
case 1: return gsc_player_velocity_get();
case 2: return gsc_player_button_ads();
case 7: return gsc_player_state_alive_set();
#endif

#if COMPILE_ASTAR == 1
case 8: return gsc_graph_new();
case 9: return gsc_graph_add_edge();
case 10: return gsc_graph_add_vertex();
case 11: return gsc_graph_delete();
case 12: return gsc_graph_build();
case 13: return gsc_graph_do_astar();
//if (function == 14) { return gsc_tracefraction...;
case 15: return gsc_graph_get_nearest_edge();
//if (function == 16) { return gsc_math_nearest_point_on_linesegment();
#endif
}

#if COMPILE_ASTAR == 1
if (function == 16)
{
float from[3];
float to[3];
float toPoint[3];
int helper = 0;
helper += stackGetParamVector(1, from);
helper += stackGetParamVector(2, to);
helper += stackGetParamVector(3, toPoint);
if (helper != 3)
{
printf_hide("scriptengine> wrongs args for: int MATH_nearest_point_on_linesegment(from, to, toPoint, out_point)\n");
return stackPushInt(0);
}
float out_point[3];
MATH_nearest_point_on_linesegment(from, to, toPoint, out_point);

return stackReturnVector(out_point);
}
#endif

kung foo man
23rd February 2014, 15:35
The damage acts like: model notify("damage", iDamage, eAttacker);



while (1) {
model waittill("damage", iDamage, eAttacker);
iprintlnbold("damage: " + iDamage);
}


About the A* functions, I never uploaded the actual implementation of it (just use the _astar.gsc, it's even more dynamic).

Mitch
12th March 2014, 17:42
The damage acts like: model notify("damage", iDamage, eAttacker);



while (1) {
model waittill("damage", iDamage, eAttacker);
iprintlnbold("damage: " + iDamage);
}



setAlive works now like this


model setAlive(1);


In order for this to work you need a high collision model:
670