Post by ando on Dec 29, 2009 5:59:42 GMT -8
Some people was interested in my "AI PENDL" script. but it was very complicated to use. So I created new script what is compatible with default *.H and *.CXX files.
Use it as simple AI script, except you need to add DUMMY objects to define where AI is walking.
With this file you must use DUMMY object names as "pendl_#0", pendl_#1, pendl_#2,...
If you need second way for other players then you must rename it in script too.
EXAMPLE: rename "pendl_#%d" as "2_pendl_#%d" (%d is for changing object number)
and then line in script is:
now use dummy objects with names as "2_pendl_#0", "2_pendl_#1", "2_pendl_#2",....
You can add up to 20 dummys for one way. If you need more then change "For" loop in script.
//modyfied by Ando to add PENDL option
//v1.1
#define WORK_MODE_NAME "COOP_US"
#include <inc\Maxovo\!max_support.h>
#include <inc\Maxovo\!max_defs.h>
#include <inc\Maxovo\!max_gameplay.h>
#define PL_SIDE SC_P_SIDE_VC
#define PL_GROUP 3
#define PL_ID SC_P_CREATE_MEMID_AUTO
#define CLASS CLASS_RANDOM_NORMAL
//#define RESPAWN
//#define RESPAWN_FLAGS 1 //0x1 pro kleceni
//#define RESPAWN_TIMES 0 //kolikrat se respawne - 255 = nekonecne
//#define RESPAWN_TIME 10.0 //cas, za jak dlouho se respawne po smrti
//#define RESPAWN_DIST 30.0 //koule v ktere nesmi byt PC, jinak se nerespawne
#define INI_FILE_BODY "cvp_nva02"
//#define INI_FILE_HEAD "hvm_002"
#define EQP_FILE_BODY "G\\characters\\cvp_nva04\\sniper\\eqp.ini"
#define EQP_FILE_HEAD "G\\characters\\_heads\\_eqpini\\vhg002.ini"
#define MP_SEARCH_PLAYER 10 //poslednich x aicek zacne aktivne vyhledavat nejblizsi PC
#define MP_SEARCH_PLAYER_DIST 50.0 //vyhledava maximalne do x metru (nepovinne)
#define MP_SEARCH_PLAYER_RETRY 10.0 //hledani opakuje kazdych x sekund (nepovinne)
#define MAINTASK
#define MAINTASK_COUNT 1
#define MAINTASK_LOOPED FALSE
//#define MWP_SEARCH 30.0
#define PENDL
#define PENDL_POINTS 4
#define PENDL_LOOPED TRUE
#define PENDL_MOVE_STYLE_WALK TRUE
#define PENDL_RETRY_AFTER_FIGHT FALSE
#define PENDL_OBJECTS "pendl_#%d" //name of dummy objects
#include <inc\Maxovo\uni_soldier.cxx>
//___________________________________________ PENDL POINTS_______________
void define_pendl() {
dword cur=0;
sc_nod my_mod;
int i;
char txt[32];
s_SC_NOD_transform trans;
for(i=0; i < 20; i++){//count of objects
sprintf(txt, PENDL_OBJECTS, i);
my_mod=SC_NOD_GetNoMessage_Entity(txt);
if(my_mod){
SC_NOD_GetTransform(my_mod, &trans);
pendl_points[cur].point.x =trans.loc.x; //move to position
pendl_points[cur].point.y =trans.loc.y;
pendl_points[cur].point.z =trans.loc.z;
//rotate and watch to that point (its not direction, its point coords)
pendl_points[cur].look_dir.x = trans.loc.x+sin(trans.rot.z)*10;
pendl_points[cur].look_dir.y = trans.loc.y+cos(trans.rot.z)*10;
pendl_points[cur].look_dir.z = trans.loc.z-sin(trans.rot.x)*10;
pendl_points[cur].look_time = 0.0;
pendl_points[cur].ignore_speak = FALSE;
sprintf(pendl_points[cur].anim, "G\\Anims\\Specials\\s001.stg");// do that animation
//pendl_points[cur].anim_type = 1; // unfinished
pendl_points[cur].wait = 5.0; //wait after anim
pendl_points[cur].leave_script = FALSE;//??
cur++;
}
}
cur-=1;
//return cur;
}
//___________________________________________END OF PENDL POINTS_______________
int define_maintask() {
dword cur;
for (cur=0; cur<MAINTASK_COUNT; cur++) CLEAR(maintask[cur]);
cur = 0;
sprintf(maintask[cur].name, "main_task_vc_#1");
maintask[cur].coop_id = 20;
maintask[cur].flags = SC_P_AI_MAINTASK_FL_DO_VALID_MOVEDIRECTION_TEST | SC_P_AI_MAINTASK_FL_ALLOW_MOVE_TO_NOCOVER | SC_P_AI_MAINTASK_FL_PERMANENT;
maintask[cur].step = 10.0;
maintask[cur].wait = 1.0;
cur++;
/*sprintf(maintask[cur].name, "main_task_vc_#2");
maintask[cur].coop_id = 21;
maintask[cur].flags = SC_P_AI_MAINTASK_FL_DO_VALID_MOVEDIRECTION_TEST | SC_P_AI_MAINTASK_FL_ALLOW_MOVE_TO_NOCOVER | SC_P_AI_MAINTASK_FL_PERMANENT;
maintask[cur].step = 10.0;
maintask[cur].wait = 1.0;
cur++;*/
return cur;
}
dword gphase = 0;
BOOL callback_to_main(s_SC_Pscript_info *info) {
switch(info->message){
//------------------------------------
case SC_PLSCR_MSG_PL_RESPAWNED:
PL_MAINTASK_disable();
break;
case SC_PLSCR_MSG_SCRIPT_TIMETICK:
switch (gphase) {
case 0:
if (uni_gphase == 1) {
MAX_GMP_change_skill(info->player, 0.58);
gphase = 1;
}
break;
case 1:
break;
}
break;
case SC_PLSCR_MSG_AI_MOVEAT_CALLBACK:
break;
}
return TRUE;
}
Use it as simple AI script, except you need to add DUMMY objects to define where AI is walking.
With this file you must use DUMMY object names as "pendl_#0", pendl_#1, pendl_#2,...
If you need second way for other players then you must rename it in script too.
EXAMPLE: rename "pendl_#%d" as "2_pendl_#%d" (%d is for changing object number)
and then line in script is:
#define PENDL_OBJECTS "2_pendl_#%d" //name of dummy objects
now use dummy objects with names as "2_pendl_#0", "2_pendl_#1", "2_pendl_#2",....
You can add up to 20 dummys for one way. If you need more then change "For" loop in script.