Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Basic Faction System


Richy420Rich
 Share

Recommended Posts

-Known to work for EO 2.0 and EO 3.0

Well here's something simple I took on out of boredom..

It allows a class selection for an NPC to determine which class that certain NPC would follow (Going by player classes), selected NPC's won't attack same class players, nor can the players of that class attack that NPC. Only down part is that there's no multiple class selection, but it could be used as a base - This is working for me.

Difficulty - 5/5

Client & Server Side

modTypes - NpcRec (On the bottom)

```

Faction As Byte

```

Server Side

modCombat - CanPlayerAttackNpc

Add this inside all the other checks;

```

If Npc(MapNpc(mapNum).Npc(mapNpcNum).Num).Faction = GetPlayerClass(attacker) Then

Exit Function

End If

```

modServerLoop - UpdateMapLogic

The loop after ('make sure it's not stunned) The second IF statement, change it to this;

```

If GetPlayerMap(i) = mapNum And MapNpc(mapNum).Npc(x).target = 0 And GetPlayerAccess(i) <= ADMIN_MONITOR And Npc(npcNum).Faction <> GetPlayerClass(i) Then

```

Client Side

NPC Editor Form. Add a ComboBox. Name it CmbClass

Code for CmbClass;

```

Private Sub CmbClass_Click()

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

Npc(EditorIndex).Faction = CmbClass.ListIndex

' Error handler

Exit Sub

errorhandler:

HandleError "CmbClass_Click", "frmEditor_NPC", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

```

modGameEditors - NpcEditorInit

Add above finish populating;

```

' add the array to the combo

frmEditor_NPC.CmbClass.Clear

frmEditor_NPC.CmbClass.AddItem "None."

For i = 1 To Max_Classes

frmEditor_NPC.CmbClass.AddItem Class(i).Name

Next

```

Add under .txtDamage.text

```

.CmbClass.ListIndex = Npc(EditorIndex).Faction

```
Link to comment
Share on other sites

*hugs* I love you guys thanks I'll get this installed today sometime.

=== LATER THAT DAY IN THE GNOME CAVE===

must have not installed it correctly. End up getting a runtime error 9 when i attack any npcs and the npcs of my same class are still attacking me lol

=== Even Later===

Okay got it installed again, only thing is still getting an error when i attack but they are not attacking me I guess ill go look in server source to see whats going on lol

=== Even Later===

Got it working finally dont know what I did the first 2 times I tried to install it lol
Link to comment
Share on other sites

> Ah! You beat me to it. I had it all done, but didn't post a tutorial. Good work!

Yeah sorry for the package block, I was just bored and saw the request lol.

> does it work in 3.0

I tagged it with EO 2.0 because I'm not sure if the attack AI was different or not in the server loop for 2.3 or 3.0, that's the only reason why I limited it to EO 2.0\. I'll change the tag now that it works for 3.0.
Link to comment
Share on other sites

would be epic to see this grown, perhaphs into something that would allow folks to assign "faction-classes" to selected npc's (example: have a "zombies a" faction for a certain type of zombies) and to be able to gain or lose faction (and in turn be in higher or lower standing with whichever set of npc's the affected faction is set to effect ; "Your standing with Zombies-A has gotten better/Your standing with Zombies-A has gotten worse!").) - this would open the door to faction quests and so fourth. Would be cool to have

factions affect which mobs the player kills and which mobs try to kill the player (while still having some regular mobs/npcs which are associated with no faction and would operate as npcs do now without any faction on them set.)
Link to comment
Share on other sites

Thank you for this! I'm working on a City of Heroes/Champions like game and if/when (if I ever manage to get the project anywhere) I implement a Villain faction I'll be needing this badly as I'd love to have a "mixed/neutral" zone (something I always missed in CoH, apart from the social-only Pocket D there was no full-on PvP integration, like say if in World of Warcraft a Horde player strolled around Alliance territory then he was likely to be hunted down).
Link to comment
Share on other sites

This is best for Zombie Games , Me is making one i already have this installed .. take me 30 minutes , But mine is using Option Button not ComboBox , i guess i should update mine

Sorry for Comma's

Thank You! ![:D](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/biggrin.png)

Sherwin
Link to comment
Share on other sites

  • 2 weeks later...
Whenever I attack an NPC I get a variable undefined error on (attacker) in this line.

```

If NPC(MapNpc(mapNum).NPC(mapNpcNum).Num).Faction = GetPlayerClass(attacker) Then

```

I re-installed the tutorial several times but the error continues to pop up. Is there anything I'm missing?
Link to comment
Share on other sites

Are you sure you're putting that in the right place? What sub are you putting that into? At the top of the sub, do you have```
ByVal attacker As Long
```?

EDIT: If you're putting that in CanNpcAttackPlayer, then change attacker to index.
Link to comment
Share on other sites

  • 4 weeks later...
What if instead of a class selection you had just assigned a 'Faction Group' - with a number and name associated to it (example: "1 - Citizens of Shadewillow") and these could be assigned in character editor as like a checkbox (ie: Faction Group?) and if said checkbox is clicked you could adjust which faction group via a scrollbar, where you would create/edit faction groups could either be in a new form and/or some new commands (ie: "/createfaction factionnumber" - then it could say either "Okay, Name of Faction?" or "Name Invalid/In Use" and if you enter an appropriate faction name it could say (for example) "Faction (1) 'Citizens of Shadewillow' Created!". If you wanted to go a step even futher you could make it so that npcs of rival factions attack/kill each other on site - npc's without a faction can be nutral with any other npc as they are originally without any faction add-on. The tricky part would be setting diplomatic stances between the factions (one could just create custom /commands but in terms of this it could get messy - a form might be needed, I say if any of these ideas are implemented to have all "factions" nutral unless a enemyship is declared between any two factions.

Just some suggestions. I really dig this tutorial but i think it needs to be elaborated upon, even if it is supposed to be basic.

In any case - Excellent work. =]

**Edit: Below is included an example I created (it _isn't_ functional, just visual).)**

![](http://i1127.photobucket.com/albums/l632/EsoGuildPB/projected1_zps0ac82d6f.png)![](http://i1127.photobucket.com/albums/l632/EsoGuildPB/projected3_zps81b2e8ac.png)<- ("faction" frame as shown here - would would be in the npc editor)

![](http://i1127.photobucket.com/albums/l632/EsoGuildPB/proposedfaction_zps2464aae1.png)

(^^ Faction #4 indicates how a removed faction would look on the list. if this design is ever to be used it important to make sure the

list can still function even with the removed function - especially if said function to be removed has current engagements as an

enemy/ally of their own/another faction(s).
Link to comment
Share on other sites

I mean

> Add this inside all the other checks;

The most dont know what for checks…

> The loop after ('make sure it's not stunned) The second IF statement, change it to this;

Some dont know which… i putted it at first try false

Why do you not just write search

BLABLALBA

Under it put

BLABLA

Else is the tut/system easy and never 5/5 difficulty
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...