Archived copy of war3source.com, the War3Source forum (2009–2020), rebuilt from the Internet Archive by wc3mods.net. This page was captured on 2012-09-22 (original capture). Forum · All archived topics · Wiki · Bug tracker · Blog
Chat

War3:Source
September 21, 2012, 09:41:00 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Download: http://war3source.com/index.php?board=9.0
What is War3Source?: http://war3source.com/index.php?topic=200.0
Sample Stats: http://war3source.com/war3stats
Steam Community Group: http://steamcommunity.com/groups/war3source
War3Source SVN Checkout: http://ownageclan.com/svn/war3source/
War3Source servers: http://www.game-monitor.com/search.php?vars=war3_version=
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: FactionBehavior ?  (Read 147 times)
-El Diablo
Full Member
***
Posts: 175


View Profile
« on: May 07, 2012, 07:02:10 AM »

Anyone know how this is used off hand?

enum FactionBehavior{
   ReturnValue=-1, //pass this to return the settings
   Neutral=0, //zero=default
   Friend,
   Enemy
}
Logged
Revan
Sr. Member
****
Posts: 263



View Profile
« Reply #1 on: May 12, 2012, 05:05:06 AM »

it is used by the faction system which you can use if you wan't(but need to implement by yourself)
example from a race by me:
Code:
public OnWar3PluginReady()
{
thisRaceID=War3_CreateNewRaceT("malak");
SKILL_HAUNTING=War3_AddRaceSkillT(thisRaceID,"HauntingPast",false,4);
SKILL_SIGHT=War3_AddRaceSkillT(thisRaceID,"Sight",false,4);
SKILL_VISION=War3_AddRaceSkillT(thisRaceID,"Vision",false,4);
ULTIMATE=War3_AddRaceSkillT(thisRaceID,"Wave",true,4);
War3_CreateRaceEnd(thisRaceID);
W3Faction(thisRaceID,"Priests",true);
}
As you see there is a "W3Faction" command to assign the race to the faction "Priests".
but you need to tell the system which factions are friends or foes by using something like this:

Code:
W3FactionBehaviorByName("Priests","Undead",FactionBehavior:Enemy);
W3FactionBehaviorByName("Priests","Humans",FactionBehavior:Friend);
W3FactionBehaviorByName("Priests","Elves",FactionBehavior:Neutral);

and NOW it get's intresting, there are tons of new possibilities like creating a skill which will act completly different when attacking a enemy faction than a friendly.
here's a very simple example:
Code:

new Float:fPercent = fHauntingPercent[skill];
switch(W3FactionCompare(thisRaceID,War3_GetRace(victim)))
{
case (FactionBehavior:Friend):
{
fPercent-=0.15;
}
case (FactionBehavior:Enemy):
{
fPercent+=0.15;
}
}
if(War3_DealDamage(victim,(iLastDamage*fPercent/100),attacker,DMG_GENERIC,"hauntingpast",W3DMGORIGIN_SKILL,W3DMGTYPE_MAGIC)) {
iLastDamageValue[victim] = -1;
return;
}
this will increase the damage agains enemy factions and decrease it when attacking a friendly faction
Logged

-El Diablo
Full Member
***
Posts: 175


View Profile
« Reply #2 on: May 14, 2012, 11:36:44 AM »

So, multiple races can not share the same faction name?


I can only guess that is what the categories are for?
Logged
Vulpone
Full Member
***
Posts: 140



View Profile Email
« Reply #3 on: May 14, 2012, 11:50:14 AM »

no

imagine it like this:
you have 4 factions: Ponies, Bronies, Homies and Lomies.

Now, these factions all behave differently against each other. like Ponies dont like Bronies, so:
W3FactionBehaviorByName("Ponies","Bronies",FactionBehavior:Enemy);

so you have defined those two are enemies. now lets look at the EFFECTS of being an enemy.
we have 16 races, 4 in every faction..
let's say client is playing race 1. race 1 = ponies. and the other guy is playing race 2 = bronies.

when you create race 1, make sure you added the faction definition in it (look at what revan posted)
then you can define how being enemy affects it, like they get more DMG, longer stun or sth idk.


you can have a LOT of races in 1 faction. thats why revan made the faction system: expand the usual race 1 vs race 2 to FACTIONS and stories and special skills, dynamic gameplay etc

hope this clears it up
Logged

Sapere aude!
-El Diablo
Full Member
***
Posts: 175


View Profile
« Reply #4 on: May 14, 2012, 11:59:24 AM »

so.. if you have red pony, blue pony, and green pony races.. you can assign  all three races to one faction called ponies?

W3Faction(redponyRaceID,"ponies",true);   
W3Faction(blueponyRaceID,"ponies",true);   
W3Faction(greenponyRaceID,"ponies",true);   


??
« Last Edit: May 14, 2012, 12:01:31 PM by -El Diablo » Logged
Vulpone
Full Member
***
Posts: 140



View Profile Email
« Reply #5 on: May 14, 2012, 12:11:35 PM »

yes

one faction can carry as many races as you want them to.

like we use a faction called "Undead" in which we have all zombie-, monster- and undead-esque monsters.
they behave special towards "humans", "Elementalists" etc.


thats the basic idea behind the system: categorize + apply effects based on faction
Logged

Sapere aude!
Revan
Sr. Member
****
Posts: 263



View Profile
« Reply #6 on: May 14, 2012, 02:39:54 PM »

You could even easily implement an automatic faction->race category system which will show races in their factions without the need to do anything in your war3source.cfg
Logged

-El Diablo
Full Member
***
Posts: 175


View Profile
« Reply #7 on: May 16, 2012, 05:38:19 AM »

You could even easily implement an automatic faction->race category system which will show races in their factions without the need to do anything in your war3source.cfg

So, multiple races can have the same category too?
Logged
Revan
Sr. Member
****
Posts: 263



View Profile
« Reply #8 on: May 16, 2012, 08:39:23 AM »

Yes for sure, thats the idea behind categories
« Last Edit: May 16, 2012, 08:41:13 AM by Revan » Logged

-El Diablo
Full Member
***
Posts: 175


View Profile
« Reply #9 on: May 16, 2012, 10:45:18 AM »

Yes for sure, thats the idea behind categories

Just wanted to make sure on that.. cause you never know how people think / program Tongue
Logged
Vulpone
Full Member
***
Posts: 140



View Profile Email
« Reply #10 on: May 16, 2012, 12:23:03 PM »

revan has the tendency of coding wildly with funny comments, but releasing great code in the end

and if he doesn't, i hit him Angry
Logged

Sapere aude!
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!