NomadDarmadeus Posted April 17, 2010 Author Share Posted April 17, 2010 I took this code out from SCC and this are the codes that I want. Is this code COMPLETE?And I have another bloody problem. I can't create scripts. EDIT: I can now make scripts using "fose_launcher.exe -editor" scn 000USMCScript ref npc ref dummy ref self short wassneaking short weaponout BEGIN onadd set npc to getcontainer npc.setignorefriendlyhits 999 ;=========== ;Mimic Player ;=========== if(npc.getinfaction 00USMC == 1) if(player.issneaking==1 && wassneaking == 0) npc.setforcesneak 1 set wassneaking to 1 printtoconsole "Started Sneaking" elseif(player.issneaking==0 && wassneaking == 1) npc.setforcesneak 0 set wassneaking to 0 printtoconsole "Stopped Sneaking" endif if(player.isweaponout==1 && weaponout==0) npc.setalert 1 set weaponout to 1 printtoconsole "Weapon Out" elseif(player.isweaponout==0 && weaponout == 1) npc.setalert 0 set weaponout to 0 printtoconsole "Weapon Away" endif endif ;=============== ;End Mimic Player ;=============== ;======= ;Teleport ;======= if(self.GetDistance player>5000) self.moveto player printtoconsole "SCC: %n too far. Moving to player." self endif ;=========== ;End Teleport ;=========== end EDIT 2: Doesn't seem to be working :(I am aware that the system that SCC or CSR uses is very complicated. For example dialogue boxes items will add "tokens" into the NPCs inventory. These tokens are bound to a script. (e.g. follow script, wait script, etc) But I don't think my mod needs to be that complicated, all I think (though I'm not sure which is why i really need expert advice) I need is to have the NPC run a script 24/7 which tells him to "teleport to player" and "Mimic Player". EDIT 3: RICKERHK HOW DO I ADD YOUR SCRIPT TO MY MOD? Link to comment Share on other sites More sharing options...
NomadDarmadeus Posted April 17, 2010 Author Share Posted April 17, 2010 GUYS, DON'T TROUBLE YOURSELF.The problem regarding the sneak and weapons up/holstered solved. What I did:#1) Use this CORRECTED code scn 000USMCScript ref npc ref dummy ref self short wassneaking short weaponout short respons short assis short aggres short conf short removal short alerted begin GameMode set npc to getcontainer npc.setignorefriendlyhits 999 npc.AddtoFaction 00USMC 1 npc.setfactionrank PlayerFaction 1 ;=========== ;Mimic Player ;=========== if(npc.getinfaction 00USMC == 1) if(player.issneaking==1 && wassneaking == 0) npc.setforcesneak 1 set wassneaking to 1 printtoconsole "Started Sneaking" elseif(player.issneaking==0 && wassneaking == 1) npc.setforcesneak 0 set wassneaking to 0 printtoconsole "Stopped Sneaking" endif if(player.isweaponout==1 && weaponout==0) npc.setalert 1 set weaponout to 1 printtoconsole "Weapon Out" elseif(player.isweaponout==0 && weaponout == 1) npc.setalert 0 set weaponout to 0 printtoconsole "Weapon Away" endif endif ;=============== ;End Mimic Player ;=============== ;======= ;Teleport ;======= if(self.GetDistance player>5000) self.moveto player printtoconsole "SCC: %n too far. Moving to player." self endif ;=========== ;End Teleport ;=========== end#2) Add this script to each NPC #3) Created an "armor" item have script above attached to it. Then give each NPC this "armor item" Issues:1) When I crouch/holster ALL 17 NPCs will Crouch/holster (LOL)2) Only problem left is that NPCs sometimes stop following you after combat. I'm gonna release this as v1.2 Link to comment Share on other sites More sharing options...
NomadDarmadeus Posted April 21, 2010 Author Share Posted April 21, 2010 RICKERHK! There seems to be a problem with your script. I cant seem to be able to save it as a script. it says nested blocks. Am i doing something wrongly? Link to comment Share on other sites More sharing options...
rickerhk Posted April 21, 2010 Share Posted April 21, 2010 RICKERHK! There seems to be a problem with your script. I cant seem to be able to save it as a script. it says nested blocks. Am i doing something wrongly? you can only nest nine if/endif blocks if something1 if something2 if something3 .. etc up to nine times endif endif endif Link to comment Share on other sites More sharing options...
NomadDarmadeus Posted April 22, 2010 Author Share Posted April 22, 2010 Line 77: Nested being/endblocks are not allowedIts referring to the "BEGIN OnCombatEND" Line.How do i use your AI Script and get it to save? scn 000USMCScript ref npc ref dummy ref self ref FTLTargetREF short wassneaking short weaponout short iTargetSet begin GameMode set npc to getcontainer npc.setignorefriendlyhits 999 npc.AddtoFaction 00USMC 1 npc.setfactionrank PlayerFaction 1 ;=========== ;Mimic Player ;=========== if(npc.getinfaction 00USMC == 1) if(player.issneaking==1 && wassneaking == 0) npc.setforcesneak 1 set wassneaking to 1 printtoconsole "Started Sneaking" elseif(player.issneaking==0 && wassneaking == 1) npc.setforcesneak 0 set wassneaking to 0 printtoconsole "Stopped Sneaking" endif if(player.isweaponout==1 && weaponout==0) npc.setalert 1 set weaponout to 1 printtoconsole "Weapon Out" elseif(player.isweaponout==0 && weaponout == 1) npc.setalert 0 set weaponout to 0 printtoconsole "Weapon Away" endif endif ;=============== ;End Mimic Player ;=============== ;======= ;Teleport ;======= if(self.GetDistance player>5000) self.moveto player printtoconsole "SCC: %n too far. Moving to player." self endif ;=========== ;End Teleport ;=========== ;========== ;RickerHK AI ;========== if (IsInCombat == 1 || FTLNPCREF.IsInCombat == 1); FTLNPCREF is the leader NPC reference if (iTargetSet == 0) if (FTLNPCREF.GetCombatTarget) ;Does Leader have a target? if (GetCombatTarget == 0) ;Do I not have a target? set FTLTargetREF to FTLNPCREF.GetCombatTarget if (FTLTargetREF) if (FTLTargetREF.GetDead == 0) StartCombat FTLTargetREF ;Attack the Leader's target if not busy with my own set iTargetSet to 1 ;Do this just once per combat cycle! endif endif endif endif endif endif BEGIN OnCombatEND <<<=== Line 77: Nested being/endblocks are not allowed set iTargetSet to 0 ;============== ;End RickerHK AI ;============== end Link to comment Share on other sites More sharing options...
rickerhk Posted April 22, 2010 Share Posted April 22, 2010 Line 77: Nested being/endblocks are not allowedIts referring to the "BEGIN OnCombatEND" Line.How do i use your AI Script and get it to save? You need to put an 'END' command right above that line. Every BEGIN command needs to have an END command to go with it. You dont have an END command for the 'BEGIN Gamemode' block Link to comment Share on other sites More sharing options...
NomadDarmadeus Posted April 24, 2010 Author Share Posted April 24, 2010 Now I'm getting this problem:SCRIPTS: Script '000USMCScript', Line 91:Unknown referenced object 'FTLNPCREF'. Line 91 is the last line of the script by the way.and I'm guessing that FTLNPCREF is referring to the whole chunk of codes you provided.Am I missing certain 'ref xxxxx' or 'short xxxxx'? scn 000USMCScript ref npc ref dummy ref self ref FTLTargetREF short wassneaking short weaponout short iTargetSet short respons short assis short aggres short conf short removal short alerted begin GameMode set npc to getcontainer npc.setignorefriendlyhits 999 npc.AddtoFaction 00USMC 1 npc.setfactionrank PlayerFaction 1 ;=========== ;Mimic Player ;=========== if(npc.getinfaction 00USMC == 1) if(player.issneaking==1 && wassneaking == 0) npc.setforcesneak 1 set wassneaking to 1 printtoconsole "Started Sneaking" elseif(player.issneaking==0 && wassneaking == 1) npc.setforcesneak 0 set wassneaking to 0 printtoconsole "Stopped Sneaking" endif if(player.isweaponout==1 && weaponout==0) npc.setalert 1 set weaponout to 1 printtoconsole "Weapon Out" elseif(player.isweaponout==0 && weaponout == 1) npc.setalert 0 set weaponout to 0 printtoconsole "Weapon Away" endif endif ;=============== ;End Mimic Player ;=============== ;======= ;Teleport ;======= if(self.GetDistance player>5000) self.moveto player printtoconsole "SCC: %n too far. Moving to player." self endif ;=========== ;End Teleport ;=========== ;========== ;RickerHK AI ;========== if (IsInCombat == 1 || FTLNPCREF.IsInCombat == 1); FTLNPCREF is the leader NPC reference if (iTargetSet == 0) if (FTLNPCREF.GetCombatTarget) ;Does Leader have a target? if (GetCombatTarget == 0) ;Do I not have a target? set FTLTargetREF to FTLNPCREF.GetCombatTarget if (FTLTargetREF) if (FTLTargetREF.GetDead == 0) StartCombat FTLTargetREF ;Attack the Leader's target if not busy with my own set iTargetSet to 1 ;Do this just once per combat cycle! endif endif endif endif endif endif end BEGIN OnCombatEND set iTargetSet to 0 ;============== ;End RickerHK AI ;============== end Link to comment Share on other sites More sharing options...
rickerhk Posted April 24, 2010 Share Posted April 24, 2010 Now I'm getting this problem:SCRIPTS: Script '000USMCScript', Line 91:Unknown referenced object 'FTLNPCREF'. Line 91 is the last line of the script by the way.and I'm guessing that FTLNPCREF is referring to the whole chunk of codes you provided.Am I missing certain 'ref xxxxx' or 'short xxxxx'?;========== if (IsInCombat == 1 || FTLNPCREF.IsInCombat == 1); FTLNPCREF is the leader NPC reference FTLNPCREF is an example - you have to replace it with the persistent reference you gave the NPC when you placed it in the editor. If you didn't set a Reference, go to the cell where you placed the NPC, right click on the NPC and click 'edit' . The top space is where you give your NPC a Reference ID or 'name' that you use in scripts. Link to comment Share on other sites More sharing options...
NomadDarmadeus Posted April 24, 2010 Author Share Posted April 24, 2010 Okay since I have 4 Fire Team Leaders, I'll have to have 4x of the codes you provided with FTLNPCREF changed to the 4 different FTLs? Link to comment Share on other sites More sharing options...
rickerhk Posted April 27, 2010 Share Posted April 27, 2010 Okay since I have 4 Fire Team Leaders, I'll have to have 4x of the codes you provided with FTLNPCREF changed to the 4 different FTLs? Yes Link to comment Share on other sites More sharing options...
Recommended Posts