MagSul Posted September 10, 2017 Share Posted September 10, 2017 Hello! I've set up a short scenario that allows the protagonist of my mod to compete in duels with other padawans. My problem is that if the player loses then it's game over. I would prefer defeat to trigger a brief dialogue before resetting the scenario. I'm not sure how to accomplish this. If possible, could I please get some help? ooeJack, Penekowski, Circa and 1 other like this Link to comment
Ramikad Posted September 10, 2017 Share Posted September 10, 2017 You could set up a script like this one: //(BHVD) affect ( "Player", /*@AFFECT_TYPE*/ FLUSH ) { set ( /*@SET_TYPES*/ "SET_UNDYING", "DEFAULT" ); if ( $get( FLOAT, "SET_HEALTH")$, $=$, $1$ ) { run ( "end_duel" ); } } as that NPC attackscript, so it is called with a certain constancy. Basically it will check on the player's health every time the NPC attacks, and when the player's health hits 1, all the scripts needed for the duel to end are executed. Smoo, therfiles and ooeJack like this Link to comment
MagSul Posted September 10, 2017 Author Share Posted September 10, 2017 Thank you very much, @@Ramikad! I shall give it a shot. ooeJack likes this Link to comment
Noodle Posted September 11, 2017 Share Posted September 11, 2017 What you want can be achieved! I can't remember exactly how I've done it, but I think you can give a spawnscript to the player that makes him undying and a deathscript that should activate when he reaches 1 point of HP. Langerd and therfiles like this Link to comment
Langerd Posted September 13, 2017 Share Posted September 13, 2017 What you want can be achieved! I can't remember exactly how I've done it, but I think you can give a spawnscript to the player that makes him undying and a deathscript that should activate when he reaches 1 point of HP. Yep deathscript activetes with the undying set on - 1 hp. Not sure for a player tho.. Link to comment
Ramikad Posted September 14, 2017 Share Posted September 14, 2017 Yep deathscript activetes with the undying set on - 1 hp. Not sure for a player tho.. What? A deathscript runs when the target health reaches 1? That's technically still alive in my book If that is the case, then it should be enough to set the player undying, set the player's deathscript as the end duel commands and then clear it out once the duel finishes. Langerd likes this Link to comment
MagSul Posted December 4, 2017 Author Share Posted December 4, 2017 I hadn't realised how much time had passed until I popped back in here (sorry about that!) Suffice to say that this issue still hasn't quite worked out the way I was hoping. The undying part works fine. The player hits 1hp as described above and then doesn't die. The problem is that the death script doesn't seem to kick in. The above is basically a replica of how the same thing is done in Jedi Outcast when Desann defeats Kyle on Artus_Topside. Below is an example from Jedi Outcast, which I'm using for reference. affect ( "kyle", /*@AFFECT_TYPE*/ FLUSH ){set ( /*@SET_TYPES*/ "SET_WEAPON", /*@@weaponx_NAMES*/ "WP_BLASTER" );set ( /*@SET_TYPES*/ "SET_ORIGIN", $tag( "player_start_cin9_fight", ORIGIN)$ );set ( /*@SET_TYPES*/ "SET_UNDYING", /*@BOOL_TYPES*/ "true" );set ( /*@SET_TYPES*/ "SET_DEATHSCRIPT", "cinematics/cinematic9_run_end" );} I feel like I'm missing something. Does anyone have any ideas as to what that may be? Link to comment
Noodle Posted December 4, 2017 Share Posted December 4, 2017 affect ( "kyle", /*@AFFECT_TYPE*/ FLUSH ){set ( /*@SET_TYPES*/ "SET_WEAPON", /*@@weaponx_NAMES*/ "WP_BLASTER" );set ( /*@SET_TYPES*/ "SET_ORIGIN", $tag( "player_start_cin9_fight", ORIGIN)$ );set ( /*@SET_TYPES*/ "SET_UNDYING", /*@BOOL_TYPES*/ "true" );set ( /*@SET_TYPES*/ "SET_DEATHSCRIPT", "cinematics/cinematic9_run_end" );} I feel like I'm missing something. Does anyone have any ideas as to what that may be? If this is for Jedi academy it should affect 'player', not 'kyle'. Otherwise, it should work unless it's not finding your deathscript. Link to comment
Ramikad Posted December 4, 2017 Share Posted December 4, 2017 Perhaps the player entity is more limited in this regard than Kyle was in Jedi Outcast. I know for sure, from old tests, that certain script states don't work (namely attackscript). Perhaps deathscript doesn't work either. Though I'm not a coder, so I could be wrong.However, if that is the case, I can only suggest you to run a target_scriptrunner that checks on the player's health, or maybe the enemy's attackscript, so that the player's health will be checked at each swing. Link to comment
Noodle Posted December 4, 2017 Share Posted December 4, 2017 Perhaps the player entity is more limited in this regard than Kyle was in Jedi Outcast. I know for sure, from old tests, that certain script states don't work (namely attackscript). Perhaps deathscript doesn't work either. Though I'm not a coder, so I could be wrong.However, if that is the case, I can only suggest you to run a target_scriptrunner that checks on the player's health, or maybe the enemy's attackscript, so that the player's health will be checked at each swing. Nope. Deathscript does work, I've tested it in JA many times without issue. Link to comment
MagSul Posted December 5, 2017 Author Share Posted December 5, 2017 I did replace "Kyle" with "Player" when I tested it last night. I've had a quick look at it again this morning and I did find a minor error, so I'll share the results this evening if successful or not. ^.^ Noodle and Langerd like this Link to comment
MagSul Posted December 5, 2017 Author Share Posted December 5, 2017 If this is for Jedi academy it should affect 'player', not 'kyle'. Otherwise, it should work unless it's not finding your deathscript. I am getting the impression that's it not finding my deathscript. It's currently set up exactly as shown in the picture above, inside the affect player brackets. My minor tweak did nothing to impact it. Link to comment
Noodle Posted December 5, 2017 Share Posted December 5, 2017 I am getting the impression that's it not finding my deathscript. It's currently set up exactly as shown in the picture above, inside the affect player brackets. My minor tweak did nothing to impact it. Could you share a screenshot of your script in behavED and also of the folder your script is located? It would be much easier to spot a problem like that. Edit: I created a working map example for you to see how it works. Download this file https://www.dropbox.com/s/jj1x1yvlbwb32ux/deathscript_test.pk3?dl=0 and see the source files. Whenever the stormtrooper kills you, the deathscript activates. Link to comment
Droidy365 Posted December 5, 2017 Share Posted December 5, 2017 Well, just a little something I noticed is that it says @@weaponx_NAMES Rather than @ WEAPON_NAMES Now, this might sound stupid, but did you accidentally copy/paste that in your script? Keep in mind that I don't know crap about scripting lol.BTW the damn thing auto-corrects @ WEAPON to @@weaponx.Sorry about the pings, weaponx Link to comment
MagSul Posted December 5, 2017 Author Share Posted December 5, 2017 @@Droidy365 That particular part of the script that I quoted is from JO, I referenced it as an example to say that the deathscript line was pretty much identical. I'm not using the "weaponx" part but thank you for the shout! Could you share a screenshot of your script in behavED and also of the folder your script is located? It would be much easier to spot a problem like that. The script is named duel_end.ibi and it's in scripts/yavin_temple in my .pk3 (I have tried changing the file path to scripts/yavin_temple/duel_end in the script below). Here was the last version of the script that I used: Please be gentle! Link to comment
Noodle Posted December 5, 2017 Share Posted December 5, 2017 @@Droidy365 That particular part of the script that I quoted is from JO, I referenced it as an example to say that the deathscript line was pretty much identical. I'm not using the "weaponx" part but thank you for the shout! The script is named duel_end.ibi and it's in scripts/yavin_temple in my .pk3 (I have tried changing the file path to scripts/yavin_temple/duel_end in the script below). Here was the last version of the script that I used: Please be gentle! Does the rest of the script works? If it does, even if the deathscript doesn't work, is the player unkillable? If the answer is positive to both questions, then the problem is related to the deathscript in question. Could you share that one with us too? Link to comment
MagSul Posted December 6, 2017 Author Share Posted December 6, 2017 Does the rest of the script works? If it does, even if the deathscript doesn't work, is the player unkillable? If the answer is positive to both questions, then the problem is related to the deathscript in question. Could you share that one with us too? Sure! I've done a few interations. Because it didn't seem to be triggering though, I've just left it at this at the moment: Link to comment
Lazarus Posted December 6, 2017 Share Posted December 6, 2017 Have you tried setting the deathscript in your player entity, rather than via script. I see you use different spawn points, so just applying the deathscript to that entity (i asume you remove him in the next cutscene) will do no harm. Link to comment
MagSul Posted December 6, 2017 Author Share Posted December 6, 2017 Have you tried setting the deathscript in your player entity, rather than via script. I see you use different spawn points, so just applying the deathscript to that entity (i asume you remove him in the next cutscene) will do no harm. I only have one info_player_start entity in the map! Also, interesting update: The working example @@Noodle sent earlier works when tested by itself. What I eventually tried was copying the aspects of the test/deathscript into my script to see what would happen. set ( /*@SET_TYPES*/ "SET_UNDYING", /*@BOOL_TYPES*/ "true" );set ( /*@SET_TYPES*/ "SET_HEALTH", 20 );set ( /*@SET_TYPES*/ "SET_ARMOR", 0 );set ( /*@SET_TYPES*/ "SET_DEATHSCRIPT", "test/deathscript" ); The test/deathscript works on the small map Noodle sent, but not when these values are incorporated in with my script. The player does not die, they stay at 1hp. Their health starts at 20 and their armor is 0. It's solely the death script part that does not seem to be being applied. Link to comment
Noodle Posted December 6, 2017 Share Posted December 6, 2017 I only have one info_player_start entity in the map! Also, interesting update: The working example @@Noodle sent earlier works when tested by itself. What I eventually tried was copying the aspects of the test/deathscript into my script to see what would happen. set ( /*@SET_TYPES*/ "SET_UNDYING", /*@BOOL_TYPES*/ "true" );set ( /*@SET_TYPES*/ "SET_HEALTH", 20 );set ( /*@SET_TYPES*/ "SET_ARMOR", 0 );set ( /*@SET_TYPES*/ "SET_DEATHSCRIPT", "test/deathscript" ); The test/deathscript works on the small map Noodle sent, but not when these values are incorporated in with my script. The player does not die, they stay at 1hp. Their health starts at 20 and their armor is 0. It's solely the death script part that does not seem to be being applied. Then this must mean that the problem is that somehow it's not applying the SET_DEATHSCRIPT command. Try this, it will be a bit bloaty, but should work: Create a new script that's like this: affect ( "player", FLUSH ) { set ( "SET_DEATHSCRIPT", "test/deathscript" ); } Give it any name you want, in this case I'll name it use_deathscript and it will be on my 'test' folder. After that, replace on your script the SET_DEATHSCRIPT 'test/deathscript' with: run ( "test/use_deathscript" ); Since the run command doesn't need to be on the "affect 'player'" list of scripts, I'd place it before the camera fade. It'll basically run a new script that will set the player's deathscript to be whatever you want it to be. Basically, you'd have to create have 3 scripts to make this work. Link to comment
MagSul Posted December 7, 2017 Author Share Posted December 7, 2017 Basically, you'd have to create have 3 scripts to make this work. I had this idea earlier in the week as well but was ultimately unsuccessful. I've given it a further go (along with a few other various ways I can think of) and nothing is coming through. It doesn't seem to matter where I place that particular line in this script or any other, it just won't activate. I've even replaced my script with yours (including the filepath) to test it and strangely, that doesn't work either (yet it does in the example you shared.) I'm baffled. Link to comment
Noodle Posted December 7, 2017 Share Posted December 7, 2017 I had this idea earlier in the week as well but was ultimately unsuccessful. I've given it a further go (along with a few other various ways I can think of) and nothing is coming through. It doesn't seem to matter where I place that particular line in this script or any other, it just won't activate. I've even replaced my script with yours (including the filepath) to test it and strangely, that doesn't work either (yet it does in the example you shared.) I'm baffled. If you want, you can PM me the .map file and the scripts to see if I can make it work on my own and then send you the solution. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now