[SCRIPT] Req or Help - Moding player controls with FOSE

Post » Mon Mar 14, 2011 11:07 pm

I'm working on an "anti-gravity" mod for FO3, and I need some help writing a script.

1. Create Armor > "Anit-Grav Boots"
2. Assign Script to Armor that is only active when the armor is worn.

The script would increase the players "Jump Height" and use up an inventory item (like fuel).
The Icing would be to have the player hold Jump to travel further into the air, but I want to limit the height.

I know in Morrowind there was a flight spell. I'm interested to know if anyone made one for Oblivion, because that's exactly what I'm looking for. If I remember right, you could still attack in the air too, which is perfect.

I'm going to create a Quest that pays homage to that famous Tarhiel scene in Morrowind :)
http://www.youtube.com/watch?v=N4N2Gdglde0


Any ideas, info, links to helpful resources? I've looked at the esm for the Motorcycle Mod, but that's way more complex than I need, and it was difficult to find what actually made the bike move. I don't need to change player animations or anything either (not that I know of yet), I'll only need to animate the thrust FX on the boots.

Thank you for taking the time to read this!
User avatar
gemma king
 
Posts: 3523
Joined: Fri Feb 09, 2007 12:11 pm

Post » Tue Mar 15, 2011 4:15 am

Ok, well i can give you this:
scn YOURSCRIPTshort itemBegin Gamemodeset item to GetIsUsedItem ArmorPowerif ( item == 1 )endifelseif ( item == 0 )returnendifend

User avatar
liz barnes
 
Posts: 3387
Joined: Tue Oct 31, 2006 4:10 am

Post » Mon Mar 14, 2011 6:07 pm

Ok, well i can give you this:
scn YOURSCRIPTshort itemBegin Gamemodeset item to GetIsUsedItem ArmorPowerif ( item == 1 )endifelseif ( item == 0 )returnendifend




Thanks... Not sure what do with it yet, but It's still helpful.

I was thinking of starting like this:

scn ROCKETBOOTSSCRIPTshort ArmorIsActiveshort OtherVariables;etc, etc, etc....Begin OnEquip Player    Set ArmorIsActive to 1EndBegin OnUnequip    Set ArmorIsActive to 0EndBegin GameMode    If ArmorIsActive == 1                                   ;Some sort of Start variable would be activated here I'm guessing        Set ArmorIsActive to 0    EndIf                                   ;Flight Controls would start hereEnd


I also found this at the FOSE website:

GetKeyPressAlias: gkpParameters:1   index:IntegerReturn Type: scanCode:IntegerOpcode: 0x1441 (5185)Condition Function: NoIntroduced In: 1Calling Convention: BDescription: Returns the scancode of the nth key which is currently being held down%k - replaced by a string representing the key associated with a DirectInput scan codeDirectX Scancodes 57:    Spacebar


Now I have to figure out to put this to use.
User avatar
sophie
 
Posts: 3482
Joined: Fri Apr 20, 2007 7:31 pm

Post » Mon Mar 14, 2011 11:26 pm

Thanks... Not sure what do with it yet, but It's still helpful.

I was thinking of starting like this:

scn ROCKETBOOTSSCRIPT

short ArmorIsActive
short OtherVariables
;etc, etc, etc....

Begin OnEquip Player
Set ArmorIsActive to 1
End

Begin OnUnequip
Set ArmorIsActive to 0
End

Begin GameMode
If ArmorIsActive == 1
;Some sort of Start variable would be activated here I'm guessing
Set ArmorIsActive to 0
EndIf
;Flight Controls would start here
End



I also found this at the FOSE website:

GetKeyPress
Alias: gkp
Parameters:1
index:Integer
Return Type: scanCode:Integer
Opcode: 0x1441 (5185)
Condition Function: No
Introduced In: 1
Calling Convention: B
Description: Returns the scancode of the nth key which is currently being held down

%k - replaced by a string representing the key associated with a DirectInput scan code

DirectX Scancodes
57: Spacebar



Now I have to figure out to put this to use.
ok, i have no exp with FOSE lol. But i am a php expert, the kepress thing can be usefull, i have to admit that.


Also see http://ghttp://geck.gamesas.com/index.php/Category:Functions
User avatar
Rex Help
 
Posts: 3380
Joined: Mon Jun 18, 2007 6:52 pm

Post » Mon Mar 14, 2011 4:37 pm

ok, i have no exp with FOSE lol. But i am a php expert, the kepress thing can be usefull, i have to admit that.


Also see http://ghttp://geck.gamesas.com/index.php/Category:Functions


lol, yeah, I don't think php will help me here, but that's cool. That link is broken btw, but if you were trying to link to the http://geck.gamesas.com/index.php/Category:Function_Types, I think I've got that.

The main things I'm stumped on is where to put the script (Armor>Script OR Enchantment OR Both?).... Basically the script should only work while the armor is worn, but the Player should have to press a button to activate it. It shouldn't just start flying as soon as you exit the pipboy. Here's where I'm at with this. The actual flying part I'm getting help with, but neither of us is sure how to activate it via "Key Press" ... Does this look okay? Is there a better way?


ScriptName KYD462xRocketFlightSCRIPTShort vPowerUp		;Armor equipped 	0=unequiped 1=equipedShort vIsActive		;Armor in use 		0=no 1=yesShort vThrust		;Thrust active 		0=no 1=ascent 2=decent 3=free fall / no fuelShort iPCInput		;Player Input		dynamic / target DX scan code is 57 SpacebarBegin OnEquip Player	Set vPowerUp to 1EndBegin OnUnequip	Set vPowerUp to 0	Set vIsActive to 0EndBegin GameMode	If PowerUp == 1		KYD462RocketPower.Say RocketStartup 1 SFXRockets00A 1		; Play Start Up Sound		Set vPowerUp to 0		Set vIsActive to 1	EndIf	If IsActive != 0		set iPCInput to getbuttonpressed		If iPCInput == 57	;57 is the DX scan code for "spacebar"		; Begin Flight Spell - (Should I activate a spell script or just do the work here? I'm leaning toward spell.)		EndIf	EndIfEnd

User avatar
Lady Shocka
 
Posts: 3452
Joined: Mon Aug 21, 2006 10:59 pm

Post » Tue Mar 15, 2011 4:24 am

Alright... So, I'm making progress, but I am having a lot of trouble reading key-presses. I've tried it 3 ways, and nothing works.

What is wrong with this script?

[EDIT:] Never mind... I'm an idiot. I had vIsActive set to "0" no matter what the condition, so it wouldn't work no matter what I tried for reading key-presses, because of of the conditions was always "false"... That's what I get for coding at 3am after waking up at 9am this morning. It works fine now.

Still, is this an alright way to go about it? Could it be optimized?


ScriptName KYD462xRocketPackSCRIPTShort vPowerUp			;Armor equipped 	0=unequiped 1=equipedShort vIsActive			;Armor in use 		0=no 1=yesShort vThrust			;Thrust active 		0=no 1=ascent 2=decent 3=free fall / no fuelShort vPCInput			;Player Input		0=Not valid  1=ActivatedBegin OnEquip Player								; When the armor is equiped...	Set vPowerUp to 1								; Var used for startup sounds, anim, etc... (not done yet)	Set vIsActive to 1								; Tells the script that the RocketPack is ready to be usedEndBegin OnUnequip	Set vPowerUp to 0	Set vIsActive to 0	ShowMessage KYD462xMSGxRocketPowerOffEndBegin GameMode	If vPowerUp == 1											; If the armor has just been equipped		MS14ArmorVoiceRef.Say MS14SuitStart 1 CrMisterGutsy 1			; Play Start Up Sound (Temp Sound)		ShowMessage KYD462xMSGxRocketPowerOn					; Tells Player the Rocket Pack is ready to use		Set vPowerUp to 0										; Disable startup sequence	EndIf	If IsControlPressed 12 && vIsActive != 0							; 12 is the Key for Jump in FOSE		If GetInWorldSpace Wasteland != 0							; Don't want to fly indoors, or in small worldspaces			Set vPCInput to 1									; Enables the flight control if conditions are met		ElseIf GetInWorldSpace Wasteland == 0			Set vPCInput to 0			ShowMessage KYD462xMSGxRocketThrustNO				; Tells the player that they can't fly in this area			; Dispel Flight Spell									; just in case a PC teleports while the spell is active.		Endif	EndIf	If vPCInput == 1 && IsControlPressed 12							; Ok to fly and is trying to fly		ShowMessage KYD462xMSGxRocketThrustOK					; Temporary for testing. Will limit this message to 1st flight later		; Begin Flight Spell - (Activate a spell or just do the work here?)	ElseIf vPCInput == 1 && IsControlPressed 12 != 1						; This is nonsense... I'm going to rewrite a way to disable it		;Do Nothing	EndIfEnd

User avatar
Milagros Osorio
 
Posts: 3426
Joined: Fri Aug 25, 2006 4:33 pm


Return to Fallout 3