On Item Aquire Script Request
#1
Posté 07 novembre 2012 - 02:01
What I am requesting is a module On Acquire Item script that fires every time a PC acquires a 'magic' item.
Check to see if the magic item has variable 'v_itemvariable'.
If the magic item does not have the variable, then apply the variable'v_itemvariable' to it AND apply 1 of 11 item property sets to it with the name of the set put in the description of the item.
i.e. Player acquires Longsword +1. Once the player picks up the item, the item recieves v_variable and added property set 4 (random of 1 out of 11 rolled a 4). Set 4 is named: Ice & Fire and is +1 save vs. cold/fire. So the Longsword +1, once acquired, becomes Longsword +1 with the item properties of +1 save vs. cold, +1 save vs. fire and it's description simply says 'Ice & Fire'.
I don't need a full 11 sets typed out, just 3 will be fine, I can expand it myself.
#2
Posté 08 novembre 2012 - 03:22
#3
Posté 08 novembre 2012 - 06:18
Regards
#4
Posté 08 novembre 2012 - 11:10
It's one of my next big 'to dos'. Amazing how fast that list grows and then shrinks each night. I'll probably take a look at your scripts, Kaldor, thanks!
I'm actually wanting the variable to be 'not found' and then applied it and stick to the item so each time the item is acquired, it sees that the variable is already there and doesn't apply the IPs again, but I can probably juggle the script some. Isn't that what we do when we are low lvl scripters? Chop, juggle and paste!!
Modifié par Masiquer, 08 novembre 2012 - 11:13 .
#5
Posté 27 décembre 2012 - 08:08
Masiquer wrote...
I've spent a good deal of time self learning basic scripting stuffs and on occasion I get something working, but I'm struggling with this one. I imagine it'd be easy for someone who knows a lot more than I do about scripting.
What I am requesting is a module On Acquire Item script that fires every time a PC acquires a 'magic' item.
Check to see if the magic item has variable 'v_itemvariable'.
If the magic item does not have the variable, then apply the variable'v_itemvariable' to it AND apply 1 of 11 item property sets to it with the name of the set put in the description of the item.
i.e. Player acquires Longsword +1. Once the player picks up the item, the item recieves v_variable and added property set 4 (random of 1 out of 11 rolled a 4). Set 4 is named: Ice & Fire and is +1 save vs. cold/fire. So the Longsword +1, once acquired, becomes Longsword +1 with the item properties of +1 save vs. cold, +1 save vs. fire and it's description simply says 'Ice & Fire'.
I don't need a full 11 sets typed out, just 3 will be fine, I can expand it myself.
Well, here's 1. Have fun!
// x2_mod_def_aqu
/*
Description
This script will replace your "on aquire" script
it lists below the added-in stuff to allow for your
edits
*/
// Edited by Darin LaSota, 12/27/2012
//::///////////////////////////////////////////////
//:: Example XP2 OnItemAcquireScript
//:: x2_mod_def_aqu
//:: © 2003 Bioware Corp.
//:://////////////////////////////////////////////
/*
Put into: OnItemAcquire Event
*/
//:://////////////////////////////////////////////
//:: Created By: Georg Zoeller
//:: Created On: 2003-07-16
//:://////////////////////////////////////////////
#include "x2_inc_switches"
void main()
{
object oItem = GetModuleItemAcquired();
// *** Begin Item Property Stuff ***
// only apply if it hasn't been applied yet (first set) and if it has an item property (second set)
if( (GetLocalInt(oItem,"v_itemvariable")==0) && (GetIsItemPropertyValid(GetFirstItemProperty(oItem))) )
{
//this is a reserved area, in case you want
//to check for a specific item property
int nCheck;
// run whatever check you'd like, with the following in it:
nCheck == 1;
if(nCheck==1)
{
int nVar = Random(11)+1; //Random allows 0, max is 1 higher
switch (nVar)
{
case 1: //blank for you, see case 4)
break;
case 2:
break;
case 3:
break;
case 4: //your example
//Save Bonuses:
AddItemProperty(DURATION_TYPE_PERMANENT, ItemPropertyBonusSavingThrowVsX(IP_CONST_SAVEVS_FIRE,1),oItem);
AddItemProperty(DURATION_TYPE_PERMANENT, ItemPropertyBonusSavingThrowVsX(IP_CONST_SAVEVS_COLD,1),oItem);
//Rename and redescribe. You can use get functions to include the original desc, etc.
SetFirstName(oItem,"Fire & Ice");
SetDescription(oItem,"Fire & Ice");
break;
case 5:
break;
case 6:
break;
case 7:
break;
case 8:
break;
case 9:
break;
case 10:
break;
case 11:
break;
}
SetLocalInt(oItem,"v_itemvariable",nVar); //sets the variable on the item so we know
}
}
// ** End Item Property Stuff ***
Modifié par EpicFetus, 27 décembre 2012 - 08:14 .





Retour en haut






