I've recently run a few tests to find out what's tanking my FPS like crazy. And I've come to the conclusion that compiled scripts run a lot slower than uncompiled ones. I tested 4 cs scripts against their dll counterparts. I turned the cs scripts into dlls. Running the dlls I got 10 FPS less on average and I have a quite powerful system. I'm currently running quite a few dlls and I've already removed some mods that add features I don't often use. My current FPS are at 40 on average compared to almost constant 60 without mods. I'm running the game on max settings. I've even tested turning all the graphics options to min, the average FPS DID NOT CHANGE!? Just wanted to let you know.
Best posts made by Phnx
-
Uncompiled vs. compiled script performance
-
[Script] The Bird by rappo (My variation based on current release 1.1)
First off, a big thanks to rappo for making this possible!
The main difference to the current version is that I have included two randomly alternating animations and insults.
Enjoy:
using GTA;
using GTA.Native;
using System;
using System.Windows.Forms;namespace GTA5M
{
public class TheBird : Script
{
Keys activationKey;
bool flippingOff = false;
Ped fightingPed;
Blip fightingPedBlip;
Ped fleeingPed;public TheBird() { ScriptSettings localSettings = ScriptSettings.Load(".\\scripts\\TheBird.ini"); Keys activationKeySetting; string activationKeyStr = localSettings.GetValue("Preferences", "ActivationKey", "J"); if (Enum.TryParse(activationKeyStr, out activationKeySetting)) { activationKey = activationKeySetting; } else { activationKey = Keys.J; } KeyDown += OnKeyDown; KeyUp += OnKeyUp; Tick += OnTick; Interval = 100; } void OnKeyDown(object o, KeyEventArgs e) { // User is pressing the activation key if (e.KeyCode == activationKey) { // If not currently fighting a ped and the player is alive and available if (fightingPed == null && !flippingOff && Game.Player.IsAlive && Game.Player.CanStartMission && Game.Player.Character.Weapons.Current.Hash == WeaponHash.Unarmed) { flippingOff = true; // Play middle finger animation // Use a random number generator to alternate animations and speech Random randomNumberGenerated = new Random(); int randomNumber = randomNumberGenerated.Next(3); if (randomNumber == 2) { Function.Call(Hash._PLAY_AMBIENT_SPEECH1, Game.Player.Character, "GENERIC_INSULT_HIGH", "SPEECH_PARAMS_FORCE", 0); Game.Player.Character.Task.PlayAnimation("mp_player_int_upperfinger", "mp_player_int_finger_02", 2, 750, true, 1); Wait(750); Game.Player.Character.Task.PlayAnimation("mp_player_int_upperfinger", "mp_player_int_finger_02_exit", 2, 750, true, 1); } else if (randomNumber == 1) { Function.Call(Hash._PLAY_AMBIENT_SPEECH1, Game.Player.Character, "GENERIC_INSULT_MED", "SPEECH_PARAMS_FORCE", 0); Game.Player.Character.Task.PlayAnimation("anim@mp_player_intselfiethe_bird", "enter", 2, 766, true, 1); Wait(766); Game.Player.Character.Task.PlayAnimation("anim@mp_player_intselfiethe_bird", "idle_a", 2, 1500, true, 1); Wait(1500); } // Is player aiming at ped Entity aimedEntity = Game.Player.GetTargetedEntity(); if (aimedEntity.IsPed()) { // Give them some time to react... Wait(250); Ped aimedPed = (Ped)aimedEntity; // If you're flipping off a cop... if (aimedPed.Type() == PedType.Cop || aimedPed.Type() == PedType.SWAT || aimedPed.Type() == PedType.Army) { // Set wanted level to 1 star if you didn't have any already if (Game.Player.WantedLevel == 0) { Game.Player.WantedLevel = 1; } } else if (!aimedPed.IsFleeing) { // Prep the ped bool pedWillFight = false; aimedPed.Task.ClearAllImmediately(); aimedPed.AlwaysKeepTask = true; // Use a random number generator to decide what to do Random randomNumberGenerated0 = new Random(); // If you're flipping off a man... if (aimedPed.Gender == Gender.Male) { int randomNumber0 = randomNumberGenerated.Next(4); // Give him a golf club if (randomNumber0 == 2) { aimedPed.Weapons.Give(WeaponHash.GolfClub, 1, true, true); } // Give him a switchblade else if (randomNumber0 == 1) { aimedPed.Weapons.Give(WeaponHash.SwitchBlade, 30, true, true); } // Give him a bat else if (randomNumber0 == 0) { aimedPed.Weapons.Give(WeaponHash.Bat, 1, true, true); } pedWillFight = true; } // If you're flipping off a woman... else { int randomNumber0 = randomNumberGenerated0.Next(2); // Make her fight pedWillFight = (randomNumber0 == 2); } // Set the ped to fight you if (pedWillFight) { fightingPed = aimedPed; fightingPed.IsPersistent = true; fightingPed.Task.FightAgainst(Game.Player.Character); Function.Call(Hash._PLAY_AMBIENT_SPEECH1, fightingPed, "GENERIC_INSULT_MED", "SPEECH_PARAMS_FORCE", 0); // Add a blip for the ped to the map fightingPedBlip = fightingPed.AddBlip(); } // Set the ped to flee from you else { fleeingPed = aimedPed; fleeingPed.IsPersistent = true; fleeingPed.Task.FleeFrom(Game.Player.Character); Function.Call(Hash._PLAY_AMBIENT_SPEECH1, aimedPed, "GENERIC_SHOCKED_HIGH", "SPEECH_PARAMS_FORCE", 0); } } } } } } private void OnKeyUp(object o, KeyEventArgs e) { // User released the activation key if (e.KeyCode == activationKey) { flippingOff = false; } } private void OnTick(object o, EventArgs e) { // If a fighting ped is dead or you moved to far away from them if (fightingPed != null && (!Game.Player.IsAlive || !Game.Player.CanStartMission || !fightingPed.IsAlive || !fightingPed.IsNearEntity(Game.Player.Character, new GTA.Math.Vector3(100, 100, 100)))) { // Destroy ped fightingPed.Destroy(); fightingPed = null; // Destroy blip if (fightingPedBlip != null) { fightingPedBlip.Remove(); fightingPedBlip = null; } } // If a fleeing ped is dead or you moved to far away from them if (fleeingPed != null && (!Game.Player.IsAlive || !Game.Player.CanStartMission || !fleeingPed.IsAlive || !fleeingPed.IsNearEntity(Game.Player.Character, new GTA.Math.Vector3(100, 100, 100)))) { // Destroy ped fleeingPed.Destroy(); fleeingPed = null; } } }
}
-
RE: [Info] Game treating a ped as a player character?
^ I got news for you.
-
RE: [SCRIPT] Middle finger on foot?
@rappo Wow, thanks for the help! Actually, what I meant was "middle finger in a vehicle/on a bike" (aiming unarmed), meaning not only the animation but also forcing the ped reaction (provocation).
-
[Info] Game treating a ped as a player character?
First off, this is a memory hack. I cannot possibly foresee how it could affect the game. So far it has worked for me without issues.
http://gtaforums.com/topic/854400-play-story-mode-as-a-ped/
Yesterday I stumbled upon that thread.
Basically what says is:
- Get Cheat Engine and open GTA5.exe.
- Get your ped hash, list here -> http://lexicongta.com/res/npcs.txt .
- Scan for it (hex, 8 bytes, exact value) and look for an address that begins with 14XXXXXX. Unless that address has changed due to the recent update it should be the correct one.
- Change the ped hash to one of the protagonists' ones.
The game uses internal names:
mp_m_freemode_01 = Freemode Male - hash = 705E61F2
mp_f_freemode_01 = Freemode Female - hash = 9C9EFFD8
player_zero = Michael - hash = D7114C9
player_one= Franklin - hash = 9B22DBAF
player_two = Trevor - hash = 9B810FA2The game now thinks you're one of the protagonists. Freemode character clothes can be "bugged" but they are fixable. Your character will have its own idle animations but either F's, M's or T's idle variations.
Ever since I've finished the story mode I've been enjoying playing the game with a customized freemode character in SP. There are some limitations though. The game treats the character as a ped similar to director mode. That means the "ped" has no money and cannot use stores, LS Customs etc. Also, I always assign a voice to the character and they almost behave like one of the three protagonists (e.g. cussing when their car gets hit) with a few exceptions. When bumping into someone or being blocked they do not react. It would also be nice if they reacted to getting jacked and jacking back their last owned car. Is there any way using natives to override/add this?
-
RE: Dilapidated gameconfig.xml
@Dilapidated That file is still encrypted but it would give us a lot of control over what peds could do, such as use stealth.
-
Illuminated clothing?
Hey. I haven't checked GTA Online in a while and just noticed there are options for the illuminated clothing: "off", "pulse" and "flash". Is there any way we could control that through scripting?
-
Director Mode watermark?
Hi. Does anyone know how to remove it?