Jump to content

Need help for scripting


Hulgore

Recommended Posts

Hello everyone

 

I'm trying to create a trait, this trait would (among other things) add on the player a helmet that the player cannot remove. I already have a part of the code, but I need something more in it to explain to the game : "if player has custom trait, then equip custom helm on player". Can anyone help me on that ?

 

My current code :

 

 

scn equipIT!

begin OnAdd player
Player.EquipItem DoomHelm 1
end
Link to comment
Share on other sites

I thought this was going to be simple to answer (a function), but was wrong. As I understand it, "Traits modify aspects of gameplay, granting a benefit in one area at the cost of hampering another." (- Nukepedia). Which (as I interpret it by looking at the examples, but could be wrong), means they modify something "once and done". I could not find any function in the GECKWiki related to "traits". If you want to be able to check for something you either need an "effect" (ActorHasEffect) or a "perk" (HasPerk).

 

-Dubious-

Link to comment
Share on other sites

I'm not really qualified to give any advice on scripting but I would try to attach script like this:

scn equipIT!
       Begin ScriptEfectStart
       Player.Additem DoomHelm 1
       Player.EquipItem DoomHelm 1
end
to a magic effect, then attach this magic effect to an ability, and then add this ability in your trait "Perk Entries" field.
I dunno, may not work but maybe it'll point you in the right direction.
Edited by dudeapocalypse
Link to comment
Share on other sites

Hi,

 

Weird how nobody gave you a straight answer, I just tried it and it was fairly straightforward.

 

Perks in the game (including traits) don't have any effect on the player by themselves, their ranks (and the perk entries assigned those ranks) do which can be either one of three types: quest, ability or entry point.

A quest type entry is more than enough in our case, because what it does is it sets the stage of a quest to the value we give and that is luckily also the simplest way of running a one-off script, by attaching a result script to a quest stage.

 

So, we're basically ready to make your perk, I've mentioned everything we're going to need: the base object of the helmet itself, the quest with the stage that adds the helmet to the player, and the perk (or trait) that the player can pick.

 

I started by making the helmet, because it'll need to exist when writing the script later on. I opened the T51b helmet just changed the ID to ddBucket and saved it as a new form. (I had to later edit it again, to untick the Power Armor box, but it shouldn't be a problem for you, assuming you made a regular helmet.)

 

Then I made a new Quest. Set the ID to ddBucketPerkScript and the priority to 100 (just a habit, I set all my scripts to 100, you can set it to whatever). Then I saved the Quest, opened it again and added a new stage under the "Quest Stages" tab with the index of 10 and added an empty log entry. The log entry is where we can add a result script which runs when the quest's stage is set to the corresponding index.

The result script is really simple, we don't even need to find a blocktype for it or anything, just type in the functions that equip the helmet:

PlayerRef.AddItem ddBucket 1     ;First, the player has to actually have the item in their inventory.
PlayerRef.EquipItem ddBucket 1 1 ;Then we can equip it.

Then I made a Perk. I gave it the ddBucketPerk ID and named it "Social Anxiety". We need to check the Playable box to make it appear in the game and do the same with the Trait box if you want it to appear after Doc Mitchell's Rorschach test as a trait. Also, make sure to set the Level to anything other than 0, usually this is the level required to pick the perk, but in our case the perk is a trait, hence it only makes sense to set it to 1.

Last, we add an entry to the perk, choose the Quest type, select the quest named ddBucketPerkScript from the drop-down menu, set the stage to 10, save it and we're done.

 

I tested it in-game with the ShowTraitMenu command in the console, and it worked for me.

Edited by daliawithoutanh
Link to comment
Share on other sites

You're welcome dudeapocalypse. Your advice was fine, too, it's just I personally find Actor Effects, Base Effects, Abilities and their friends a bit redundant, and I thought using a quest might be simpler for the OP, I'm looking forward to hearing from him how he decided to do it.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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