I'm also a bit rusty but something like so perhaps?
useable rope item script (tag_based):
#include "x2_inc_switches"
void main()
{
int iEvent = GetUserDefinedItemEventNumber();
if (iEvent != X2_ITEM_EVENT_ACTIVATE) return;
object oPC = GetItemActivator();
object oRopeItem = GetItemActivated();
//this is just example of int check. If player enters a trigger and an int
//named "TRIGGER_ENTER" is set TRUE:
int iEntered = GetLocalInt(oPC, "TRIGGER_ENTER");
if (iEntered)//if TRUE
{
//These are just example locations but you can define whatever locations
//you need to create the rope placeable at:
//location lRopeLoc = GetLocation(oPC);
location lRopeLoc = GetLocation(GetWaypointByTag("tag of waypoint here"));
object oRopePlace = CreateObject(OBJECT_TYPE_PLACEABLE, "rope res ref here", lRopeLoc);
string sName = GetName(oPC);
SetLocalString(oRopePlace, "USER", sName);
DestroyObject(oRopeItem, 0.1);
}
else
{
SendMessageToPC(oPC, "You are not at a valid location to use this item.");
}
}
and the placeable rope object (OnUsed) script:
void main()
{
object oPC = GetLastUsedBy();
string sName = GetName(oPC);
string sCheck = GetLocalString(OBJECT_SELF, "USER");
if (sName == sCheck)
{
object oDest = GetWaypointByTag("tag of destination wp");
if (GetIsObjectValid(oDest))
{
SetLocalInt(oPC, "TRIGGER_ENTER", FALSE);
AssignCommand(oPC, ActionJumpToObject(oDest));
CreateItemOnObject("res ref of rope item here", oPC);
DestroyObject(OBJECT_SELF, 1.0);//might need to mess with this delay
}
else
{
SendMessageToPC(oPC, "There is no valid destination.");
return;
}
}
else
{
SendMessageToPC(oPC, "This rope does not belong to you. You can not use it at this time.");
}
}
You will need to fill in some res refs and mess with the locations of the rope object and the destination but maybe this can get you started in the right direction. I probably forgot something since this is not tested.
Good Luck.
Modifié par GhostOfGod, 30 octobre 2012 - 02:10 .