Results 1 to 4 of 4

Thread: [Question] Astar (a*) and SetAlive functions

  1. #1
    Private First Class RobsoN's Avatar
    Join Date
    Jan 2013
    Location
    /home/cod2/
    Posts
    230
    Thanks
    119
    Thanked 95 Times in 64 Posts

    [Question] Astar (a*) and SetAlive functions

    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.
    "Don't worry if your code doesn't work correctly - if everything worked, you would not work" ~Mosher's right

  2. #2
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Quote Originally Posted by RobsoN View Post
    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
    PHP Code:
    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(1from);
            
    helper += stackGetParamVector(2to);
            
    helper += stackGetParamVector(3toPoint);
            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(fromtotoPointout_point);

            return 
    stackReturnVector(out_point);
        }
        
    #endif 

  3. The Following 2 Users Say Thank You to Mitch For This Useful Post:

    RobsoN (23rd February 2014),smect@ (12th March 2014)

  4. #3
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    The damage acts like: model notify("damage", iDamage, eAttacker);

    PHP Code:
    while (1) {
        
    model waittill("damage"iDamageeAttacker);
        
    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).
    timescale 0.01

  5. The Following 2 Users Say Thank You to kung foo man For This Useful Post:

    Mitch (12th March 2014),RobsoN (23rd February 2014)

  6. #4
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Quote Originally Posted by kung foo man View Post
    The damage acts like: model notify("damage", iDamage, eAttacker);

    PHP Code:
    while (1) {
        
    model waittill("damage"iDamageeAttacker);
        
    iprintlnbold("damage: " iDamage);

    setAlive works now like this
    PHP Code:
    model setAlive(1); 
    In order for this to work you need a high collision model:
    Click image for larger version. 

Name:	Capture.PNG 
Views:	83 
Size:	13.0 KB 
ID:	670

  7. The Following 3 Users Say Thank You to Mitch For This Useful Post:

    kung foo man (12th March 2014),RobsoN (12th March 2014),smect@ (12th March 2014)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •