Results 1 to 11 of 11

Thread: More COG help please!!!

  1. #1
    About to lose his freedom
    Posts
    3,771

    More COG help please!!!

    ok, i am working on eventually getting a friendly stormie to follow you around and fires at enemies... but right now i am just figuring out how to get an actor to follow you.

    i have it working as of now so that if the actor is ever further than 0.3 distance from you it will move to your current location... but the problem it it moves to your exact location, bumping the player out of the way to get there. i want to get it so once the actor is within 0.3 of the player the actor will STOP...

    any help??
    Code:
    symbols
    
    
    message    startup
    message    pulse
    
    
    thing    player        
    thing    trooper    
    
    
    flex    movespeed=1.5
    flex    thinkRate=1.0
    flex    ctrlocator=0.30    local
    
    
    vector    position0        local
    
    
    end
    # ========================================================================================
    
    
    code
    
    
    startup:
           AiSetMoveSpeed(trooper, movespeed);
        SetPulse(thinkRate);
        return;
    
    
    # ........................................................................................
    
    
    pulse:
        position0 = GetThingPos(player);
        if (VectorDist(GetThingPos(trooper), position0) < ctrlocator) {
            return;
        }
        else {
            AISetLookPos(trooper, position0);
            AiSetMoveThing(trooper, player);
        }
        if (GetHealth(trooper) <= 0.0) {
            SetPulse(0.0);
        }
        return;
    
    
    end
    Welcome to the douchebag club. We'd give you some cookies, but some douche ate all of them. -Rob

  2. #2
    About to lose his freedom
    Posts
    3,771
    as a side note i tried adding this with "ctrlocator1" defined as .25
    but the actor does not follow the player at ALL now, regardless of how far away it is.
    Code:
    if (VectorDist(GetThingPos(trooper), position0) < ctrlocator1) { 
        StopThing(trooper)    
    }
    Welcome to the douchebag club. We'd give you some cookies, but some douche ate all of them. -Rob

  3. #3
    Post the version with the addition.
    And when the moment is right, I'm gonna fly a kite.

  4. #4
    About to lose his freedom
    Posts
    3,771
    Code:
    symbols
    
    
    message	startup
    message	pulse
    
    
    thing	player		
    thing	trooper	
    
    
    flex	movespeed=1.75
    flex	thinkRate=1.0
    flex	ctrlocator=0.30	local
    flex	ctrlocator1=0.25	local
    
    
    vector	position0		local
    
    
    end
    # ========================================================================================
    
    
    code
    
    
    startup:
       	AiSetMoveSpeed(trooper, movespeed);
    	SetPulse(thinkRate);
    	return;
    
    
    # ........................................................................................
    
    
    pulse:
    	position0 = GetThingPos(player);
    	if (VectorDist(GetThingPos(trooper), position0) > ctrlocator) {
    		AISetLookPos(trooper, position0);
    		AiSetMoveThing(trooper, player);
    	}
    	if (VectorDist(GetThingPos(trooper), position0) < ctrlocator1) { 
    		StopThing(trooper)	
    	}
    	if (GetHealth(trooper) <= 0.0) {
    		SetPulse(0.0);
    	}
    	return;
    
    
    end
    Welcome to the douchebag club. We'd give you some cookies, but some douche ate all of them. -Rob

  5. #5
    About to lose his freedom
    Posts
    3,771
    hmm... also do you think something like this might be easier done with several cogs that just move the actors to different ghost positions throughout the level, like waypoints??
    Welcome to the douchebag club. We'd give you some cookies, but some douche ate all of them. -Rob

  6. #6
    Quote Originally Posted by Darth_Alran View Post
    hmm... also do you think something like this might be easier done with several cogs that just move the actors to different ghost positions throughout the level, like waypoints??
    That's what I would do.
    And when the moment is right, I'm gonna fly a kite.

  7. #7

    NIKVMVS-REX-TODOA

    Posts
    17,500
    Quote Originally Posted by gbk View Post
    That's what I would do.
    I thought you'd ride the snake.

  8. #8

  9. #9
    Quote Originally Posted by Darth_Alran View Post
    Code:
        if (VectorDist(GetThingPos(trooper), position0) < ctrlocator1) { 
            StopThing(trooper)
        }
    bruh;

  10. #10
    Registered User
    Posts
    7,353
    thanks bro
    /end of endless suffering

  11. #11

    NIKVMVS-REX-TODOA

    Posts
    17,500
    Damage control: I'm not gonna look at the main forum listing just to see "Last post by: Koobie"

Posting Permissions

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