Random Generated events: Difference between revisions

From PSwiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 11: Line 11:
Example:
Example:
     <nowiki><time seconds="0">
     <nowiki><time seconds="0">
        <spawnnpc id="1" name="MelareSon" lastname="Berrol" race="1|4|12" invulnerable="yes" hp="400" mana="400" loot_category="22" locx="1" locy="1" locz="0" traits="4|5|22">
<spawnnpc id="1" race="0|1|2|3|5|6|7|9|10|11" invulnerable="yes" hp="400" mana="400" loot_category="22" locx="1" locy="1" locz="0">
          <inventory>
  <inventory>
            <item name="Small Battle Axe" location="righthand"/>
<item name="Small Battle Axe" location="righthand"/>
            <item name="Falchion" location="bulk1" quantity="65"/>
<item name="Falchion" location="bulk1" quantity="65"/>
            <item name="Chainmail Legs Armor" location="legs"/>
<item name="Chainmail Legs Armor" location="legs"/>
          </inventory>
  </inventory>
          <skills>
  <skills>
            <skill name="Sword" value="50"/>
<skill name="Sword" value="50"/>
          </skills>
  </skills>
          <stats str="80" agi="70" end="60" int="75" wil="55" cha="90"/>
  <stats str="80" agi="70" end="60" int="75" wil="55" cha="90"/>
          <kas>
  <kas>
            <ka name="Merchant" priority="1"/>
<ka name="Merchant" priority="1"/>
          </kas>
  </kas>
          <specifickas>
  <specifickas>
            <trigger trigger="greetings" response1="Hello" response2="How are you?"/>
<trigger trigger="greetings" response1="Hello" response2="How are you?"/>
          </specifickas>
  </specifickas>
          <merchant>
  <merchant>
            <category name="Weapons"/>
<category name="Weapons"/>
            <category name="Armor"/>
<category name="Armor"/>
          </merchant>
  </merchant>
          <factions>
  <factions>
            <faction name="orcs" value="50"/>
<faction name="orcs" value="50"/>
          </factions>
  </factions>
          <variables>
  <variables>
            <variable name="scale" value="1.5"/>
<variable name="scale" value="1.5"/>
          </variables>
  </variables>
           <npctype name="performer" parent="Fighter" >
           <npctype name="performer" parent="Fighter" >
              <behavior name="start_show" completion_decay="0" growth="0" initial="0">
  <behavior name="start_show" completion_decay="0" growth="0" initial="0">
                <emote cmd="/bow" />
<emote cmd="/bow" />
                <talk text="Welcome to my show" target="false" />
<talk text="Welcome to my show" target="false" />
                <busy/>
<busy/>
              </behavior>
  </behavior>
              <behavior name="show" completion_decay="0" growth="0" initial="0">
  <behavior name="show" completion_decay="0" growth="0" initial="0">
                <wait duration="30" anim="play" />
    <emote cmd="/greet" />
              </behavior>
<wait duration="30" anim="play" />
              <behavior name="showidle">
  </behavior>
                    <idle />
  <behavior name="showidle">
              </behavior>
<idle />
          </npctype>
  </behavior>
        </spawnnpc>
  </npctype>
        <spawnitem id="2" name="Long Bow" pickup="yes">
</spawnnpc>
          <location x="1" y="1" z="0"/>
<spawnitem id="2" name="Long Bow" pickup="yes">
        </spawnitem>
  <location x="1" y="1" z="0"/>
    </time>
</spawnitem>
    <time seconds="10">
</time>
        <trigger behavior="start_show" npc="1"/>
<time seconds="30">
    </time>
    <trigger behavior="start_show" npc="1"/>
    <time seconds="15">
</time>
        <trigger behavior="show" npc="1"/>
<time seconds="45">
    </time>
    <trigger behavior="show" npc="1"/>
    <time seconds="60">
</time>
        <trigger behavior="showidle" npc="1"/>
<time seconds="60">
    </time>
    <trigger behavior="showidle" npc="1"/>
    <time seconds="120">
</time>
        <destroy id="1"/>
<time seconds="70">
        <destroy id="2"/>
    <destroynpc id="1"/>
    </time></nowiki>
<destroyitem id="2"/>
<schedulenext/>
</time></nowiki>

Revision as of 19:03, 7 October 2020

A new capability has been added to PSUnreal about generating random events in the game.

Database structure:

  • random_events table

Scripting:

  • Prerequisites (random_events.prerequisite)
    • The same syntax of quest prerequisites can be used with the following additions:
      • <skillsinrange name="Sword" min="10" max="20" range="10"> (works as skill but checks all the players in range and sum up their skills). If the name is empty it sums up the total skills of all players in range.
  • Script for the event (random_events.script)

Example:

   <time seconds="0">
	<spawnnpc id="1" race="0|1|2|3|5|6|7|9|10|11" invulnerable="yes" hp="400" mana="400" loot_category="22" locx="1" locy="1" locz="0">
	  <inventory>
		 <item name="Small Battle Axe" location="righthand"/>
		 <item name="Falchion" location="bulk1" quantity="65"/>
		 <item name="Chainmail Legs Armor" location="legs"/>
	  </inventory>
	  <skills>
		 <skill name="Sword" value="50"/>
	  </skills>
	  <stats str="80" agi="70" end="60" int="75" wil="55" cha="90"/>
	  <kas>
		 <ka name="Merchant" priority="1"/>
	  </kas>
	  <specifickas>
		 <trigger trigger="greetings" response1="Hello" response2="How are you?"/>
	  </specifickas>
	  <merchant>
		<category name="Weapons"/>
		<category name="Armor"/>
	  </merchant>
	  <factions>
		<faction name="orcs" value="50"/>
	  </factions>
	  <variables>
		<variable name="scale" value="1.5"/>
	  </variables>
          <npctype name="performer" parent="Fighter" >
		  <behavior name="start_show" completion_decay="0" growth="0" initial="0">
			<emote cmd="/bow" />
			<talk text="Welcome to my show" target="false" />
			<busy/>
		  </behavior>
		  <behavior name="show" completion_decay="0" growth="0" initial="0">
		    <emote cmd="/greet" />
			<wait duration="30" anim="play" />
		   </behavior>
		   <behavior name="showidle">
				<idle />
		   </behavior>
	   </npctype>
	</spawnnpc>
	<spawnitem id="2" name="Long Bow" pickup="yes">
	   <location x="1" y="1" z="0"/>
	</spawnitem>
</time>
<time seconds="30">
     <trigger behavior="start_show" npc="1"/>
</time>
<time seconds="45">
     <trigger behavior="show" npc="1"/>
</time>
<time seconds="60">
     <trigger behavior="showidle" npc="1"/>
</time>
<time seconds="70">
    <destroynpc id="1"/>
	<destroyitem id="2"/>
	<schedulenext/>
</time>