i need to take a location stored as a string in a database and assign it to be an object that my script will then use to teleport to. because the script is still kinda long ill save time by saying the problems im reciving for compiling in the Destination function literaly its 3 lines that get the mismatch error but the other 3 lines are commented out because script editor was giving some other error when i went to save with the 3 mismatch error lines commented out
the script is as clean as it could get while still doing what i want it to while i still understand whats going on in it
Below you can find the script but it wont compile if i uncomment the real lines of code with // in front of them since those lines are getting mismatched type error.
#include "nw_i0_plot"
//start of no xp loss and no gp loss function
void ApplyPenalty(object oPC)
{
//start variables (by default all are 0)
int nXP = GetXP(oPC) - 0;//set the 0 to the amount xp you want to take
int nGP = 0;//set the 0 to the amount gold you want to take
SetLocalInt(GetModule(), "gp_penalty_on", 0);//set to 1 if you are going to take a penalty for gold else leave 0
SetLocalInt(GetModule(), "xp_penalty_on", 0);//set to 1 if you are going to take a penalty for xp else leave 0
//end variables
SetXP(oPC, nXP);
AssignCommand(oPC, TakeGoldFromCreature(nGP, oPC, TRUE));
//the script will do this if gold penalty and xp penalty are turned off
if (GetLocalInt(GetModule(), "gp_penalty_on")== 0 && GetLocalInt(GetModule(), "xp_penalty_on")== 0)
{FloatingTextStringOnCreature("You have respawned without gold loss and without experience loss", oPC, FALSE);}
//the script will do this if gold penalty is turned on and xp penalty is turned off
else if(GetLocalInt(GetModule(), "gp_penalty_on")== 1 && GetLocalInt(GetModule(), "xp_penalty_on")== 0)
{FloatingTextStringOnCreature("You have respawned with gold loss", oPC, FALSE);}
//the script will do this if xp penalty is turned on and gold penalty is turned off
else if(GetLocalInt(GetModule(), "xp_penalty_on")== 1 && GetLocalInt(GetModule(), "gp_penalty_on")== 0)
{FloatingTextStringOnCreature("You have respawned with experience loss", oPC, FALSE);}
//the script will do this if xp penalty is turned on and gold penalty is turned on
else if(GetLocalInt(GetModule(), "xp_penalty_on")== 1 && GetLocalInt(GetModule(), "gp_penalty_on")== 1)
{FloatingTextStringOnCreature("You have respawned with experience and gold loss", oPC, FALSE);}
}
//end of no xp loss and no gp loss function
//start how much hp to restore of respawn function
void Rez(object oPC)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oPC);
RemoveEffects(oPC);
//start of soul stone code that can be removed
do//while the player has the soul stone item
{
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oPC)), oPC);
DestroyObject(GetItemPossessedBy(oPC, "soulstoneitem"));
} while (GetItemPossessedBy(oPC, "soulstoneitem") != OBJECT_INVALID);
//end of soul stone code that can be removed
do//while the player does not have the soul stone item
{ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetCurrentHitPoints(oPC) + 1), oPC);}
while (GetItemPossessedBy(oPC, "soulstoneitem") == OBJECT_INVALID);
}//end how much hp to restore on respawn function
//start function that determines where the player respawns
void Destination(object oPC)
{
int hasrezshrine;//variable that can not be erased or script will break
object oPC;
object oTarget;
switch (GetLocalInt(GetArea(oPC), "hasrezshrine"))
{
//start case 0 (if the area DOES NOT have a rez shrine)
case 0:
//if there is a set bindpoint on the player rez at it
if(GetCampaignString("bindpointdatabase", "sBindPoint", oPC) != "")
//{oTarget = GetCampaignString("bindpointdatabase", "sBindPoint", oPC);}
//end if there is a set bindpoint on the player
//if there IS NOT a set bindpoint on the player
if (GetCampaignString("bindpointdatabase", "sBindPoint", oPC) == "")
{
//if there is a module default respawn point rez at it
if (GetIsObjectValid(GetWaypointByTag("NW_DEATH_TEMPLE")) == TRUE)
{oTarget = GetWaypointByTag("NW_DEATH_TEMPLE");}
//end if there is a module default respawn point
//if there IS NOT a module default respawn point rez where you are
//if (GetIsObjectValid(GetWaypointByTag("NW_DEATH_TEMPLE")) == FALSE)
//{oTarget = GetLocation(oPC);}
//end if there IS NOT a module default respawn point
}//end if there IS NOT a set bindpoint on the player
break;//end case 0 (if the area DOES NOT have a rez shrine)
//start case 1 (if the area DOES have a rez shrine)
case 1:
//if the player found a rez shrine
if (GetLocalInt(oPC, "foundrezshrine") == 1)
{oTarget = GetNearestObjectByTag("rezshrine");}
//end if the player found a rez shrine
//if the player DID NOT find rez shrine
if (GetLocalInt(oPC, "foundrezshrine") == 0)
{
//if there is a set bindpoint on the player rez at it
//if(GetCampaignString("bindpointdatabase", "sBindPoint", oPC) != "")
//{oTarget = GetCampaignString("bindpointdatabase", "sBindPoint", oPC);}
//end if there is a set bindpoint on the player
//if there IS NOT a set bindpoint on the player
if (GetCampaignString("bindpointdatabase", "sBindPoint", oPC) == "")
{
//if there is a module default respawn point rez at it
if (GetIsObjectValid(GetWaypointByTag("NW_DEATH_TEMPLE")) == TRUE)
{oTarget = GetWaypointByTag("NW_DEATH_TEMPLE");}
//end if there is a module default respawn point
//if there IS NOT a module default respawn point rez where you are
//if (GetIsObjectValid(GetWaypointByTag("NW_DEATH_TEMPLE")) == FALSE)
//{oTarget = GetLocation(oPC);}
//end if there IS NOT a module default respawn point
}//end if there IS NOT a set bindpoint on the player
}//end if the player DID NOT find rez shrine
break;//end case 1 (if the area DOES have a rez shrine)
}//end switch
}//end function that determines where the player respawns
void main()
{
object oPC = GetLastRespawnButtonPresser();
object oTarget;//the respawn point the script will pick
location lTarget;
Destination(oPC);//sets the respawn point to use
Rez(oPC);//rez and heals the player
//sets the respawn point chosen by the script as the destination to send the player to
lTarget = GetLocation(oTarget);
AssignCommand(oPC, ClearAllActions());
AssignCommand(oPC, ActionJumpToLocation(lTarget));
ApplyPenalty(oPC);//by bioware default it should remove gold and xp but i changed that
}
Modifié par Ryuhi2000, 05 avril 2011 - 11:55 .