Springheel 4630 Posted June 4, 2012 Report Share Posted June 4, 2012 I know this topic has come up on wishlists from time to time, and I know some mappers have managed to cobble together versions for their maps. Couldn't figure out what term to search for, however, so I couldn't find any details. How hard is it, currently, to make the AI in a location neutral to the player, and then change that relationship if the player does something aggressive? I'm working on a map that has a public area that the player should theoretically be able to explore without being challenged. But I want him to be considered an enemy if he does either of the following: -- takes any loot-- passes into one of three trigger areas Since the player won't have any of his equipment, attacking or picking locks isn't an issue. Anyone with experience with this, can you give me some insight into how difficult it is to do, and maybe point me towards some thread or wiki post with info on how to do it? Quote TDM Missions: A Score to Settle * A Reputation to Uphold * A New Job * A Matter of Hours Video Series: Springheel's Modules * Speedbuild Challenge * New Mappers Workshop * Building Traps Link to post Share on other sites
Bikerdude 3740 Posted June 4, 2012 Report Share Posted June 4, 2012 I would also like to know how to do this! Quote Link to post Share on other sites
RPGista 603 Posted June 4, 2012 Report Share Posted June 4, 2012 (edited) Well, Im sure some guys who actually know what they are talking about will answer soon, but one possibility which I used in my own map was the set relations entity (http://wiki.thedarkm...s_%28Editing%29): a ) Neutral NPCs would change to a hostile team if you unlocked (triggered) a certain door next to them (would work the same if you trigger it from a simple or timed trigger); b ) I also wanted certain characters, when fleeing, to actually alert those same neutral NPCs and send them your way (they are friends inside the story, but from different teams); so they also activate the set relations entity when they pass through a trigger (knowing where they had to pass through when fleeing outside), making the NPCs friendly to them (automaticly behaving as allies from then on, answering to the call, etc). It was pretty limited, I remember Sotha (and possibly Fieldmedic) discussing a much broader and complex way to set this up... PS: In this situation, the sound responses will be often highly inconsistent (they'll shout things like "Aha! There you are!" and such inconvinient barks when you suddenly become "visible" to them). Edited June 4, 2012 by RPGista Quote Link to post Share on other sites
nbohr1more 2096 Posted June 4, 2012 Report Share Posted June 4, 2012 (edited) Yes, you might find some detail in the Reap as you Sow WIP thread (if there was one)... or the map itself... I'll see what I can find... Edit: Argh. It must be buried in the Newbie DR thread... Plus some of it might be lost in the Beta testing forumthat was deleted Edited June 4, 2012 by nbohr1more Quote Please visit TDM's IndieDB site and help promote the mod: http://www.indiedb.com/mods/the-dark-mod (Yeah, shameless promotion... but traffic is traffic folks...) Link to post Share on other sites
Fieldmedic 151 Posted June 5, 2012 Report Share Posted June 5, 2012 (edited) I'm here to help if you want, Springs! Both of your situations are used in Reap I used scripts and trigger multi-boxes void AIhostile() // CALLED FROM A TRIGGER THAT WILL REVERT AI TO HOSTILE{ unauthorized = 1; // TENSION BECAUSE OF MOVING INTO UNAUTHORIZED AREA if (blown == 0 && curse == 0) // CHECKS IF THE PLAYER'S COVER IS BLOWN OR CURSE IS ACTIVE { $AIHostile.activate($player1); // ACTIVATES THE ENTITY THAT CHANGE TEAM BEHAVIOUR TO HOSTILE if (tension_level == 0) { $player1.callGui(gauge, "high"); sys.print("\nTension is risen because of moving into unauthorized area!\n"); tension_level = 1; } } } // IF PLAYER HAS PICKPOCKETED OR COVER IS BLOWN, THIS SCRIPT WILL BE SKIPPED void AIfriendly() // CALLED FROM A TRIGGER THAT WILL REVERT AI TO FRIENDLY{ if (unauthorized == 1) { sys.wait(2); // PAUSE TO KEEP TENSION FOR 2 SECONDS } if (blown == 0 && unauthorized == 1 && theft == 0 && corpses == 0 && curse == 0) { $AIFriend.activate($player1); // ACTIVATES THE ENTITY THAT CHANGE TEAM BEHAVIOUR TO FRIENDLY if (tension_level == 1) { $player1.callGui(gauge, "low"); sys.print("\nTension is low again\n"); tension_level = 0; } unauthorized = 0; }} Put one trigger box INSIDE the area and call AIhostilePut one trigger box OUTSIDE the area and call AIfriendly This is the script that will run when the player frobs loot (spawnarg 'frob_action_script' and script name, in my case PickpocketMakeHostile) void PickpocketMakeHostile(){sys.wait(3); // PAUSE TO KEEP TENSION FOR 3 SECONDS $AIHostile.activate($player1); // ACTIVATES THE ENTITY THAT CHANGE TEAM BEHAVIOUR TO HOSTILE theft = 1; // GIVE SWITCH SO HOSTILE-->FRIENLDLY TRIGGERS DON'T WORK FOR 3 SECONDS if (blown == 0) { if (tension_level == 0) { $player1.callGui(gauge, "high"); sys.print("\nTension has risen due to theft!\n"); tension_level = 1; } } sys.wait(3); // KEEP TENSION FOR 3 SECONDS if (blown == 0) // CHECKING IF THE PLAYER HAS BEEN SPOTTED { if (tension_level == 1) { $AIFriend.activate($player1); // ACTIVATES THE ENTITY THAT CHANGE TEAM BEHAVIOUR TO FRIENDLY $player1.callGui(gauge, "low"); sys.print("\nTension is low!\n"); tension_level = 0; } } theft = 0; } 'AIHostile' and 'AIFriend' are atdm:target_setrelations enities Note that I had to use switches (theft) to distinguish the cause for the alert rise; Without it, I could steal all I would IF I was standing in a trigger box outside a restriced area as this triggers the script that will make the AI friendly... Hope that helps a bit, feel free to ask questions! Note that some of the scripts are related to the tension meter gui which isn't really neccessary for the thing to work, but if it's not perfectly obvious that the area is restricted, it's nice to see that the tension has risen... Edited June 5, 2012 by Fieldmedic Quote Link to post Share on other sites
Springheel 4630 Posted June 5, 2012 Author Report Share Posted June 5, 2012 Ok, thanks. I don't know much about scripts so it will take me some time to digest this... Quote TDM Missions: A Score to Settle * A Reputation to Uphold * A New Job * A Matter of Hours Video Series: Springheel's Modules * Speedbuild Challenge * New Mappers Workshop * Building Traps Link to post Share on other sites
Fieldmedic 151 Posted June 5, 2012 Report Share Posted June 5, 2012 The basics in the script is quite easy, but as one add more factors it's getting more complicated... The flow is like this:Player frobs lootThe loot calls a scriptThe script activates an entity that changes the relations so that the AI is HOSTILE to the playerThen a timer is started and when that is up, the script calls an entity to change the relations back to FRIENDLYThis means that the tension will be high (anyone sees you during these seconds assaults you)But then it goes back to normalUNLESSYou are seen; then you must make it impossible to go back to normal. Or else the guard will charge you and stop when the timer runs out. Quote Link to post Share on other sites
Springheel 4630 Posted June 5, 2012 Author Report Share Posted June 5, 2012 Ah, so it only makes them agressive if they see you within X seconds? That's quite cool. Quote TDM Missions: A Score to Settle * A Reputation to Uphold * A New Job * A Matter of Hours Video Series: Springheel's Modules * Speedbuild Challenge * New Mappers Workshop * Building Traps Link to post Share on other sites
Fieldmedic 151 Posted June 5, 2012 Report Share Posted June 5, 2012 Correct. Great to use on pickpocketable stuff. Quote Link to post Share on other sites
Mortem Desino 66 Posted June 6, 2012 Report Share Posted June 6, 2012 I worked on something like this for NHAT 2/3. I documented it best I could in the map script file, so I'll post a snippit here. void crime_watch_entity(string name) { /**************************************************************************** * * This is the AI relations script for NHAT 2/3: A Night Out on the Town. * * General guards, like the citywatch, all are all set to team 2: citywatch. * a atdm:team_relations entity changes their regular relation to the player * to neutral ("rel 2,0" "0"). * * They are still neutral to builders and other commoners etc (team 5) * seen on the streets. The only significant difference between them and the * commoners is that they are allied to builders (assaulting a builder will * get you busted) and it is not against objectives to kill these guys. * * When the script is run, AI check to see if they've "seen any evidence" of * crime, such as corpses, stolen goods, weapons (including arrows that the * player may have shot). * * If they've seen any evidence (or have generally been pissed off) they'll * alert any nearby buddies (citywatch, commoners, beggars). * * The AI and his buddies will check to see if the player is in sight. * If he can see the player, and he's pissed off JUST ENOUGH, the AI will be * set to "hostile". If he cannot see the player, or he's not pissed off * enough, no relation change will occur, and he will stay neutral. * * * Tl;dr? * Don't be caught at the scene of any crime. * Come back later, when the AI have cooled down. * Then you should be safe to walk around. *****************************************************************************/ //You must cast the entity before we can //access the script floats. ai theAI = sys.getEntity(name); if ( theAI.getHealth() >= 0 ) //Is this AI dead? Dead men tell no tales. { //If not... if ( theAI.hasSeenEvidence() && theAI.AI_AlertLevel > 11 ) //Have you seen evidence, or are you pissed off? { //If so... ai theAIbuddy = theAI.findFriendlyAI(-1); //See if you can find any buddy near to you theAIbuddy.setAlertLevel( theAI.AI_AlertLevel ); //If you found him, Warn him, and piss him off, too. sys.println( theAI.getName() + ": Evidence of a crime! Or I was just informed of a crime!\n"); //And print something in the console. } if ( theAI.canSeeExt($player1, 1, 1) && theAI.AI_AlertLevel > 17 ) //Are you REALLY pissed off? AND can you see the player? { //If so... theAI.lookAt( $player1, 3 ); //Look at that nasty jerk player. theAI.setEntityRelation( $player1, -1 ); //He is now your enemy! Go get 'em! sys.println(theAI.getName() + ": I've just seen the player at a crime scene! I'm gonna kill him!\n"); //And print that in the console! } } } void crimewatch_1() { /******************************* This script gets called every trigger_timer_1 "wait" seconds Don't overdo how often it gets called, or you'll really suck away your CPU. ********************************/ crime_watch_entity("atdm_ai_citywatch_THIS_IS_MY_NAME"); crime_watch_entity("atdm_ai_citywatch_THIS_IS_ALSO_MY_NAME"); } Quote yay seuss crease touss dome in ouss nose tair Link to post Share on other sites
wrichards 5 Posted June 13, 2012 Report Share Posted June 13, 2012 I did this along time ago, I did it like this but not sure if/how posible in this editor.... I simply added the trigger, had the AI as "team" 0 then in blue room had his "evil" team 3 clone ready to be warped in and replace the team 0 guy... the warp was so fast the player didnt see the swap... used this on alot of non pathing guards I made in a museuem level I had. hope this helps Quote Link to post Share on other sites
nbohr1more 2096 Posted November 19, 2013 Report Share Posted November 19, 2013 I've been trying to find my old post but this is the closest I've found. As I recall, some of these behaviors are now part of the neutral team AI? If not, it would probably be a good idea to make some teams where this is the default behavior as scriptingis far more taxing on the CPU than native SDK code. Shall I open a bug in tracker? Quote Please visit TDM's IndieDB site and help promote the mod: http://www.indiedb.com/mods/the-dark-mod (Yeah, shameless promotion... but traffic is traffic folks...) Link to post Share on other sites
Xarg 173 Posted November 20, 2013 Report Share Posted November 20, 2013 If you want to make it a one time change, or ai are hostile only while the player is inside forbidden grounds, and will "chase" you out then go back to being neutral, I've got that in one of my wips, can detail how it was done after I get food, all using stuff within DR, no scripting. Quote Intel Sandy Bridge i7 2600K @ 3.4ghz stock clocks 8gb Kingston 1600mhz CL8 XMP RAM stock frequency Sapphire Radeon HD7870 2GB FLeX GHz Edition @ stock @ 1920x1080 Link to post Share on other sites
Obsttorte 1499 Posted November 25, 2013 Report Share Posted November 25, 2013 I barely remember posting a script called "hitman style" a while ago. You may searhc for that in my mapping thread. Quote FM's: Builder Roads, Old Habits, Old Habits Rebuild WIP's: Several. Although after playing Thief 4 I really wanna make a city mission. Mapping and Scripting: Apples and Peaches Sculptris Models and Tutorials: Obsttortes Models My wiki articles: Obstipedia Texture Blending in DR: DR ASE Blend Exporter Link to post Share on other sites
nbohr1more 2096 Posted November 26, 2013 Report Share Posted November 26, 2013 I was asking if I should open a tracker for including some of these behaviors in some AI "Teams" because doing so would improveperformance compared to using scripts for this. Ideally, we would follow-up on Fabien Sanglard's suggestion and upgrade the script VM to include JIT compiling like Q3 but short of thatpipe dream it would be cool if we had teams where these behaviors were built-in so minimal scripting would be needed. This particular thread points to a highly discussed request in the newbie mapper thread. Quote Please visit TDM's IndieDB site and help promote the mod: http://www.indiedb.com/mods/the-dark-mod (Yeah, shameless promotion... but traffic is traffic folks...) Link to post Share on other sites
nbohr1more 2096 Posted December 2, 2013 Report Share Posted December 2, 2013 Tracker 3623 created. 1 Quote Please visit TDM's IndieDB site and help promote the mod: http://www.indiedb.com/mods/the-dark-mod (Yeah, shameless promotion... but traffic is traffic folks...) Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.