Jump to content

Simple additem script help


hadoumastery

Recommended Posts

It's very simple, I need to know what lines to add to a script to make it so when someone grabs a certain perk the item is given to them. (Much like the implant GRX from OWB except this will not have OWB in it) Pretty much I am trying to make it so if someone picks a trait that I have labeled TraitMedic, that this gun that heals people will be given to them.
Link to comment
Share on other sites

If you want to do it in a simple script,

 

scn PerkItemScript

BEGIN GameMode
If Player.HasPerk TF2Medic
	Player.Additem MedicGun 1
endif
END

 

and attach it to an always-enabled quest which runs the script every 15 seconds or so. But if you are an efficiency-hound and dislike using GameMode unless its absolutely necessary, you can create a new spell/ability and attach this to a new base effect which in turn point to a new effect script. Write something similar to the one below in the script.

 

scn PerkItemEffectScript

BEGIN ScriptEffectStart
Player.Additem MedicGun 1
END

 

Wow that was a mouthful. I hope I didn't confuse you! :biggrin:. Afterwards simply make the Perk point to the new ability.

Edited by Glenstorm
Link to comment
Share on other sites

Thanks! I am going to use the perk add script. But I do have a question if the quest runs every 15 seconds does that mean it will add a new one very 15 seconds? Because I'd like to be sure it only happens 1 time or only happens if they don't already have one.
Link to comment
Share on other sites

Thanks! I am going to use the perk add script. But I do have a question if the quest runs every 15 seconds does that mean it will add a new one very 15 seconds? Because I'd like to be sure it only happens 1 time or only happens if they don't already have one.

 

lol yeah my bad :sweat:. You should probably set up a variable like DoOnce to stop giving the player the item multiple times. You can also check whether the player already has the item using GetItemCount

Edited by Glenstorm
Link to comment
Share on other sites

Great, thanks! Ok, so I don't know how to set up the quest all that well, I attached it to a box that I added to GS doc mitchells house. Will it still work if someone finds the box? As in... will it still only give the item to a medic?
Link to comment
Share on other sites

Great, thanks! Ok, so I don't know how to set up the quest all that well, I attached it to a box that I added to GS doc mitchells house. Will it still work if someone finds the box? As in... will it still only give the item to a medic?

 

I haven't tried doing that though theoretically it should yield the same results as the quest script. The script will cease to run if you somehow delete that box though. No, since the script specifies "Player.Additem" in a gamemode script, it simply checks if the player has the perk and adds the item TO the player if it returns true. The box will remain a box and work as per normal. If you want to add it to the player when he/she activates the box (opens) then you need to specify it inside the OnActivate block.

Edited by Glenstorm
Link to comment
Share on other sites

So you want to have two ways for the player to acquire this gun?

 

1)Through perk

2)Through that box

 

if the above is true, you still need to attach the script to a quest (preferably. simply make a new quest --> start game enabled --> name it and attach the script to it. You need to make sure the script is a "Quest" script though. Also tick the script delay checkbox). Then simply place the ammo box in the house with the gun in it.

Link to comment
Share on other sites

No, I only want them to get it by the box. And if you're interested, I have the mod out right now, for testing purposes.

 

http://www.newvegasn...le.php?id=43235

 

So what's the purpose of the perk? Or do you want the box to appear when the player gets the perk?

 

EDIT: Since you already have the mod out, I take it you already got it up and running? In that case, good job!

Edited by Glenstorm
Link to comment
Share on other sites

  • Recently Browsing   0 members

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