Vandrosch Posted January 9, 2009 Share Posted January 9, 2009 Hi Folks, so for some days i´ve been trying to build my first mod ever (yeah i´m a damn noob *lol) - a reconsideration of the repair-system. We may call it a "portable repair device"... (still working on the final name/description) So I created a new Misc Item, some MESG, Some notes etc. and 1 Script What it does atm: >>If the new item is added to Inventory - add Note (works) - wanted! then>> If this item is dropped and activated - show Message 1 (works) - wanted!then>> If Buttons in Message 1 get clicked - remove Item X and add item Y (works) - wanted!then>> Show Message 2 (Message 2 has only ONE Button) (works) wanted!then>> If this button is clicked the placed item goes back to inventory - I DO NOT WANT THAT ;-) ... instead I´d wish to show Message 1 Again... So is it possible to "combine" 2 Messages in a Script like>Show me Message 1>Press Button in Message 1>Show me Message 2>Press Button in Message 2>Show me Message 1 againand so on? Add here is my script (not the whole one... just the problematic lines) so far :-) begin onactivateset passSkill to 15if (IsActionRef player == 1) if player.getav repair >= passSkill showmessage SchematicsSparePartSetSmallGunMsg ;if skill is >=15 this message shows up (works how it should)elseif showmessage SchematicsSparePartSetSmallGunFailMsg ; if skill is <15 this message shows up (works how it should)endifendifend Begin GameModeif IsActionRef player == 1activateendif set Button to GetButtonPressed As i wanted these buttons from the message apear if the player´s skill is high enough if button == 0 first button in the Message - worksIf (getitemCount Paintgun > 0) && (getitemCount MotorcycleHandbrake > 0) && (getitemCount spareparts > 0)ShowMessage SparePartSuccessMsg So here is the problematic point... If i click on the buttons in Message 1 all this player.removeitem and player.additem stuff is working fine and ShowMessage SparePartSuccessMsg works, too.. BUT i´d like to return to THIS SchematicsSparePartSetSmallGunMsg (First Message) message after clicking on the button in SparePartSuccessMsg (Second Message) Player.removeitem PaintGun 1 Player.removeitem MotorcycleHandBrake 1Player.removeitem SpareParts 1 Player.additem SmallGunSpareParts 1PlaySound UIRepairWeaponendifendif if button == 1 and so the script goes on :-) I hope you undestand my problem Please help me i´m getting :wallbash: Greeting Van Link to comment Share on other sites More sharing options...
Vandrosch Posted January 9, 2009 Author Share Posted January 9, 2009 BTW... please turn a blind eye on my english... i know that it´s far away from being perfect ;-) Link to comment Share on other sites More sharing options...
Vandrosch Posted January 11, 2009 Author Share Posted January 11, 2009 Problem solved... :-) Link to comment Share on other sites More sharing options...
Skree000 Posted January 13, 2009 Share Posted January 13, 2009 Just curious, what did your script look like when you solved it? So we can use it as reference if we want to do something similar later on :) Link to comment Share on other sites More sharing options...
Vandrosch Posted January 14, 2009 Author Share Posted January 14, 2009 Now the script looks like this... and it works just fine in my RecycleToRepair Mod.... well i don´t now wether this is a "good looking" script or not... but it works :-)... this is not the entire script... just 3 example buttons... This script does: When the item is optained for the first time - The "schematicsSparePartSetSmallGunNote" Note is added if the player hasn´t got this note yet.if player.gethasnote SchematicsSparePartSetSmallGunNote == 0- If the player already has the note... no note is added To activate the item has to be dropped from the inventory.If activated the Script checks wether a particular Skil is high enough to use the item.In this case it´s the repair Skill that has got to be 15 or higher(SetPassSkill) If the players Repair Skill is >= (higher or equal) 15 the Menu SchematicsSparePartSetSmallGunMsg is shown and can be used. Else (so if the Skill is < (less) 15 the Fail Message is shown and the item goes back to the inventory. In the Message SchematicsSparePartSetSmallGunMsg there are buttons from 0 to 7.Button == 0 to button == 6 have a scripted functions --------------------------------------------------------------------scn SchematicsSparePartSetSmallGunScript short buttonshort HasItemsshort passSkill short buttonpressed begin onadd if player.gethasnote SchematicsSparePartSetSmallGunNote == 0player.addnote schematicsSparePartSetSmallGunNoteendifend begin onactivateset passSkill to 15if (IsActionRef player == 1) if player.getav repair >= passSkill showmessage SchematicsSparePartSetSmallGunMsg else showmessage SchematicsSparePartSetSmallGunFailMsg endif endifend Begin gamemodeif IsActionRef player == 1activate (4)endif ; (1) this cannot be true when no button in the message was pressedif buttonpressed == -3showmessage SchematicsSparePartSetSmallGunMsgendif set buttonpressed to -1 ; (2) this is true when the last button in the message was pressed set button to GetButtonPressed elseif button == 0 if (player.getitemCount Paintgun >= 1) && (player.getitemCount MotorcycleHandbrake >= 1) && (player.getitemCount spareparts >= 1)ShowMessage SparePartSuccessMsg ; Simply says, that the Button has done what it should doPlayer.removeitem PaintGun 1 Player.removeitem MotorcycleHandBrake 1Player.removeitem SpareParts 1 Player.additem SmallGunSpareParts 1PlaySound UIRepairWeaponset buttonpressed to -3 ; this makes (1) TRUE! and the Message SchematicsSparePartSetSmallGunMsg is shown again!endifendif elseif button == 1if (player.getitemcount Weap10mmPistol >= 1)ShowMessage SparePartSuccessMsgplayer.removeitem Weap10mmPistol 1player.additem SmallGunSpareParts 3PlaySound UIRepairWeaponset buttonpressed to -3 endifendif elseif button == 2 if (player.getitemcount Weap10mmPistolSilenced >= 1) ShowMessage SparePartSuccessMsgplayer.removeitem Weap10mmPistolSilenced 1player.additem SmallGunSpareParts 3PlaySound UIRepairWeaponset buttonpressed to -3 endifendif ; goes to button == 6 ;the last Button (would be button == 7) in SchematicsSparePartSetSmallGunMsg is empty and so (2) is TRUE!; and so the item is simply activated (4) which sends it back to the inventory.; if any other button in the Message is pressed, (1) is TRUE and the Script starts again.... end --------------------------------- Hope this is understanable :-) At the moment i am trying to write a script with a Main Menu and several sub menus ... but i cannot figure out how to configure the buttons in the submenus :-( if anyone has an idea i´d be clad to here it :-) Link to comment Share on other sites More sharing options...
Pelinor Posted January 14, 2009 Share Posted January 14, 2009 I tried setting up sub-menus earlier today but didn't have time to really get it working. It went crazy on one script, so I think I'll try setting up a different quest and script for each sub-menu. Each one will check for a variable on the master script for when to show the new message; something like this on the master... if buttonpressed == 1set showmessage1 to 1endif Then on the slave... if masterscript.showmessage1 == 1showmessage message1endif It would also need a check to keep from running all of the time. Link to comment Share on other sites More sharing options...
Vandrosch Posted January 14, 2009 Author Share Posted January 14, 2009 Hmmm sounds good i think.... i´ll test that, but i don´t know wether you can make one script check another script... tested it.... does not work this way :-( i tried this.... MASTER scn ArmorRecycleHiTecScript short buttonshort buttonpressedshort showmessage1 begin onactivateif (IsActionRef player == 1) showmessage Main Menu endifend Begin gamemode if IsActionRef player == 1activateendif if button == 0set showmessage1 to 1endif end .... works - the menu is shown when the item is activated.... SLAVE scn Menu1SCRIPT short buttonshort buttonpressedshort showmessage1 Begin gamemode set button to getbuttonpressed if armor ArmorRecycleHiTecScript.showmessage1 == 1; i also tried if showmessage1.ArmorRecycleHiTecScript == 1showmessage MENU1endifend Problem: - if ArmorRecycleHiTecScript.showmessage1 == 1 GECK says: Unknown variable or function "Showmessage1"- if showmessage1.ArmorRecycleHiTecScript == 1 GECK says:Unknown variable or function "ArmorRecycleHiTecScript" So it seems, that the two scripts don´t work together... or there might be a command to let them refere to each other... D´OH! there´s gotta be a way to do that.... Link to comment Share on other sites More sharing options...
Pelinor Posted January 15, 2009 Share Posted January 15, 2009 So it seems, that the two scripts don´t work together... or there might be a command to let them refere to each other... D´OH! there´s gotta be a way to do that....Sorry for being misleading. I was well overdue for sleep when I wrote that. You'll have to reference the object/quest that the script is attached to for getting the variable. (As in masterobject.variable instead of masterscript.variable.) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.