Help with NPC please.

The place to discuss scripting and game modifications for X Rebirth.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

User avatar
alexalsp
Posts: 1896
Joined: Fri, 18. Jul 14, 05:28
x4

Help with NPC please.

Post by alexalsp »

Help me please.

How by the menu add to the skunk, NPC?

For example: Architect, captain, defense officer, and etc..

Menu -> Add captain

In the skunk will appear captain of the player.
-Skipp-
Posts: 94
Joined: Tue, 7. Oct 14, 10:18
x4

Post by -Skipp- »

If I understood - you want to add crewe to your capitals right?

1. get the crew. Either dock to find them, or just call them out from space. Make sure to find the best crew you can. Captain with 5 star in navigation, Engineer with 5 stars in engineering and also a 5 star defence officer (the relevant stats are bolded out)

2. Once you find them - hire them and get them onboard the Skunk

3. Drive over to your capital and dock onto it

4. open the menu and call your crewe remotely

5. tell them to "Work here"

And you're done :D
User avatar
alexalsp
Posts: 1896
Joined: Fri, 18. Jul 14, 05:28
x4

Post by alexalsp »

No.

I want, by sub-menu, add the NPC, to the skunk, for their further appointment to the station and the ships if necessary.

For example.

You are in malstrime, you captured the ship, but fly to other systems far.

Select the menu -> Add to Skunk -> Captain.

and in the cabin will appear the chosen NPC.

How assign and recruit crew, I know :D

I need md script))
UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader »

Code: Select all

<create_platform_actor dockingbay type >
  <owner exact />
  <select *** />
  <skills>
    <skill type exact />
  </skills>
</create_platform_actor>
not sure what select must have to work, but it determies the look of the actor. for the rest i just listed all needed attributes without value..

dockingbay is in this case either player.primaryship or, if that doesnt work, try to get the skunks back romm into a var first and use that as dockingbay.
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)
User avatar
alexalsp
Posts: 1896
Joined: Fri, 18. Jul 14, 05:28
x4

Post by alexalsp »

I tried that.

Code: Select all


<cue name="alexalsp_Commander">
	  <conditions>
		<event_cue_signalled/>
      </conditions>
	  <actions>
 
	 <create_cue_actor name="$Commander" type="entitytype.commander" cue="this" ref="trader_omicron_lyrae_random" >
              <skills>
                <skill type="boarding" min="5" max="5" />
                <skill type="combat" min="5" max="5" />
                <skill type="engineering" min="2" max="5" />
                <skill type="leadership" min="5" max="5" />
                <skill type="management" min="1" max="4" />
                <skill type="morale" min="5" max="5" />
                <skill type="navigation" min="5" max="5" />
                <skill type="science" min="5" max="5" />
              </skills>
            </create_cue_actor>

  	<set_entity_type entity="$Commander" type="entitytype.commander"/>
           <set_owner object="$Commander" faction="faction.player"/>
          <add_actor_to_playership actor="$Commander"/>

 	   </actions>
        </cue>


But the NPC without options.

http://prntscr.com/9zuu2p
UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader »

there is a difference between <create_cue_actor/> and <create_platform_actor/> - the former doesnt trigger <event_platform_actor_created/> (obviously) - and the creation of the actor dialogue tree is bound to this event.

Not sure if there are further differences but i think cue actors dont trigger this because they are supposed to be given an individual dialogue tree in the Mission, and Platform Actors are mission-independent so have to signal for the regular dialogue tree on creation.
Last edited by UniTrader on Sat, 6. Feb 16, 22:04, edited 1 time in total.
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)
pref
Posts: 5625
Joined: Sat, 10. Nov 12, 17:55
x4

Post by pref »

Try starting their scripts and see if that helps. See PM.
User avatar
YorrickVander
Posts: 2774
Joined: Tue, 29. Oct 13, 21:59
x4

Post by YorrickVander »

This is how I spawned my npc trader for the old Shady Slater mod :

Code: Select all

          <create_cue_actor cue="this" name="$actor" macro="character_ar_male_shadyslater_macro">
            <name name="'Shady Slater'"/>
            <select faction="faction.heartofalbion" tags="tag.shadyguy"/>
            <owner exact="faction.heartofalbion"/>
          </create_cue_actor>
          <set_entity_type entity="$actor" type="entitytype.shadyguy"/>

          <add_actor_to_playership actor="$actor" />
The mod has been discontinued for some time so I have no idea if it will still work in 3.61/4.00

EDIT :
As uni pointed out <create_platform_actor is probably the way to go for staff that will be assigned elsewhere. There was also a change in the way <create_cue_actor funtioned some time ago.
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.
User avatar
Marvin Martian
Posts: 3617
Joined: Sun, 8. Apr 12, 09:40
x4

Post by Marvin Martian »

without <event_platform_actor_created /> the convarsationoptions will not assigend to the NPC it looks like

maybe it will help to trigger the code by

Code: Select all

<signal_cue_instantly cue="OnPlatformPopulation_Staff" param="[$actor, $fee]"/>
User avatar
alexalsp
Posts: 1896
Joined: Fri, 18. Jul 14, 05:28
x4

Post by alexalsp »

I have tried the all the variants, as a result of this:


http://prntscr.com/9zuu2p

:cry:
Infector
Posts: 145
Joined: Thu, 30. Dec 04, 15:26
xr

Post by Infector »

by looking into my save games:

i think you'll need to set this flag: customconversation="1"
User avatar
YorrickVander
Posts: 2774
Joined: Tue, 29. Oct 13, 21:59
x4

Post by YorrickVander »

In case it helps, I also used this sub cue when creating shady

Code: Select all

</actions>

      <cues>
        <!-- Start handler for default conversation -->
        <cue name="DefaultComm" instantiate="false">
          <conditions>
            <check_any>
              <event_conversation_started actor="$actor" />
              <event_conversation_returned_to_section actor="$actor" />
            </check_any>
            <check_value value="event.param == 'default'" />
          </conditions>
          <actions>
            <do_if value="event.name == 'event_conversation_started'">
              <debug_text text="'Itemtrader conversation started: %1, actor=%2, %3'.[event.param, event.object, event.object.knownname]" />
              <set_conversation_return_section section="g_goodbye" />
            </do_if>
            <do_else>
              <add_conversation_view view="facecopilot" comment="Hide detail monitor" />
            </do_else>
            <add_player_choice_sub text="readtext.{1002}.{12001}" section="cItemtrader_wares" position="top_left" choiceparam="[0, 0, $actor, 'inventory', $WareList]" baseparam="event.param2" />

            <add_player_choice_sub text="{1002,3004}" section="g_FireShady" position="bottom_left" comment="You\'re fired!"/>

            <add_player_choice_sub text="{1002,12008}" comment="Where can I find ...?" section="g_askforway" position="top_right" baseparam="event.param2" />

            <add_player_choice_return text="{1002,2}" position="bottom_right" comment="Goodbye"/>

            <reset_cue cue="this" />
          </actions>
        </cue>
again, no idea what will be the result for assigning a staff npc after creating the convoa this way will be.
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.
User avatar
Marvin Martian
Posts: 3617
Joined: Sun, 8. Apr 12, 09:40
x4

Post by Marvin Martian »

alexalsp wrote:I have tried the all the variants, as a result of this:
then use <create_platform_actor > this may work
in case you can't use the skunk dock, search for a station anywhere and transfer them afterwards
User avatar
alexalsp
Posts: 1896
Joined: Fri, 18. Jul 14, 05:28
x4

Post by alexalsp »

Does not work unfortunately.
Clownmug
Posts: 419
Joined: Wed, 11. Dec 13, 02:39
x4

Post by Clownmug »

Try this, I use similar code in my random freeplay mod.

Code: Select all

<find_object_component name="$DockingBay" class="class.dockingbay" object="player.primaryship" />
<create_platform_actor name="$Actor" dockingbay="$DockingBay" type="entitytype.commander">
	<owner exact="faction.player"/>
	<select faction="faction.argongovernment" tags="tag.commander"/>
	<skills>
		<skill type="boarding" min="2" max="5" />
		<skill type="combat" min="2" max="5" />
		<skill type="engineering" min="2" max="5" />
		<skill type="leadership" min="2" max="5" />
		<skill type="management" min="2" max="5" />
		<skill type="morale" min="2" max="5" />
		<skill type="navigation" min="2" max="5" />
		<skill type="science" min="2" max="5" />
	</skills>
</create_platform_actor>
<add_actor_to_playership actor="$Actor"/>
User avatar
alexalsp
Posts: 1896
Joined: Fri, 18. Jul 14, 05:28
x4

Post by alexalsp »

Clownmug wrote:Try this, I use similar code in my random freeplay mod.

Code: Select all

<find_object_component name="$DockingBay" class="class.dockingbay" object="player.primaryship" />
<create_platform_actor name="$Actor" dockingbay="$DockingBay" type="entitytype.commander">
	<owner exact="faction.player"/>
	<select faction="faction.argongovernment" tags="tag.commander"/>
	<skills>
		<skill type="boarding" min="2" max="5" />
		<skill type="combat" min="2" max="5" />
		<skill type="engineering" min="2" max="5" />
		<skill type="leadership" min="2" max="5" />
		<skill type="management" min="2" max="5" />
		<skill type="morale" min="2" max="5" />
		<skill type="navigation" min="2" max="5" />
		<skill type="science" min="2" max="5" />
	</skills>
</create_platform_actor>
<add_actor_to_playership actor="$Actor"/>
Oh my God !!!

Many thanks, Clownmug

It works. I can now sleep a little bit. )))
I hope that option will work for all NPC.

Code: Select all


entitytype.commander, entitytype.engineer, entitytype.defencecontrol, entitytype.architect, entitytype.pilot, entitytype.engineer, entitytype.marine, entitytype.manager, entitytype.specialistagriculture, entitytype.specialistpowerstorage, entitytype.specialistfood, entitytype.specialistchemical, entitytype.specialistprecision, entitytype.specialistweapons, entitytype.specialistpharmaceuticals, entitytype.specialistmetals, entitytype.specialistgeophysics, entitytype.specialistsurfacesystems,  entitytype.specialistpowersupply, entitytype.specialistaquatics

http://prntscr.com/a07qqr

http://prntscr.com/a07rtj

http://prntscr.com/a080wf

http://prntscr.com/a081a9

http://prntscr.com/a082yk

:thumb_up: :star: :star: :star: :)


Also thanks to all who helped in this matter. :wink:
Clownmug
Posts: 419
Joined: Wed, 11. Dec 13, 02:39
x4

Post by Clownmug »

Yes, it should work with other entitytypes. For the tag though it depends on whether or not there's a character definition for the chosen faction.
User avatar
alexalsp
Posts: 1896
Joined: Fri, 18. Jul 14, 05:28
x4

Post by alexalsp »

Clownmug wrote:Yes, it should work with other entitytypes. For the tag though it depends on whether or not there's a character definition for the chosen faction.
Such a variant is possible?


Code: Select all

<select faction="faction.random" tags="tag.commander"/>

Code: Select all

faction.random
Clownmug
Posts: 419
Joined: Wed, 11. Dec 13, 02:39
x4

Post by Clownmug »

alexalsp wrote:
Clownmug wrote:Yes, it should work with other entitytypes. For the tag though it depends on whether or not there's a character definition for the chosen faction.
Such a variant is possible?


Code: Select all

<select faction="faction.random" tags="tag.commander"/>

Code: Select all

faction.random
No, but you could do something like this:

Code: Select all

<create_platform_actor name="$Actor" dockingbay="$DockingBay" type="entitytype.commander">
   <owner exact="faction.player"/>
   <select faction="[faction.plutarch,faction.heartofalbion,faction.argongovernment].random" tags="tag.commander"/>
</create_platform_actor>
or this:

Code: Select all

<set_value name="$Factions" exact="[faction.plutarch,faction.heartofalbion,faction.argongovernment]"/>
<create_platform_actor name="$Actor" dockingbay="$DockingBay" type="entitytype.commander">
   <owner exact="faction.player"/>
   <select faction="$Factions.random" tags="tag.commander"/>
</create_platform_actor>
User avatar
alexalsp
Posts: 1896
Joined: Fri, 18. Jul 14, 05:28
x4

Post by alexalsp »

Ok. Thank you.

I noticed, if use

Code: Select all

select faction="faction.random"
NPC generated different supplies.

The captain may be: NPC trader and etc. but have the status - Captain. ))

I will try your code.

:roll:

Return to “X Rebirth - Scripts and Modding”