AbyssMorgan, im pretty sure its already possible with these include but i just cant see it and i suck at math.
If i have actor, and i would like to implement SIGHT for him for example lets say 90 degree and 100 units far. How would i make it? When i say SIGHT i mean detect element that he can "see" by using his facing angle. |
new Float:x,Float:y,Float:z,Float:z_angle;
GetActorPos(actorid,x,y,z);
GetActorFacingAngle(actorid,z_angle);
if(IsElementOnFakeScreen(x,y,z,playerid,item_player,0.0,z_angle)){
//actor see player
}
GetRandomPointOnSphere
GetRandomPointInCircle
FCNPC_RandomMoveInDynamicArea
FCNPC_RandomMoveInStream
GetNPCSpeed
FCNPC_RandomMoveInStream(npcid,Stream:StreamData[Stream3D],Float:climbing = 2.0,type = MOVE_TYPE_AUTO,Float:speed = MOVE_SPEED_AUTO,bool:UseMapAndreas = false,bool:setangle = true,Float:dist_offset = 0.0,stopdelay = 250); FCNPC_RandomMoveInDynamicArea(npcid,STREAMER_TAG_AREA areaid,Float:climbing = 2.0,type = MOVE_TYPE_AUTO,Float:speed = MOVE_SPEED_AUTO,bool:UseMapAndreas = false,bool:setangle = true,Float:dist_offset = 0.0,stopdelay = 250); FCNPC_GoToPlayerOnGroundCol(npcid,playerid,type = MOVE_TYPE_AUTO,Float:speed = MOVE_SPEED_AUTO,bool:UseMapAndreas = false,Float:cut_size = 1.0,Float:climbing = 2.0,bool:setangle = true,Float:dist_offset = 0.0,stopdelay = 250); FCNPC_GoToAir(npcid,Float:x,Float:y,Float:z,type = MOVE_TYPE_AUTO,Float:speed = MOVE_SPEED_AUTO,Float:dist_offset = 0.0,stopdelay = 250); FCNPC_GoToAirCol(npcid,Float:x,Float:y,Float:z,type = MOVE_TYPE_AUTO,Float:speed = MOVE_SPEED_AUTO,Float:cut_size = 0.0,Float:dist_offset = 0.0,stopdelay = 250); FCNPC_GoToCol(npcid,Float:x,Float:y,Float:z,type = MOVE_TYPE_AUTO,Float:speed = MOVE_SPEED_AUTO,bool:UseMapAndreas = false,Float:cut_size = 0.0,bool:setangle = true,Float:dist_offset = 0.0,stopdelay = 250); FCNPC_GoToPlayerCol(npcid,playerid,type = MOVE_TYPE_AUTO,Float:speed = MOVE_SPEED_AUTO,bool:UseMapAndreas = false,Float:cut_size = 0.0,bool:setangle = true,Float:dist_offset = 0.0,stopdelay = 250);
GenerateGangZone(Float:x,Float:y,Float:radius,&Float:minx,&Float:miny,&Float:maxx,&Float:maxy);
ENABLE_3D_TRYG_YSI_SUPPORT //Use before 3DTryg.inc for enable YSI Support (use only when 3DTryg say error for this)
GetInvalidElementID(Item3D_Type:item_type);
GetVehicleDefaultFlagsByModel(modelid);
SetVehicleFlagsByModel(modelid,value);
ToggleVehicleModelFlag(modelid,flag,bool:toggle);
Tryg3D::GivePlayerDamage - call to all scripts: OnPlayerGiveDamage and OnPlayerTakeDamage
OnColAndreasRemoveBuilding - call to all scripts
Tryg3D::GivePlayerDamage
SetVehicleSpeed(vehicleid,Float:speed);
Float:GetCameraTargetDistance(Float:CamX,Float:CamY,Float:CamZ,Float:ObjX,Float:ObjY,Float:ObjZ,Float:FrX,Float:FrY,Float:FrZ);
IsPlayerAimingAt(playerid,Float:x,Float:y,Float:z,Float:radius);
//Explosion Damage Control support players/vehicles
//Player: Take/Give damage by weaponid 51, bodypart 3
//This function set player health to 765.0 before using explosion
CreateDynamicExplosionDMG(Float:x,Float:y,Float:z,type,Float:radius,worldid = -1,interiorid = -1,playerid = -1,Float:distance = 200.0,Float:damage=82.5,Float:vehicle_damage=82.5,byplayerid=INVALID_PLAYER_ID);
SendFakeDamageInRadius(weaponid,bodypart,Float:damage,Float:vehicle_damage,Float:x,Float:y,Float:z,Float:radius,worldid = -1,interiorid = -1,playerid = -1,byplayerid=INVALID_PLAYER_ID);
IPL_CreateObject(modelid,Float:x,Float:y,Float:z,Float:qx,Float:qy,Float:qz,Float:qw,Float:drawdistance=0.0);
IPL_CreateDynamicObject(modelid,Float:x,Float:y,Float:z,Float:qx,Float:qy,Float:qz,Float:qw,worldid=-1,interiorid=-1,playerid=-1,Float:streamdistance=STREAMER_OBJECT_SD,Float:drawdistance=STREAMER_OBJECT_DD,STREAMER_TAG_AREA areaid=STREAMER_TAG_AREA -1,priority=0);
714, veg_bevtree2, 0, 2007.609375, -1556.65625, 12.59375, 0, 0, -0.7398733497, 0.6727461815, -1 IPL_CreateDynamicObject(714, 2007.609375, -1556.65625, 12.59375, 0, 0, -0.7398733497, 0.6727461815);
#define ipl_extract_params(%1,%2,%3,%4,%5,%6,%7,%8) %1,%2,%3,%4,%5,%6,%7
#define ipl_decode(%0,%1,%2,%3) %0,ipl_extract_params(%3)
IPL_CreateDynamicObject(ipl_decode(714, veg_bevtree2, 0, 2007.609375, -1556.65625, 12.59375, 0, 0, -0.7398733497, 0.6727461815, -1));
Hunting.inc
Mines.inc
Missile.inc
VehicleMissileCol.inc
Tryg3D::InitVehicleCollision(); //Init VehicleCollision System
Tryg3D::ExitVehicleCollision();
Tryg3D::SyncVehicleCollision(vehicleid);
//force resync vehicle collision (call after new vehicle created or use OnVehicleCreated from EVF.inc)
//only if VehicleCollision is inited
//Collision detection
MovePointColWithVehicle(Float:StartX,Float:StartY,Float:StartZ,Float:EndX,Float:EndY,Float:EndZ,&Float:x,&Float:y,&Float:z);
//Detection type: Cube3D
//Return position type: Sphere
//Return value: vehicleid or INVALID_VEHICLE_ID
DISABLE_3D_TRYG_VEHICLECOL
//check wall or vehicle collision
IsBetweenElementToPointIsVeh(Float:x,Float:y,Float:z,TRYG3D_ELEMENT_TAG targetid,Item3D_Type:target_type);
IsBetweenElementsIsVeh(TRYG3D_ELEMENT_TAG elementid,Item3D_Type:element_type,TRYG3D_ELEMENT_TAG targetid,Item3D_Type:target_type);
MovePointColWithVehicleCut(Float:StartX,Float:StartY,Float:StartZ,Float:EndX,Float:EndY,Float:EndZ,&Float:x,&Float:y,&Float:z,Float:cut_size=0.0);
IsPointInSphericalSectorEx(Float:px,Float:py,Float:pz,Float:x,Float:y,Float:z,Float:rx,Float:rz,Float:radius,Float:vrx,Float:vrz,bool:testLOS=true,bool:veh_col=false); IsElementOnPlayerScreen(playerid,targetid,Item3D_Type:target_type=item_player,element_orientation:orientation=o_front,Float:rx=INVALID_ROTATION,Float:rz=INVALID_ROTATION,Float:vrx=VERTICAL_CAMERA_RADIUS,Float:vrz=HORIZONTAL_CAMERA_RADIUS,bool:testLOS=true,bool:testVW=true,bool:veh_col=false); IsElementOnFakeScreen(Float:x,Float:y,Float:z,targetid,Item3D_Type:target_type,Float:rx,Float:rz,Float:vrx=VERTICAL_CAMERA_RADIUS,Float:vrz=HORIZONTAL_CAMERA_RADIUS,bool:testLOS=true,bool:veh_col=false); IsPlayerInRangeOfElement(playerid,Float:range,targetid,Item3D_Type:target_type=item_player,bool:testLOS=true,bool:veh_col=false); IsElementInRangeOfPoint(Float:x,Float:y,Float:z,Float:range,targetid,Item3D_Type:target_type=item_player,bool:testLOS=true,bool:veh_col=false); IsElementInRangeOfElement(elementid,Item3D_Type:element_type,Float:range,targetid,Item3D_Type:target_type=item_player,bool:testLOS=true,bool:veh_col=false);
if(x == 0.0) x = EndX; if(y == 0.0) y = EndY; if(z == 0.0) z = EndZ;
if(x > -0.0001 && x < 0.0001) x = EndX;
I would just like to mention I noticed something off.
Код:
if(x == 0.0) x = EndX; if(y == 0.0) y = EndY; if(z == 0.0) z = EndZ; You should always use less than/greater than operators when using floats never the equal to operator. Код:
if(x > -0.0001 && x < 0.0001) x = EndX; |
I would just like to mention I noticed something off.
Код:
if(x == 0.0) x = EndX; if(y == 0.0) y = EndY; if(z == 0.0) z = EndZ; You should always use less than/greater than operators when using floats never the equal to operator. Код:
if(x > -0.0001 && x < 0.0001) x = EndX; |
Tryg3D::Function:: MovePointCol(Float:StartX,Float:StartY,Float:StartZ,Float:EndX,Float:EndY,Float:EndZ,&Float:x,&Float:y,&Float:z){
x = y = z = 0.0; //reset vars for RayCastLine and ignore old values
ColAndreas::RayCastLine(StartX,StartY,StartZ,EndX,EndY,EndZ,x,y,z); //save collision if exist in x,y,z
if(x == 0.0) x = EndX; //collision not exist set End value
if(y == 0.0) y = EndY;
if(z == 0.0) z = EndZ;
}
I would just like to mention I noticed something off.
Код:
if(x == 0.0) x = EndX; if(y == 0.0) y = EndY; if(z == 0.0) z = EndZ; You should always use less than/greater than operators when using floats never the equal to operator. Код:
if(x > -0.0001 && x < 0.0001) x = EndX; |
FCNPC::SetFloorPos(npcid); //fix z for current floor
IsElementInDynamicArea(TRYG3D_ELEMENT_TAG elementid,Item3D_Type:element_type,STREAMER_TAG_AREA areaid);
GetElementsInDynamicArea(STREAMER_TAG_AREA areaid,Item3D_Type:element_type,element_list[],max_element=sizeof(element_list));
ConvertMTARaceRotation(Float:rotation1,Float:rotation2,Float:rotation3,&Float:rx,&Float:ry,&Float:rz);
ConvertToMTARaceRotation(Float:rx,Float:ry,Float:rz,&Float:rotation1,&Float:rotation2,&Float:rotation3);
IsNPCInRangeOfPoint -> FCNPC::InRangeOfPoint
GetNPCTargetAngle -> FCNPC::GetTargetAngle
SetNPCTargetAngle -> FCNPC::SetTargetAngle
GetNPCSpeed -> FCNPC::GetSpeed
GetPointInFrontOfNPC -> FCNPC::GetPointInFront
GetPointInFrontOfNPCCol -> FCNPC::GetPointInFrontCol
SetNPCAbsolutePosition -> FCNPC::SetAbsolutePosition
IsMapAndreasInit -> Tryg3D::IsMapAndreasInit
SafeMapAndreasInit -> Tryg3D::SafeMapAndreasInit
IsColAndreasInit -> Tryg3D::IsColAndreasInit
SafeColAndreasInit -> Tryg3D::SafeColAndreasInit
Bud, its time you break your code into parts. So many functions in one file, where you could make classes. Like if i only needed area check functions so i would just need to download the area file say try3d_area.inc.
|