AlexScorpion Posted February 11, 2011 Author Share Posted February 11, 2011 thanks i've been able to solve the puzzle yesterday .. it looks a lot like yours the scripts still need to be adjusted .. i need to add a couple of conditions to them .. but in general they are working like they should the summon and dismiss menu script for vertibirdscn AlexSquadRadioScript int ibutton Begin OnEquip showmessage 1SquadSummonMenu end Begin GameMode set iButton to GetButtonPressed if iButton == -1 ;noone knows what it means return elseif iButton == 0 ;cancel the menu playsound WPNAlienBlasterFire2D elseif iButton == 1 && AlexSquadToManySummoned > 2 ;summon the squad showmessage AlexToManyTroopsPresent return else set AlexSquadDismis to 0 placeatme AlexSquadVertibird 1 set AlexSquadToManySummoned to 3 endif endif elseif iButton == 2 ;Dismiss the squad set AlexSquadDismis to 1 PlaceAtMe AlexSquadVertibird 1 endif end the vertibird script scn AlexSquadSummonVertibird short active ref landingMarker begin onLoad if active == 0 playgroup forward 0 set active to 1 endif end begin OnActivate if IsActionRef player == 0 ; assume this is my reference marker set landingMarker to GetActionRef ; move soldier drop-off markers FFEDropOffMarkerA.moveto landingMarker 0 -75 0 FFEDropOffMarkerB.moveto landingMarker 0 75 0 endif end begin gameMode if active == 1 if isanimplaying forward == 0 ; landed -- drop off troopers if we have a landing marker if getDestroyed == 0 if landingMarker != 1 if AlexSquadDismis == 1 set AlexSquadDisableSniper to 1 set AlexSquadDisableSupport to 1 set AlexSquadDisableAssault to 1 set AlexSquadToManySummoned to -1 elseif AlexSquadDismis == 0 placeatme AlexSquadSniper 1 placeatme AlexSquadAssault 1 placeatme AlexSquadSupport 1 endif endif playgroup backward 0 endif set active to 2 endif elseif active == 2 if isanimplaying backward == 0 set active to 3 markfordelete endif endif end the command menu script:scn AlexSquadCommandsScript int ibutton Begin OnEquip showmessage AlexSquadCommandMessage end Begin GameMode set iButton to GetButtonPressed if iButton == -1 ;noone knows what it means return elseif iButton == 0 ;cancel the menu playsound WPNAlienBlasterFire2D elseif iButton == 1 ;Make your Squad use silenced weapons set AlexSquadweaponchange to 1 elseif iButton == 2 ;make your squad use regular weapons set AlexSquadweaponchange to 0 endif end the result script for the troopers looks like this now scn AlextrooperTrooperAssaultScript begin gamemode ;forcing equip a weapon by menu ;=========================== if AlexSquadweaponchange == 1 && getequipped AlexSilentSMG == 0 && getdead == 0 removeitem AlexAssaultCarbine 1 1 additem AlexSilentSMG 1 1 equipitem AlexSilentSMG 0 1 else return endif elseif AlexSquadweaponchange == 0 && getequipped AlexAssaultCarbine == 0 && getdead == 0 removeitem AlexSilentSMG 1 1 additem AlexAssaultCarbine 1 1 equipitem AlexAssaultCarbine 0 1 else return endif ;Forcing actor to go into sneaking mod if player is sneaking ;================================ if player.IsSneaking == 1 SetForceSneak 1 else SetForceSneak 0 endif ;by dismissing the current squad you're resetting the restriction on summoning more troops ;========================================================================== if AlexSquadDisableAssault > 0 set AlexSquadDisableAssault to AlexSquadDisableAssault -1 Disable MarkForDelete endif end ;if one soldier died you will be able to summon another to replace him ;========================================================= Begin OnDeath set AlexSquadToManySummoned to (AlexSquadToManySummoned - 1) endif end Link to comment Share on other sites More sharing options...
AlexScorpion Posted February 11, 2011 Author Share Posted February 11, 2011 another bump : how to force an actor not to pick up a stronger weapon or any other weapon if he finds it ??? and is there any way to force equip a weapon on actor from form list rather than by spec. ref??? thanks Link to comment Share on other sites More sharing options...
Skevitj Posted February 11, 2011 Share Posted February 11, 2011 (edited) I've wondered about that a few times, never did find a solution, other than to make their standard guns powerful enough such that they'll always prefer them over anything available, and even then I'm not sure if that stopped them from picking guns up on the odd occasion. Maybe the best bet would be to use it to your advantage... Add a speech option to the troopers such that if the have any extra guns/ammo in their inventory they will offer them to the PC?ie, An onactivate player block in their script which runs through a form list and sets a global variable if they have some ammo/wep etc, then the speech option (+ve PC response) sets another global which triggers a script section in the NPC's gamemode block which takes care of the transfer. It would be relatively simple and quick to implement, and makes sense from a realism point of view. (Would definitely need NVSE for the list walking... sorry, believe it or not there was a time when I actively avoided OBSE/FOSE) As for picking an item from a form list, NVSE has the functions needed for walking through a list. All the stock language can do is things like IsInList so it depends what you want. Edited February 11, 2011 by Skevitj Link to comment Share on other sites More sharing options...
AlexScorpion Posted February 11, 2011 Author Share Posted February 11, 2011 (edited) yes .. i think that i will need to use NVSE .. again ... oh i see the users bashing my mod allready lol but on the bright side .. i can get rid of those begin on equip menus ( helmets , glasses0 so .. could you give me a short example of how such a script should look like ? Edited February 11, 2011 by AlexScorpion Link to comment Share on other sites More sharing options...
Skevitj Posted February 11, 2011 Share Posted February 11, 2011 (edited) For the weapons conversation topic? Once again I'm not paying attention to the syntax and not testing as I go (as I usually do) so it's more a guide for ideas than a copy paste job Global script: Just variables, for the sake of ease, I'm going to assume they're in a script for a quest called VarQuestscn ;... short hasweapons short giveweapons ;Both initalised to 0. Below is just a copypaste initialization block I use as a safeguard. short dooncebegin gamemode if doonce < 2 set hasweapons to 0 set giveweapons to 0 set doonce to 2 endif ;... Any additional code if script already existsend On the NPCs: scn ;... short counter1 ; I can't remember if ListGetNthForm starts at 0 or 1, so the start value and end-of-loop test may need to be changedshort listlenref testestitemshort testcount begin onactivate player set listlen to ListGetCount TradeItemsList ;TradeItemsList is just a form list containing all the items you want the NPC's to give the PC set VarQuest.hasweapons to 0set counter1 to 0; START value set here label 1 set testitem to ListGetNthForm TradeItemsList counter1 if this.GetItemCount testitem > 0 set VarQuest.hasweapons to 1 endif set counter1 to counter1 + 1 if counter1 < listlen goto 1 endif activateend begin gamemode if VarQuest.giveweapons > 0 set VarQuest.giveweapons to 0 set counter1 to 0 set listlen to ListGetCount TradeItemsList label 2 set testitem to ListGetNthForm TradeItemsList counter1 set testcount to GetItemCount testitem if testcount > 0 removeitem testitem testcount player.additem testitem testcount endif set counter1 to counter1 + 1 if counter1 < listlen goto 2 endif ;...Existing code goes after here, It may be worth finishing up this bit with a recheck of their current weapon and which weapon they should have equipped.end I don't play with dialogue regularly, so this isn't going to be clear, but all you need to do is set up the option where, while in a conversation with the PC, they will ofter their "excess" weapons/ammo and the player replies yes or no. The NPC's dialogue line has a VarQuest.hasweapons>0 check which it must pass for it to be visible. (So we're not offering when we don't have any) Yes:set VarQuest.hasweapons to 0set VarQuest.giveweapons to 1 The only problem with this code, as far as I know, is that it gives items at 100% condition, it's possible to modify it to give the weapons in current condition, I'd have to have a look to see how they've done it though. The weapons confiscation at casino doors should contain the modification necessary, if not UHNV's sorters does it too. Edited February 12, 2011 by Skevitj Link to comment Share on other sites More sharing options...
AlexScorpion Posted February 11, 2011 Author Share Posted February 11, 2011 i've added this to my trooper script scn AlextrooperTrooperAssaultScript Ref rWeaponRef Int FormListIndex begin gamemode ;forcing equip a weapon by menu ;=========================== if AlexSquadweaponchange == 0 Set FormListIndex to AlexLoudWeaponsList elseif AlexSquadweaponchange == 1 Set FormListIndex to AlexSilentWeaponsList endif Set rWeaponRef to ListGetNthForm AlexAllWeaponsList FormListIndex If getequipped rWeaponRef == 0 && getdead == 0 additem rWeaponRef 1 1 equipitem rWeaponRef 0 1 endif any idea .. why it doesn't work ..? thanks Link to comment Share on other sites More sharing options...
Skevitj Posted February 11, 2011 Share Posted February 11, 2011 (edited) As a 1 sec guess, you didn't add the gun's reference to the form list? Wait a sec, FormListIndex is an int, and you're assigning it a reference.The idea is you have just a single list containing all the weapons, and reference the weapons you want off the list by number. You don't need the if statements or the int variable (var can be repurposed though).For this, the loud weapon should be the first in the list (position 0) and the silent one the next weapon (position 1) The order should match the menu where AlexSquadweaponchange is set. if FormListIndex != AlexSquadweaponchange Set rWeaponRef to ListGetNthForm AlexAllWeaponsList FormListIndex if getdead == 0removeitem rWeaponRef 1endif Set rWeaponRef to ListGetNthForm AlexAllWeaponsList AlexSquadweaponchange If getequipped rWeaponRef == 0 && getdead == 0 additem rWeaponRef 1 1 equipitem rWeaponRef 0 1 endif set FormListIndex to AlexSquadweaponchangeendif Try that At any rate I need to get some sleep.. Good Luck PS. What is the [block] needed to to the code insert? I've never seen that before.PS2. I've edited post #15 to fix a few syntax error and removed a group of redundant variables. Trying to format these posts is a nightmare Edited February 12, 2011 by Skevitj Link to comment Share on other sites More sharing options...
AlexScorpion Posted February 12, 2011 Author Share Posted February 12, 2011 it's begin GameMode anyway ... the code from your last post workerd had to alter it a bit but it worked .... so since i switched to fose again and form lists again i'm getting new ideas ... say if would want them to upgrade their weapons after they had scored enough points by killing the enemies ... could i controll something like that by a quest ??? Link to comment Share on other sites More sharing options...
Skevitj Posted February 12, 2011 Share Posted February 12, 2011 (edited) Eh? I mean how do you get the code formatting in your posts, as in similar to [ url=] [/url] You wouldn't need a quest to do upgrades, just add two variables to the NPC's script, one which stores their "kill count" and the other which reflects the level of upgrade (and is updated by a gamemode block whenever the kill count changes. That way you just have all your weapon types and upgrades in a single form list, and have them ordered by upgrade level, ie, Loud, Soft, Heavy, Loud Upgrade, Soft Upgrade, Heavy Upgrade, Loud Upgrade2, etc.AlexSquadweaponchange (or whatever you're using) had a value between 0 and n-1 where n is the number of weapon types (loud soft heavy: n=3) and the upgrade variable is incremented by n every level The only change needed to the weapon select code is using AlexSquadweaponchange + WeaponUpgradeVar as the index # instead of AlexSquadweaponchange. It depends how long you were intending for the NPCs to stick around for, but implementing upgrades to them might just be more trouble than its worth, especially if they're mostly just going to be cannon fodder. Edited February 12, 2011 by Skevitj Link to comment Share on other sites More sharing options...
AlexScorpion Posted February 12, 2011 Author Share Posted February 12, 2011 thanks ... i'll try that no lol .. not the xhtml lol the NVSE form list thing Link to comment Share on other sites More sharing options...
Recommended Posts