boog2006 Posted October 19, 2007 Share Posted October 19, 2007 I've built a mission which uses a trigger scheme to implement a simulated ability for AI units to surrender. I'm happy to report I've had some success. I've made the scheme general enough that it can be used in any mission with only minor tweaks. Also, several of the triggers can be used in other contexts (retrieving all of the UnitIDs in an entire army one at a time and converting strings to numbers). The player will even be able to select guards that the prisoners will follow where ever the player likes. Currently there is no chance that the prisoners will try to escape, but I'm working on that. Before I upload this, if anyone is interested, I'm looking for someone familier with the mission builder to look at this and give me some feedback. Sneaksie, if you're reading this, if the team doesn't have time to implement a surrender in the add-on, could they at least include a command in the mission builder to make a unit drop all of its weapons? I think that's the main thing that's still missing with this. Link to comment Share on other sites More sharing options...
Sneaksie Posted October 19, 2007 Share Posted October 19, 2007 boog2006, it's great that you've made something new:) Of course upload your code, interesting. Surrendering and trigger for dropping weapons are planned for addon, they will be in if everything goes ok. Link to comment Share on other sites More sharing options...
SlapHappy Posted January 13, 2008 Share Posted January 13, 2008 Boog Whatever happened to this? I'm planning a surrender script with variable conditions and I'd like to see how you planned yours to work.... Link to comment Share on other sites More sharing options...
PanzerkwVIIIMaus Posted January 16, 2008 Share Posted January 16, 2008 what do you mean by familier with the mission editor? if you mean by units, placements, etc i'm your guy. if by triggers, no idea who to get Link to comment Share on other sites More sharing options...
Gnasher Posted January 16, 2008 Share Posted January 16, 2008 Well chaps unless we see the code we'll never know.... I'd also be fascinated to know how Boog did this but I bet it involves a shed load of code monitoring numbers on every group which is going to be a significant overhead on what is an already a resource hungry game because I think the checks would need to be quite granular (<=5secs) so it might not be a simple as it seems at face value. I could also find alot of uses for a piece of code that did this, I've been meaning to have a play aorund with this myself but haven't as yet found the time... :mad: So please post some code.... What really surprises me is that Slap found this thread when it had been dead for nearly 3 months, well bumped that man! Link to comment Share on other sites More sharing options...
SlapHappy Posted January 16, 2008 Share Posted January 16, 2008 Well code is one thing needed for sure My approach is actually pretty simple. There is a trigger command called ChangeArmy. It's syntax looks something like this: </font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;"> SET @groupName = “Group_01” SET @newArmyIndex = 2 ChangeArmy ( "GROUP” , @groupName , @newArmyIndex ) // Changing the army of the group with the identifier Group_01 to army 2 Halt </pre> Link to comment Share on other sites More sharing options...
SlapHappy Posted January 16, 2008 Share Posted January 16, 2008 Obviously, working group by group, or unit by unit would be more complex than one global routine per army. It would also probably add more checks to the game as mentioned above. It would probably be more realistic, however. Conditions could run a wide gamut of possibilities. You could simply do random probabilities based on squad losses (or entire army, again depending on your approach) or tie the whole thing into the morale status or both. You could also have different probabilities based on army nationality if you really want to be biased about it . You would have to use different scripts or do additional checks for that, however. Link to comment Share on other sites More sharing options...
Gnasher Posted January 18, 2008 Share Posted January 18, 2008 Ive been playing with this & managed to get some code that works ok. Need to work on getting this prettier, maybe they should retreat in column..? The surrender conditions for germans are < 4 soldiers or less than 40% of British troops in the target rect. </font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;"> label 99 delay ( 5000 ) SetWorkArmy ( Army , 1 ) Set @uk_inf_In_rect = GetnunitsInArea ( Army , 1 , HUMAN , "Wood" , "NO_PANIC" ) if ( @uk_inf_In_rect > 1 ) Then label 100 delay ( 5000 ) SetWorkArmy ( Army , 1 ) Set @uk_inf_In_wood = GetnunitsInArea ( Army , 1 , HUMAN , "Wood" , "NO_PANIC" ) SetWorkArmy ( Army , 2 ) Set @German_In_wood = GetnunitsInArea ( GROUP , "Group_wood snipers" , HUMAN , "Wood" , "NO_PANIC" ) if ( @German_In_wood <= 4 ) Then goto 101 endif Set @snum = @German_In_wood div ( @snum , @uk_inf_In_wood ) mul ( @snum , 100 ) if ( @snum <= 40 ) Then goto 101 halt endif goto 100 halt endif goto 99 label 101 SetWorkArmy ( Army , 2 ) ChangeArmy ( GROUP , "Group_wood snipers" , "4" ) delay ( 500 ) RunCommand ( ARMY , "4" , RETREAT , rect , "surrender" ) delay ( 500 ) QuestWin ( "Woods" , 10000 ) destroytrigger ( "snipers" ) delay ( 500 ) Halt goto 101 </pre> Link to comment Share on other sites More sharing options...
boog2006 Posted January 25, 2008 Author Share Posted January 25, 2008 Wow, there was interest. There was some weirdness I hadn't thought of if say, they guard was killed. I had to reprogram part of it. That's fixed. Also as of now you can only have one guard, and I had wanted to plan multi-guard support. I shelved till the patch came out because I thought there was no interest. I have the files, should I post them somewhere? There is a lot of code, but it doesn't always monitor every group. It monitors an area, then later if you do get your POWs it monitors them to make sure they are behaving themselves. Link to comment Share on other sites More sharing options...
Gnasher Posted January 25, 2008 Share Posted January 25, 2008 Yeah, Boog please show the code, I for one am interested in what you've acheived. Link to comment Share on other sites More sharing options...
boog2006 Posted January 26, 2008 Author Share Posted January 26, 2008 If the user wanted a briefing to appear, they would have to paste the text to both texts.utf8 and campaign_extra.xml, right? Link to comment Share on other sites More sharing options...
Gnasher Posted January 26, 2008 Share Posted January 26, 2008 I'd just do it in the campaign editor, cant be doing with that editing xml files malarky, easier to let the editor do it for you. Link to comment Share on other sites More sharing options...
boog2006 Posted January 27, 2008 Author Share Posted January 27, 2008 It's up at CMmods. Link to comment Share on other sites More sharing options...
boog2006 Posted January 30, 2008 Author Share Posted January 30, 2008 Anyone looked at this? Any thoughts? Link to comment Share on other sites More sharing options...
Thork Posted January 30, 2008 Share Posted January 30, 2008 I havent really looked at this yet but how about using this to mod a dynamic campaign? Looking at campaign.xml files you can specify different follow-up missions depending on mission success/failure... Why not just add some smaller, easier missions in between the main ones that only get called if the player fails. One would then just implement and adapt surrender events/triggers to every mission for both the player and the KI. The Player could use these easier missions to regain strength (experience) and could still be able to successfully continue his main campaign. Using the existing campaigns, the new map-editor and surrender events this could be a pretty simple task?! Link to comment Share on other sites More sharing options...
SlapHappy Posted January 30, 2008 Share Posted January 30, 2008 Originally posted by boog2006: Anyone looked at this? Any thoughts? I will look at it tonight, Boog, and give a proper overview of it on Thursday. Link to comment Share on other sites More sharing options...
CeltiCid Posted February 2, 2008 Share Posted February 2, 2008 hi, im absolutly newbie in modding any escenario, and my knowledge about scripting is limited. But will be very interesting use this script in custom scenarios, for tourney and ladder purposes. Is there any easy way to use "surrender script" into custom scenarios? a tutorial will be very appreciated. Link to comment Share on other sites More sharing options...
boog2006 Posted February 2, 2008 Author Share Posted February 2, 2008 Tutorial is in download, allong with full comments in the code. Link to comment Share on other sites More sharing options...
SlapHappy Posted February 3, 2008 Share Posted February 3, 2008 Boog I'm having trouble with the mission. When the game starts, it is in pause mode. When I hit the space bar to take it out of pause mode, almost instantly, it goes back into pause mode? I'm going to try loading it again. I'm not aware of any scripting issues that could cause this...I suppose you're not having this problem? Link to comment Share on other sites More sharing options...
SlapHappy Posted February 3, 2008 Share Posted February 3, 2008 Hmmm...I took out the Gamepause (on) command in your script and that seemed to fix it. Unfortunately, so far I haven't been able to trigger the surrender conditions.....I did wipe them out pretty easily, though! Link to comment Share on other sites More sharing options...
boog2006 Posted February 3, 2008 Author Share Posted February 3, 2008 It seems there are patch issues... I'll look into it Link to comment Share on other sites More sharing options...
boog2006 Posted February 3, 2008 Author Share Posted February 3, 2008 OK, no patch issues. I accidentally commented out HALT in the int trigger. Put that back in and all should work as intended, including the pause. Link to comment Share on other sites More sharing options...
boog2006 Posted February 5, 2008 Author Share Posted February 5, 2008 Updated file now at CMMods. Please let me know what you think. Link to comment Share on other sites More sharing options...
boog2006 Posted February 7, 2008 Author Share Posted February 7, 2008 Friendly bumb... Is this working for people? Link to comment Share on other sites More sharing options...
Recommended Posts