The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
NPCS - Town stones
Author Message
Soulless
Super Moderator
****

Posts: 335
Likes Given: 29
Likes Received: 49 in 27 posts
Joined: Jun 2012
Reputation: 12

Ye Olde Sphere

Post: #15
RE: NPCS - Town stones
Deal! i need a proper system for the faction guards and smarter npcs.

Here is teh bulk of the system, the omitted stuff is the defs and some of it is cosmetic stuff, like the story line and npcs and such. but you can see from this, its just a simple system that has both the factions vie for control over towns. the guards attack each other and players who are members of the opposite faction.


Code:
[dialog d_faction_selection]
50, 50
nomove
noclose
page 0
resizepic 85 15 5054 455 455
gumppic 35 -5 10440 99
gumppic 508 -5 10441 38

page 1
resizepic  220 19 2620 184 37
resizepic  225 25 3000 175 25
resizepic  325 190 5054 150 195
resizepic  160 190 5054 150 195
dtext 250 25 100 Race Selection Menu
dhtmlgump 100 60 430 125 0 1 Welcome, <src.name>. On this server you will select a race for your character, certain aspects and abilities your character may have will be affected by this decision. The races are split into two seperate factions, <def0.faction_1_name> and <def0.faction_2_name>, the factions are at war with each other. They freely and openly have combat with each other through out the realm.  This is an irreversible property once selected, so please ensure the race you decide upon is one you will continue to enjoy as you play. Below are the current available races, click on one to view that races specific details.

for 1 8
dtext 180 201 063 <def0.faction_1_name>
dtext 350 201 026 <def0.faction_2_name>
if (<def0.race_<eval <local._for>>_faction>==1)
local.good_races += 1
else (<def0.race_<eval <local._for>>_faction>==2)
local.evil_races += 1
endif
button <eval (170*<def0.race_<eval <local._for>>_faction>)> <eval (210+(20*((<local._for>)-<local.<qval (<def0.race_<eval <local._for>>_faction>==1)?evil:good>_races>)))> 1209 1210 1 0 <eval (<local._for>+1)>
dtext <eval ((190-<qval <def0.race_<eval <local._for>>_faction>==2?10:0>)*<def0.race_<eval <local._for>>_faction>)> <eval (206+(20*((<local._for>)-<local.<qval (<def0.race_<eval <local._for>>_faction>==1)?evil:good>_races>)))> 1152 <def0.race_<eval <local._for>>>
endfor

[dialog d_faction_selection button]
onbutton=0
src.dialogclose d_faction_selection
src.sdialog d_faction_selection

onbutton=1,9999
src.dialogclose d_faction_selection
src.sdialog d_race_detail <eval (<argn>-1)>

[dialog d_race_detail]
50, 50
nomove
noclose
page 0
resizepic 85 15 5054 455 455
gumppic 35 -5 10440 <qval (<def0.race_<eval <argn1>>_faction>==1)?99:38>
gumppic 508 -5 10441 <qval (<def0.race_<eval <argn1>>_faction>==1)?99:38>

page <argn1>

resizepic  220 19 2620 184 37
resizepic  225 25 3000 175 25

dtext 250 25 <qval (<def0.race_<eval <argn1>>_faction>==1)?063:026> <def0.race_<argn1>> Overview //100 <def0.race_<argn1>> Overview

gumppic 100 65 2224
dtext 120 62 <qval (<def0.race_<eval <argn1>>_faction>==1)?063:026> Description
dhtmlgump 100 80 215 300 0 1    <def0.<def0.race_<argn1>>_description>

gumppic 320 65 2224
dtext 340 62 <qval (<def0.race_<eval <argn1>>_faction>==1)?063:026> Racial Traits
dhtmlgump 320 80 215 300 0 1    <def0.<def0.race_<argn1>>_traits>

button 310 428 210 211 1 0 <eval <argn1>+1>
dtext 335 426 <qval (<def0.race_<eval <argn1>>_faction>==1)?063:026> I wish to become a <def0.race_<argn1>>
button 95 428 210 211 1 0 1
dtext 120 426 <qval (<def0.race_<eval <argn1>>_faction>==1)?063:026> Main Menu

[dialog d_race_detail button]
onbutton=0
src.dialogclose d_race_detail
src.dialog d_faction_selection

onbutton=1
src.dialogclose d_race_detail
src.sdialog d_faction_selection

onbutton=2,9999
src.dialogclose d_race_detail
src.sysmessage @0482 You have selected the <def0.race_<eval (<argn1>-1)>> race, congratulations!
src.tag0.faction=<eval <def0.race_<eval (<argn1>-1)>_faction>>
src.tag0.race=<eval (<argn1>-1)>
src.tag.name.suffix " the <def0.race_<eval (<argn1>-1)>>"
src.events=+e_race

if !(<var0.faction1>)
serv.newitem i_town_stone
new.p=5376 1086
new.name <def0.faction_1_name>
new.color 063
new.update
var.faction1=<new.uid>
endif
if !(<var0.faction2>)
serv.newitem i_town_stone
new.p=5376 1085
new.name <def0.faction_2_name>
new.color 026
new.update
var.faction2=<new.uid>
endif

ref1=<var0.faction1>        //make sure to remove the character from either faction if he's a part of either one...
ref2=<var0.faction2>
ref1.resign <src.uid>
ref2.resign <src.uid>
ref<eval <def0.race_<eval (<argn1>-1)>_faction>>.JoinAsMember <src.uid>        //add player to correct faction
ref1.declarewar <ref2.uid>        //make sure both factions are at war with each other
ref2.declarewar <ref1.uid>

[itemdef i_town_sigil]
id=i_virtstone_7
name=Town Sigil
type=t_sign_gump

on=@create
attr=attr_move_never
timerf 1,setup_new_sigil

on=@click
message @<qval <src.tag0.faction>==<tag0.factioncontrol>?044:02b> <region.name> Sigil [<def0.faction_<eval <tag0.factioncontrol>>_name>] [<qval <tag0.corrupting>?Corrupt:Pure>]
return 1

on=@dclick

if (<src.flags>&statf_dead)
src.sysmessage Your ghostly hand passes through the object.
return 1
endif

if (<src.distance <uid>>>3)
src.sysmessage You can't reach that.
return 1
endif


if (<tag0.factioncontrol>==<src.tag0.faction>) && !(<tag0.corrupting>)
message Your faction already has total control over this sigil.
return 1
endif

if (<tag0.factioncontrol>==<src.tag0.faction>) && (<tag0.corrupting>)
serv.allclients faction_announcement,<src.tag0.faction>,The <def0.faction_<eval <src.tag0.faction>>_name> has purified the <region.name> sigil.
tag0.corrupting=
more1=
timer=
return 1
endif

if (<tag0.factioncontrol>!=<src.tag0.faction>) && (<tag0.corrupting>==<src.tag0.faction>)
message Your faction is already in the process of corrupting this sigil.
return 1
endif

if (<tag0.factioncontrol>!=<src.tag0.faction>)
serv.allclients faction_announcement,<src.tag0.faction>,The <src.name> is corrupting the <region.name> sigil.
tag0.corrupting=<src.tag0.faction>
more1=<eval (60*<def0.corrupt_time>)>
timer=1
return 1
endif

on=@timer
if (<tag0.corrupting>) && (<more1>)
if (<more1><=10)
say @023 <eval <more1>>
elseif (<more1>==60) || (<more1>==120) || (<more1>==180) || (<more1>==240) || (<more1>==300)
serv.allclients faction_announcement,<tag0.corrupting>,The <def0.faction_<eval <tag0.corrupting>>_name> will control <region.name> in <eval (<more1>/60)> minutes.
endif
more1 -= 1
timer 1
return 1
endif
if (<tag0.corrupting>)
tag0.factioncontrol=<tag0.corrupting>
var0.<region.name>_control=<tag0.factioncontrol>
serv.allclients faction_announcement,<tag0.factioncontrol>,The <def0.faction_<eval <tag0.factioncontrol>>_name> now controls <region.name>.
color=<def0.faction_<eval <tag0.factioncontrol>>_color>
link.color=<def0.faction_<eval <tag0.factioncontrol>>_color2>
tag0.corrupting=
return 1
endif


[function faction_announcement]
sysmessage @<qval <tag0.faction>==<argv[0]>?044:02b> <argv[1]>

[function setup_new_sigil]
serv.newitem i_sigil_Pedistal
new.p=<p>
nudgeup 18
link=<new.uid>


[itemdef i_sigil_pedistal]
id=i_gravestone_17
name=Sigil Pedistal
type=t_spawn_char

on=@click
message @<qval <var0.<region.name>_control>==<src.tag0.faction>?044:02b> <region.name> Sigil Pedistal
return 1

on=@create
attr=attr_move_never
amount=<def0.sigil_guards>
more spawn_faction_guards
morep 1 5 10
timer=1

on=@dclick
if (<var0.<region.name>_control>==<src.tag0.faction>)
src.dialog d_faction_menu
return 1
else
message Your faction does not control this region, you can not use this!
return 1
endif

Guard Stuff
Code:
[events e_faction_guards]

on=@click
adjust_guard_noto
//adjust_guard_outfit

on=@npcseenewplayer
adjust_guard_noto
adjust_guard_outfit
attack_enemies

on=@npclookatchar
adjust_guard_noto
adjust_guard_outfit
//attack_enemies

[function spawn_faction_guard]
serv.newnpc { c_faction_knight 1 c_faction_spearman 1 c_faction_bowman 1 c_faction_mage 1 }
new.adjust_guard_outfit
new.p=<p>

[function adjust_guard_outfit]
local.layer=0
while <local.layer><=24
if (<local.layer>==21) || (<local.layer>==16) || (<local.layer>==11)
local.layer += 1
else
if (<findlayer.<local.layer>.type>==t_armor) || (<findlayer.<local.layer>.type>==t_armor_Leather) || (<findlayer.<local.layer>.type>==t_shield)
findlayer.<local.layer>.color <def0.faction_<eval <var0.<region.name>_control>>_color>
elseif (<findlayer.<local.layer>.type>==t_clothing)
findlayer.<local.layer>.color <def0.faction_<eval <var0.<region.name>_control>>_color2>
endif
local.layer += 1
endif
endwhile
findlayer.25.color <def0.faction_<eval <var0.<region.name>_control>>_color2>

[function adjust_guard_noto]
if (<src.tag0.faction>!=<var0.<region.name>_control>)
tag0.override.noto.<src.uid>=5
else
tag0.override.noto.<src.uid>=
endif

[function attack_enemies]
if (<src.tag0.faction>!=<var0.<region.name>_control>) && (<src.isplayer>)
serv.log attack
endif


[spawn 99999]
defname=spawn_faction_guards
category=Spawn Groups
subsection=Factions
description=Faction Guards
id=c_faction_knight
id=c_faction_bowman
id=c_faction_spearman
id=c_faction_mage
07-12-2012 06:15 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Messages In This Thread
NPCS - Town stones - Soulless - 07-11-2012, 07:32 AM
RE: NPCS - Town stones - Skul - 07-11-2012, 08:09 AM
RE: NPCS - Town stones - Anarch Cassius - 07-11-2012, 08:17 AM
RE: NPCS - Town stones - Skul - 07-11-2012, 08:44 AM
RE: NPCS - Town stones - RanXerox - 07-11-2012, 08:56 AM
RE: NPCS - Town stones - Skul - 07-11-2012, 09:11 AM
RE: NPCS - Town stones - RanXerox - 07-11-2012, 09:24 AM
RE: NPCS - Town stones - Extreme - 07-11-2012, 09:33 AM
RE: NPCS - Town stones - Soulless - 07-11-2012, 03:35 PM
RE: NPCS - Town stones - Soulless - 07-12-2012, 10:37 AM
RE: NPCS - Town stones - Extreme - 07-12-2012, 10:45 AM
RE: NPCS - Town stones - Anarch Cassius - 07-12-2012, 11:55 AM
RE: NPCS - Town stones - Soulless - 07-12-2012, 12:14 PM
RE: NPCS - Town stones - Anarch Cassius - 07-12-2012, 01:02 PM
RE: NPCS - Town stones - Soulless - 07-12-2012 06:15 PM
RE: NPCS - Town stones - darksun84 - 07-12-2012, 07:57 PM
RE: NPCS - Town stones - Soulless - 07-12-2012, 08:33 PM
RE: NPCS - Town stones - Soulless - 07-13-2012, 02:15 AM
RE: NPCS - Town stones - Anarch Cassius - 07-13-2012, 02:14 PM
RE: NPCS - Town stones - Soulless - 07-13-2012, 02:21 PM
RE: NPCS - Town stones - Anarch Cassius - 07-13-2012, 02:24 PM
RE: NPCS - Town stones - Soulless - 07-13-2012, 03:08 PM
RE: NPCS - Town stones - Anarch Cassius - 07-13-2012, 03:28 PM
RE: NPCS - Town stones - RanXerox - 07-13-2012, 03:29 PM
RE: NPCS - Town stones - Anarch Cassius - 07-19-2012, 01:11 PM
RE: NPCS - Town stones - Soulless - 07-26-2012, 12:33 AM

Forum Jump:


User(s) browsing this thread: 4 Guest(s)