Jump to content

Need help with scripts


Vartoz

Recommended Posts

Greetings, i`m trying to make a couple of items that grants you different perks, but GECK keeps giving warnings.

First question, if i have a script that grants you a perk on the event of wearing an item...

Eg: scn XXX

 

Begin OnEquip player

if player.GetEquipped XXX == 1

player.AddPerk BLABLABLA

endif

endif

End

 

Begin OnUnequip player

if player.GetEquipped XXX == 0

player.RemovePerk BLABLABLA

endif

End

That would be for only one perk, but if i want to make that on equip the item grants me with a second perk, can i add the line after "Player.AddPerk BLABLABLA" or i have to type all the root again?

Eg:

Begin OnEquip player

if player.GetEquipped XXX == 1

player.AddPerk BLABLABLA

endif

endif

End

 

Begin OnUnequip player

if player.GetEquipped XXX == 0

player.RemovePerk BLABLABLA

endif

Begin OnEquip player

if player.GetEquipped XXX == 1

player.AddPerk TIKITAKA

endif

endif

End

 

Begin OnUnequip player

if player.GetEquipped XXX == 0

player.RemovePerk TIKITAKA

endif

 

I have lots of questions, like, how do i make an item gives your inventory 2 items, one that makes the player bigger (player.setscale 1.8) another that makes the player smaller (player.setscale 0.5 or even less). Obviously, on unequiping the item you go back to regular size (player.setscale 1.00)

Please, any help you can provide would be greatly welcome.

Link to comment
Share on other sites

As far as I understand you can only have one begin block of a single type per script. Begin blocks which take arguments, ie begin onequip player, are considered different if the argument is different, ie, begin onequip player, begin onequip npc and begin onequip are different. begin onequip player and begin onequip player will generate errors.

 

The player.GetEquipped xxx tests are redundant, and possibly damaging, since the onequip block is only triggered once when an item is equipped, same for the unequip: ie, If you want a piece of armor to add a perk while worn:

scn ...

begin onequip 
addperk ... 
end 

begin onunequip
removeperk ... 
end

 

I'm not sure what you're getting at with the adding a second perk? If you mean that a single piece adds two perks, then just having two player.addperk and player.removeperk lines one after the other, containing the appropriate perks, will achieve what you're after.

 

EDIT: Fixed the code block... That's what you get for trying to write something while half asleep

Edited by Skevitj
Link to comment
Share on other sites

It's possible to have more than one of the same type of block in a singe quest, although it's rarely necessary.

 

Please, never use code like this:

ref rSelf
...
set rSelf to GetSelf
rSelf.ReferenceFunction

All that's required for exactly the same functionality is this:

ReferenceFunction

Also, the first code will fail if the scripted item is saved in the saved game, as opposed to being introduced by a data file. For example, references created via PlaceAtMe.

 

Calling a reference function on the scripted reference by omitting a calling reference is generally referred to as using "implicit reference syntax". All reference functions called on the scripted reference should be called in this way. In fact, GetSelf is itself a reference function, and you've demonstrated how to call it with implicit reference syntax in the code that you posted.

 

Cipscis

Link to comment
Share on other sites

I thought it for a while and decided to make 3 separate items that ech grant you a "power".

First, the GGE or Growing Gland Enhancer, wich makes you bigger, improves melee and unarmed but gives you rad damage while you wear it.

I think in GECK you can assign an object to give you a constant RAD effect, or is it that you only get the RAD once on equip and then you no longer get it while you have it on? (gonna have to try that one out)

 

The script i wrote goes like this, please correct me if i`m wrong:

 

scn (what am i suppose to put here?, the name of the item?)

 

Begin OnEquip

 

player.setscale 2.00

 

end

 

Begin OnUnequip

 

player.setscale 1.00

 

end

 

Next is the MASD or Micro Adjustment Stealth Device, wich makes you smaller but gives you 50 bonus to stealth.

 

Script is basically the same than before but the sacle is sert to 0.3 on equip.

 

And finally the Grasshopper device, wich basically gives you a jump power.

This script is also similar to the first, only it uses the setgs fJumpHeightMin # command, however i need to know how the "invisible ledge" problem was solve, otherwise whenever i jump i`ll land in the air.

That`s all for know, but keep in mind a couple of things, first, english is not my native language, i want to set that straight not for you to forgive my grammar, but to warn you in case any of my items`s names are not very accurate. I was going yo name the MASD as Power Micro Stealth device, but who would want to use a PMS (Pre Menstrual Syndrom) device?

The second thing i want to say is that i know nothing about scripts, and when i say nothing i mean that for me it`s like trying to learn how to control a space shuttle using a fork, an MP3 and a tomato sauce can.

 

EDIT: Solved the grasshopper script thing, needed to load GECK with FOSE loader, but now i see i don´t know how to assign a script to an object. I tryed to add it to an enchantment but i can`t.

Edited by Vartoz
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...