Author Sticky: Post Working Scripts Here
Nirran Posted: Thursday, 11 July 03:51PM
ill try to make this as simple as possible

what this does is make a *** fight areana with betting on the outcome

1.first of all make your area and put in a bet taker(to simplify this im assuming your using all objects tags and int's the same as what i wrote)

2.put 9 placeable objects in your area,4 of them where you want your chickens to start

tag them:
red_won
blue_won
green_won
yellow_won
chicken_fight
red_spot//these are the start locations
blue_spot//these are the start locations
green_spot//these are the start locations
yellow_spot//these are the start locations

3.now make a conversation for your bet taker with 2 roots

root do you want to bet?
--ok
----npc what chicken?
---green
---how much?
---25
---npc you dont have enough gold.
---ok the fight is about to start
(do the above for each amount on each chicken)
---50
---75
---100
---red
---blue
---yellow
--no

root npc the fights over lets see if you won,got your stub?
---yes
---well red won so lets compare your stub
---here is my stub
---well looks like you won here is your 100 gold(from 25)
---well looks like you won here is your 200 gold(from 50)
---well looks like you won here is your 300 gold(from 75)
---well looks like you won here is your 400 gold(from 100)
---sorry,better luck next time
(do the above for each chicken won possibility
---well blue won so lets compare your stub
---well green won so lets compare your stub
---well yellow won so lets compare your stub
---you lost your stub,no payoff without stubs.
---no

4.create 16 items with the names(you can change the names latter,name them this so the refres is right),they are the bet stubs
betstubblue25
betstubblue50
betstubblue75
betstubblue100
betstubred25
betstubred50
betstubred75
betstubred100
betstubgreen25
betstubgreen50
betstubgreen75
betstubgree100
betstubyellow25
betstubyellow50
betstubyellow75
betstubyellow100

5.now attatch this script to the root "do you want to bet?"in the text appears when
NWScript:
int StartingConditional()

{

object ochickens_fighting = GetObjectByTag("chicken_fight");

return (GetLocalInt(ochickens_fighting,"chickens_fighting")==0);

}



and this one to the root "the fight is over......"
in the text appears when

NWScript:
int StartingConditional()

{

object ochickens_fighting = GetObjectByTag("chicken_fight");

return (GetLocalInt(ochickens_fighting,"chickens_fighting")==2);

}



put this one in the betting root of every instance of 25 gold,in text appears when

NWScript:
int StartingConditional()

{

    object objPC = GetPCSpeaker();

    return (GetGold(objPC) >= 25);

}


the above script gold amount needs to be changed for every amount of gold,then put it in the appropriate text appears when conversation leg
6.
now put this in the action taken of the "ok the fight is about to start"

NWScript:
void main()

{

if (GetLocalInt(OBJECT_SELF,"chickens_fighting") != 0)

    {

       return;

    }

location oberttaker1 = GetLocation(GetObjectByTag("red_spot"));

location oberttaker2 = GetLocation(GetObjectByTag("blue_spot"));

location oberttaker3 = GetLocation(GetObjectByTag("green_spot"));

location oberttaker4 = GetLocation(GetObjectByTag("yellow_spot"));

object oPC = GetPCSpeaker();

object oberttaker = GetObjectByTag("Bet_Taker");

object oSpecialItem = CreateItemOnObject ("betstubblue25", oPC, 1);

AssignCommand ( oberttaker,TakeGoldFromCreature (25, oPC, TRUE));

object ored_dead = GetObjectByTag("dead_red");

object oblue_dead = GetObjectByTag("dead_blue");

object ogreen_dead = GetObjectByTag("dead_green");

object oyellow_dead = GetObjectByTag("dead_yellow");

object ochickens_fighting = GetObjectByTag("chicken_fight");

SetLocalInt ( ored_dead, "red_dead", 0);

SetLocalInt ( oblue_dead, "blue_dead", 0);

SetLocalInt ( ogreen_dead, "green_dead", 0);

SetLocalInt ( oyellow_dead, "yellow_dead", 0);

SetLocalInt ( ochickens_fighting , "chickens_fighting", 1);

object ored = CreateObject(OBJECT_TYPE_CREATURE, "red_chicken", oberttaker1, FALSE );

object oblue = CreateObject(OBJECT_TYPE_CREATURE, "blue_chicken", oberttaker2, FALSE );

object ogreen = CreateObject(OBJECT_TYPE_CREATURE, "green_chicken", oberttaker3, FALSE );

object oyellow = CreateObject(OBJECT_TYPE_CREATURE, "yellow_chicken", oberttaker4, FALSE );

}


make 16 of the above and change the "betstubblue25" to the appropriate item and put them in action taken of the appropriate conversation leg

7.now put this in the heartbeat of the area

NWScript:
void main()

{

    object ochickens_fighting = GetObjectByTag("chicken_fight");

    object ored_won = GetObjectByTag("red_won");

    object oblue_won = GetObjectByTag("blue_won");

    object ogreen_won = GetObjectByTag("green_won");

    object oyellow_won = GetObjectByTag("yellow_won");

    object ochickenred = (GetObjectByTag("red_chicken"));

    object ochickenblue = (GetObjectByTag("blue_chicken"));

    object ochickengreen = (GetObjectByTag("green_chicken"));

    object ochickenyellow = (GetObjectByTag("yellow_chicken"));

    if(GetIsObjectValid(ochickenred) &&

    !GetIsObjectValid(ochickenblue) &&

    !GetIsObjectValid(ochickengreen) &&

    !GetIsObjectValid(ochickenyellow))

    {

    SetLocalInt ( ochickens_fighting , "chickens_fighting", 2);

    SetLocalInt ( ored_won , "redwinner", 1);

    }

    if(GetIsObjectValid(ochickenblue) &&

    !GetIsObjectValid(ochickenred) &&

    !GetIsObjectValid(ochickengreen) &&

    !GetIsObjectValid(ochickenyellow))

    {

    SetLocalInt ( ochickens_fighting , "chickens_fighting", 2);

    SetLocalInt ( oblue_won , "bluewinner", 1);

    }

    if(GetIsObjectValid(ochickengreen) &&

    !GetIsObjectValid(ochickenblue) &&

    !GetIsObjectValid(ochickenred) &&

    !GetIsObjectValid(ochickenyellow))

    {

    SetLocalInt ( ochickens_fighting , "chickens_fighting", 2);

    SetLocalInt ( ogreen_won , "greenwinner", 1);

    }

    if(GetIsObjectValid(ochickenyellow) &&

    !GetIsObjectValid(ochickenblue) &&

    !GetIsObjectValid(ochickengreen) &&

    !GetIsObjectValid(ochickenred))

    {

    SetLocalInt ( ochickens_fighting , "chickens_fighting", 2);

    SetLocalInt ( oyellow_won , "yellowwinner", 1);

    }

}



8.now put this script in the "blue won..."leg of the fight is over root

NWScript:
int StartingConditional()

{

object oblue_won = GetObjectByTag("blue_won");

return (GetLocalInt(oblue_won,"bluewinner")==1);

}


change the above script object and int for each chicken and put them in the appropriate convo leg

9.now put this in the blue
---25 of the fiht over root
in the text appears when

NWScript:
int StartingConditional()

{

  object oItem = GetItemPossessedBy(GetPCSpeaker(),"betstub_blue25");

  if (GetIsObjectValid(oItem))

  {

    return TRUE;

  }

  return FALSE;

}


change the above item for each item you made and put the script ib the appropriate convo leg

10.now put this in the 25 payoff action taken

NWScript:
void main()

{

object oCreature = GetPCSpeaker();

GiveGoldToCreature(oCreature,100);

object ochickens_fighting = GetObjectByTag("chicken_fight");

SetLocalInt ( ochickens_fighting , "chickens_fighting", 0);

DestroyObject(GetObjectByTag("betstub_blue25"),0.0);

DestroyObject(GetObjectByTag("betstub_blue50"),0.0);

DestroyObject(GetObjectByTag("betstub_blue75"),0.0);

DestroyObject(GetObjectByTag("betstub_blue100"),0.0);

DestroyObject(GetObjectByTag("betstub_red25"),0.0);

DestroyObject(GetObjectByTag("betstub_red50"),0.0);

DestroyObject(GetObjectByTag("betstub_red75"),0.0);

DestroyObject(GetObjectByTag("betstub_red100"),0.0);

DestroyObject(GetObjectByTag("betstub_green25"),0.0);

DestroyObject(GetObjectByTag("betstub_green50"),0.0);

DestroyObject(GetObjectByTag("betstub_green75"),0.0);

DestroyObject(GetObjectByTag("betstub_green100"),0.0);

DestroyObject(GetObjectByTag("betstub_yellow25"),0.0);

DestroyObject(GetObjectByTag("betstub_yellow50"),0.0);

DestroyObject(GetObjectByTag("betstub_yellow75"),0.0);

DestroyObject(GetObjectByTag("betstub_yellow100"),0.0);

DestroyObject(GetObjectByTag("red_chicken"),0.0);

DestroyObject(GetObjectByTag("blue_chicken"),0.0);

DestroyObject(GetObjectByTag("green_chicken"),0.0);

DestroyObject(GetObjectByTag("yellow_chicken"),0.0);

}


change the gold amount for every amount and put them in the appropriate convo leg

11.make your 4 chickens with the names
red_chicken
blue_chicken
green_chicken
yellow_chicken

12.change the factions and put in 4 new ones red blue green and yellow,make sure you assing the appropriate chicken to the faction,make them hate each other


and wala,instant(ha) chicken fight betting

if anything is screwwed up or i forgot anything message me