IMG

 
IMG
IMG   IMG
  Welcome to GTAForums! Be sure to check out the Grand Theft Auto V Forum.

You are not registered! (If you are, click here to login) Registering is fast, free and easy and allows you to instantly reply to any topic on GTAForums.
Why wait? Click here to register your own unique username and become part of the ever-growing community!


( Log In | Register | Revalidate Validation E-mail )
Quick Log-In:
  IMG
       
>
Forum Rules GTA Modification Forums

Post mod/code requests in the Mod Requests topic

Post mod releases in the Mod Showroom

Read the Modding Rules BEFORE posting!

GTAGarage.com
free mod hosting from GTANet, simply login with your GTAForums account details

GTAModding.com
GTANet's modding wiki

GTA Modding Chatroom
provided by irc.gtanet.com (Don't have an IRC client? Click here)


  Reply to this topicStart new topicStart Poll

 How to make your Group members enter a car

 
_Pure  
Posted: Saturday, Aug 25 2012, 18:18
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Aug 25, 2012

XXXXX



Well I've been programming with C# for a long time now and recently got into GTA IV modding and realised that it used C#.
The problem I've hit is that I can't make members of my Group enter a vehicle and STAY in it.
I've tried having them enter one by one and using the method group.EnterVehicle(Player.LastVehicle, false, true);
Since the documentation doesn't contain any examples/extensive information I can't use Group.FollowStatus either, any help is appreciated.
PM
  Top
 

 
hardsty1e  
Posted: Sunday, Aug 26 2012, 05:18
Quote Post


Rat
Group Icon
Group: Members
Joined: May 2, 2009

XXXXX



Here you go, saw someone asked this some time ago.

http://www.gtaforums.com/index.php?showtopic=519084
PM
  Top
 

 
_Pure  
Posted: Sunday, Aug 26 2012, 14:28
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Aug 25, 2012

XXXXX



I didn't try that because I knew it wouldn't work and turns out I was correct confused.gif
They open the door then just wait there like clowns until I move a bit then they resume following me.
PM
  Top
 

 
ch3y3zze  
Posted: Thursday, Aug 30 2012, 21:52
Quote Post


ni**erKILLER
Group Icon
Group: BUSTED!
Joined: Aug 30, 2012

us.gif

XXXXX



ped AI in GTA isnt as straightforward as u think, i use a timer to constantly clear peds tasks so they ignore what game tells them to do, just because u get them in the car doesnt mean the game wont keep telling them to do things

i had to expirament to get the correct interval to clear their tasks while using another timer to constantly tell them what i want them to do

hopefully that helps u understand why they keep getting out of the car, gta task commands are not set and forget wink.gif

CODE
//i give u two options, use a timer to clear task and a timer to
//set task so give u control over intervals for the instruction

//or use one timer (Tick method) to instruct to enter car and to clear task
//when inside the car, u will probably want them todo multiple things so
//maybe multiple timers and you coordinate clearing taks and telling them
//what to do, GTA AI is a pain in the ass

//if u want to try my Drug Wars mod let me know and ill send u the dll and u can see what im saying in action;)

using System;
using GTA;

public class StayInCarExample : Script
{
   GTA.Timer clearTaskTimer;

   public StayInCarExample()
   {
       //this can handle what u want ped to do
       Interval = 1000;
       Tick += new EventHandler(task_Tick);
       
       //this will reset peds brain on interval, u need to expiramnet with intervals, 6 seconds worked for my script
       clearTaskTimer = new GTA.Timer(6000)
       clearTaskTimer.Tick += new EventHandler(clearTaskTimer_Tick);
   }
   
   private void clearTaskTimer_Tick(object sender, EventArgs e)
   {
       ped.Task.ClearAll();
   }

   private void task_Tick(object sender, EventArgs e)
   {
       //get your ped and declare as Ped ped = ...
       //get your vehicle and declare as Vehicle vehicle = ...
       //determine the seat you want and declare VehicleSeat seat = VehicleSeat.(insert seat here no parentheses);
       if (!ped.isInVehicle() && !ped.isGettingIntoAVehicle)
       {
           ped.Task.EnterVehicle(vehicle, seat);
       }
       //Option #2 remove the clear task timer and handle clearing task only when they inside a car
       else
       {
           ped.Task.ClearAll();
       }
   }
}


This post has been edited by ch3y3zze on Thursday, Aug 30 2012, 22:15
PM
  Top
 

 
_Pure  
Posted: Sunday, Sep 2 2012, 14:09
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Aug 25, 2012

XXXXX



I really didn't want to resort to using a timer, but guess that is a simple way to do it.
I just thought that the AlwaysKeepTask boolean would do something rather than look useful.
I also wouldn't mind testing your mod smile.gif
PM
  Top
 

 

1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)

0 Members:

Topic Options Reply to this topicStart new topicStart Poll
Search topic for posted by (exact match)



 
IMG IMG