Jump to content

Sqwince

Member
  • Content Count

    8
  • Joined

  • Last visited

  • Medals

Community Reputation

1 Neutral

About Sqwince

  • Rank
    Private

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Sqwince

    Really really simple feature request

    if you hit Shift+ESC it doesn't dump you out of the simulation and acts as an "Ingame ESC". Trick is remembering to hit shift.
  2. I found that I missed setting the AIent.SetFlags(EntityFlags.ACTIVE, false); now I get score when I kill the AI with a headshot (1shot & 1kill). A one shot heart damage/kill doesn't register with the scoring system though. Very strange. Seems to only trigger if it's a headshot only hit/kill. This is the AI Hostile Spawn script I'm using: //------------------------------------------------------------------------------------------------ /*! \brief Spawns the given resource @return SCR_AIGroup of entity spawned. */ IEntity SpawnHostileAI() { //Spawn AI (Credit: HunterKiller) EntitySpawnParams params = EntitySpawnParams(); bool foundpos = GetSpawnPointForAI(params); string hostilePreFab = GetHostileToSpawn(); Resource resource = Resource.Load(hostilePreFab); //SCR_AIGroup group = SCR_AIGroup.Cast(GetGame().SpawnEntityPrefab(resource, GetGame().GetWorld(), params)); IEntity hostile = IEntity.Cast(GetGame().SpawnEntityPrefab(resource, GetGame().GetWorld(), params)); if (!hostile) { Print("[SpawnHostileAI] Unable to spawn hostile!", LogLevel.ERROR); return null; } // Manage the life cycle for the spawned group GetGame().GetCallqueue().CallLater(ManageHostileLifeCycle, 1000, false, hostile); return hostile; //SetEventMask(EntityEvent.FRAME); hostile.SetFlags(EntityFlags.ACTIVE, false); //Adding this line allowed for headshot kills to register. Damaged to death AI still does not register though. } Here is what I did to the scoring system component: //------------------------------------------------------------------------------------------------ /*! Handle and dispatch scoring logic for this event. */ protected override void OnControllableDestroyed(IEntity entity, IEntity instigator) { super.OnControllableDestroyed(entity, instigator); Print("AI Destroyed!"); //debug int killerId = GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(instigator); //check if ID is a player: array<int> allPlayers = {}; int count = GetGame().GetPlayerManager().GetAllPlayers(allPlayers); if(allPlayers.Contains(killerId)) { super.AddKill(killerId); }
  3. can you post your code of the 1 script here that we could look at? might be able to spot something that the debugger isn't picking up.
  4. I have run into this issue where it loses the reference to the custom class and doesn't highlight properly. It seemed to me like it was part of a syntax error. if you have multiple declarations of the same class it will do this (Check your constructor area), as well as simple stuff like missing ";" will cause it all to crumble apart. you'll have to manually find the issue and resolve, then it all clears up and starts working again.
  5. Thanks for the link. I've read through that a number of times, but my biggest issue is that the game doesn't "SEE" killing a spawned AI entity as a player therfore it doesn't trigger any of the scoring. I tried using the following method in the SCR_BaseGameModeComponent. WHen I kill the AI it definitely triggers this method, but the two params are not set properly. The entity is the AI I kill, but the instigator registers as "NULL" so i can't really do anything with that. it seems broken to me. void OnControllableDestroyed(IEntity entity, IEntity instigator)
  6. I'm working on a script based gamemode and I have worked out how to spawn a prefab entity using this code. IEntity hostile = IEntity.Cast(GetGame().SpawnEntityPrefab(resource, GetGame().GetWorld(), params)); I also have a HUD that will show a total score for the player. I'm trying to collect the current score of the player using this code: m_iKillPoints = m_pScoringSystem.GetPlayerScore(m_iAffiliatedPlayerID); It appears the scoring system is not tracking AI kills. I also tried committing suicide and the score isn't affected either. I'm not quite sure how to invoke the scoring system properly. are there any pointers out there on how to track AI kills for score? eventually I would like to use the "killpoints" as a form of currency. I'm not sure the SCR_ScoringSystemComponent will do what I need, or if I need to rewrite an entire scoring system or not. I have no idea how to set an event handler to the AI entity I spawned similar to Arma3 OnKilled.
  7. For anyone who also runs into this, I think I figured it out. When dealing with Objects in the map have to use "ref" in the type def in the map. protected ref map<int, ref MyClass> myMap = new ref map<int, ref MyClass>;
  8. Trying to figure out why I keep getting NULL pointer references when working with the map<int,object>.get(int). From the debugger it looks like I am properly setting the key as int = 1. The value is an object reference. When I use map.get(1) it returns NULL. Any tips or suggestions? Is this implementation valid? Ot should I just work with arrays instead? Final array would just be the same size as number of players.
×