Author Topic: *Porting Device Help*  (Read 174 times)

Legacy_-SilentSoul-

  • Newbie
  • *
  • Posts: 26
  • Karma: +0/-0
*Porting Device Help*
« on: January 23, 2011, 08:56:25 pm »


               Hello folks, i am in need of an item that i can make and use for people to port back to OOC and perhaps other locations. However, i am not familiar with this kind of scripting, if you reply with help (Very appreciated) please reply with step by step instructions on how to make such an item.

Example :: An egg that you use and it has a few locations when used. You port to either location.

Thanks for any help!
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
*Porting Device Help*
« Reply #1 on: January 24, 2011, 05:09:57 am »


               If you only want an item to take you to one location and do nothing more, you only need one simple script. However if you want an item to take you to multiple locations then you will need to have your item script start a conversation and then the conversation will have the options to take you to different locations.

You seemed to suggest that you wanted and item that does multiple locations rather than just one so we'll go with that.

First lets get a couple of the easy things out of the way:

-Make an item(ie egg) and give it a unique tag.
-Go into the items properties and give it the property "Cast Spell, Unique Power Self Only". Then edit the uses per day that you want.
-Now you need to make a script and name it exactly, the tag of the item you just made. So if you gave your item the tag "egg_portal", then the name of your script will also be "egg_portal". And this is the script that you would use:

#include "x2_inc_switches"
void main()
{
int iEvent = GetUserDefinedItemEventNumber();
if (iEvent != X2_ITEM_EVENT_ACTIVATE) return;
object oPC = GetItemActivator();
AssignCommand(oPC, ActionStartConversation(oPC, "conv res ref gos here", TRUE));
}


So now you have an item and everytime someone activates it, the script with the same name as its tag will run. And in this case it will start the conversation that you put into the script ("conv res ref gos here").

Now you need to make your conversation. Not sure if you've done those before but basically you have the conversation greeting, something like..."Where would you like to go?". Followed by the players choices. And then on each of the player choices lines there is a tab for "ActionsTaken". In each of those tabs you will put a script that actually does the teleporting to the location you want the player to go. Those scripts might look something like so(and you can give these scripts whatever name you prefer):

void main()
{
object oPC = GetPCSpeaker();
object oWP = GetWaypointByTag("OOC_WAYPOINT");
AssignCommand(oPC, ActionJumpToObject(oWP));
}


Notice the script above will jump the player to a waypoint. That is just the method that I prefer. So you will want to put a waypoint at each of the locations that you want to be able to port to. And then for each script on each one of those player choices in the conversation, you will plug in the correct tag of that waypoint. I just put a made up one in the script above ("OOC_WAYPOINT").

That should do it. Hopefully I explained it well enough. If not don't hesitate to ask more questions.

Good luck.
               
               

               


                     Modifié par GhostOfGod, 24 janvier 2011 - 05:17 .