Jumping to location
4BOLTMAIN
Member Posts: 90
I have a script that creates a corpse when a player dies and all the players gold is then placed on the corpse. This script is working as intended. I am trying to create a DM tool that allows me to jump to the first corpse found but it is not working. The code is pretty simple but maybe there is something I am missing.
This is the check to make the "Port to nearest corpse" conversation show but it doesn't show the conversation even though there is an object with the tag "deadbody" in an area.
This is the code to port me to the location of the corpse when I choose the option from the conversation but it doesnt port me anywhere. Obviously if the above code is not picking up the corpse then this port code will never work either.
This is the check to make the "Port to nearest corpse" conversation show but it doesn't show the conversation even though there is an object with the tag "deadbody" in an area.
#include "nw_i0_tool" int StartingConditional() { object oPC = GetPCSpeaker(); if (!GetIsObjectValid(GetNearestObjectByTag("deadbody", oPC))) return FALSE; return TRUE; }
This is the code to port me to the location of the corpse when I choose the option from the conversation but it doesnt port me anywhere. Obviously if the above code is not picking up the corpse then this port code will never work either.
void main() { object oPC = GetPCSpeaker(); object oCorpse = GetNearestObjectByTag("deadbody", oPC); location lLocation = GetLocation(oCorpse); ExecuteScript("randomportfx", oPC); AssignCommand( oPC, ClearAllActions( TRUE)); DelayCommand(1.00, AssignCommand(oPC, JumpToLocation(lLocation))); }
0
Comments
Even if there are objects in other areas, the game has no notion of how "near" one area is to another.
Your problem is really semantic - what do you mean exactly by "first corpse found"?
If any corpse will do, GetObjectByTag will work across areas. This is likely to be the oldest one.
This is not what my toolset says so I was assuming GetNearestObjectByTag() worked across all areas.
I used GetObjectByTag and now it works as intended. The first or second corpse doesn't matter because when I loot the gold the object is destroyed. Here is the working code.
On conversation check to show "Port to Corpse" option.
Then the actual port.