Help ! Had what I thought was a great idea. Silly, but fun. I am trying to script a storyline in which a PC and a henchman put on a cow costume and attempt to sneak up on a dragon. I modified the x2_mod_def_equ , and saved it under a new name.
} // ED modifications to script 8-15-13
if(oItem == oOwner)
{
SetLocalInt(oPc,"Dragon",8);
DelayCommand(1.0,ExecuteScript(sScript,oPc));
}
The executed script is this.
void main()
{
object oPC = GetFirstPC();
object oHench = GetHenchman(oPC);
effect eMorph = EffectPolymorph(POLYMORPH_TYPE_COW,TRUE);
int nVol = TALKVOLUME_TALK;
int nSlot = INVENTORY_SLOT_CHEST;
if(GetIsObjectValid(GetHenchman(oPC)))
{
SetLocalInt(oPC,"Dragon",8);
AssignCommand(oHench,SetIsDestroyable(TRUE,TRUE,TRUE));
DestroyObject(oHench,1.0);
DelayCommand(2.0,ApplyEffectToObject(DURATION_TYPE_INSTANT,eMorph,oPC));
DelayCommand(4.0,AssignCommand(oPC,ActionSpeakString("Moooo!",nVol)));
}
else
{
AssignCommand(oPC,ActionUnequipItem(GetItemInSlot(nSlot,oPC)));
SendMessageToPC(oPC,"You need a henchman to equip this item.");
}
}
This works just fine. When the PC equips the item, the hench is destroyed and the PC morphs to cow.
I set some triggers along thier path. Tripping, talking,ect. They all work fine. It's the last trigger that is giving me the problem.
#include "x0_i0_position"
void main()
{
object oPC = GetFirstPC();
object oEnt = GetEnteringObject();
object oTrig = GetObjectByTag("LifeAsACow4");
object oPerv = GetObjectByTag("Farmer");
string sName = GetName(oPC,FALSE);
string sTemp = "farmer";
int nVol = TALKVOLUME_TALK;
int nVolb = TALKVOLUME_SHOUT;
int nType = OBJECT_TYPE_CREATURE;
int bUse = FALSE;
location lLoc = GetLocation(GetWaypointByTag("WpSpFarmer"));
location lAss = GetBehindLocation(oPC);
if(GetLocalInt(oPC,"MeetBoss") == 3)
{
DelayCommand(1.0,AssignCommand(oPerv,ActionMoveToObject(oPC,TRUE)));
DelayCommand(6.0,AssignCommand(oPerv,
ActionSpeakString("Oh Petunia! Where have you been?",nVol)));
DelayCommand(10.0,AssignCommand(oPerv,
ActionSpeakString("I've been looking all over for you.",nVol)));
DelayCommand(14.0,AssignCommand(oPerv,ActionMoveToLocation(lAss,FALSE)));
DelayCommand(17.0,AssignCommand(oPerv,ActionForceFollowObject(oPC,0.1)));
DelayCommand(20.0,AssignCommand(oPerv,ClearAllActions()));
DelayCommand(21.0,AssignCommand(oPerv,
ActionSpeakString("Hold still. I want to make love to you.",nVol)));
DelayCommand(25.0,AssignCommand(oPC,
ActionSpeakString("[Kreg]Huh? Oh no you don't!",nVolb)));
DelayCommand(28.0,AssignCommand(oPerv,
ActionSpeakString("A talking cow?.",nVol)));
DelayCommand(31.0,AssignCommand(oPerv,
ActionSpeakString("AHHHHHHHHHH!",nVolb)));
DelayCommand(34.0,AssignCommand(oPerv,ClearAllActions()));
DelayCommand(35.0,AssignCommand(oPerv,
ActionMoveAwayFromObject(oPC,TRUE,30.0)));
DelayCommand(38.0,AssignCommand(oPC,
ActionSpeakString("[Kreg] That was close!",nVol)));
DelayCommand(41.0,AssignCommand(oPC,
ActionSpeakString("["+sName+"]" + "Maybe for you.",nVolb)));
DestroyObject(oPerv,40.0);
DestroyObject(oTrig,42.0);
}
else
{
if(GetIsPC(oEnt))
{
if(GetLocalInt(oPC,"MeetBoss") == 2)
{
CreateObject(nType,sTemp,lLoc,bUse);
DelayCommand(3.0,SetLocalInt(oPC,"MeetBoss",3));
DelayCommand(5.0,ExecuteScript("cow_fun4",oPC));
}
}
}
}
It is a little longer but otherwise the same as the others. On testing it repeats and skips actions randomly. I commented out the include and command it uses. It made no difference. It's close, but not right.
The second problem I'm having is ending the polymorph. I set a trigger around the dragon and put the following script on enter.
void main()
{
object oPC = GetFirstPC();
object oEnt = GetEnteringObject();
object oTrig = GetObjectByTag("AttackDragon");
object oDragon = GetObjectByTag("Horticus");
int nVolT = TALKVOLUME_TALK;
int nVolW = TALKVOLUME_WHISPER;
int nVolS = TALKVOLUME_SHOUT;
int nDur = DURATION_TYPE_INSTANT;
string sName = GetName(oPC,FALSE);
string sScript = "attack_dragon";
effect eMorph = EffectPolymorph(POLYMORPH_TYPE_COW,FALSE);
effect eDispell = EffectDispelMagicAll(20);
object oBoss = GetObjectByTag("BossRance");
int nType = OBJECT_TYPE_CREATURE;
location lLoc = GetLocation(oPC);
string sTemp = "bossrance";
int bUse = FALSE;
if(GetLocalInt(oPC,"MeetBoss") == 5)//Equip weapons and armor, Attack Destroy Trigger
{
AssignCommand(oBoss,ActionEquipMostDamagingMelee());
DelayCommand(2.0,AssignCommand(oBoss,ActionEquipMostEffectiveArmor()));
DelayCommand(4.0,AssignCommand(oBoss,
ActionSpeakString("ATTACK!",nVolS)));
DelayCommand(5.0,AssignCommand(oBoss,ActionAttack(oDragon,FALSE)));
DelayCommand(5.0,AdjustReputation(oPC,oDragon,-100));
DelayCommand(7.0,AssignCommand(oDragon,ActionAttack(oPC,FALSE)));
}
else
{
if(GetLocalInt(oPC,"MeetBoss") == 4)//Spawn Kreg
{
CreateObject(nType,sTemp,lLoc,bUse);
DelayCommand(1.0,SetLocalInt(oPC,"MeetBoss",5));
DelayCommand(4.0,ExecuteScript(sScript,oPC));
}
else
{
if(GetIsPC(oEnt))//Clear all act, End Polymorph
{
if(GetLocalInt(oPC,"MeetBoss") == 3)
{
AssignCommand(oPC,ClearAllActions());
DelayCommand(1.0,SetLocalInt(oPC,"MeetBoss",4));
DelayCommand(2.0,AssignCommand(oPC,
ActionSpeakString("["+sName+"] Ready?",nVolW)));
DelayCommand(5.0,AssignCommand(oPC,
ActionSpeakString("[Kreg] Yup.",nVolW)));
DelayCommand(8.0,AssignCommand(oPC,
ActionSpeakString("["+sName+"] NOW!",nVolT)));
//DelayCommand(10.0,ApplyEffectToObject(nDur,eMorph,oPC,2.0));
DelayCommand(12.0,ApplyEffectToObject(nDur,eDispell,oPC));
DelayCommand(13.0,ExecuteScript(sScript,oPC));
}
}
}
}
}
I have tried applying effects, a second polymorph of short duration and dispell all. all the lines fire correctly except, there is no PC. Just the hench and the cow.
Silly I know, but if any of you could give this a read and let an old noob learn some new tricks, I would be most thankful.
Ed Venture