Author Topic: 6 sec hiding rule for pvp  (Read 11040 times)

Offline Daniel1975

  • Full Member
  • ***
  • Posts: 170
    • View Profile
    • http://
    • Email
6 sec hiding rule for pvp
« on: January 11, 2005, 05:01:14 PM »
I found this script on the nwvault. It sounds interesting but sadly it was not mentionent where it should be placed in the mod:

int GetTimeSeconds();
void DoHideCheck(object oPC, int nCurrentTime);

float THINK_THINK_DECREMENT = 0.1; //10 Checks per second...
void ThinkChecks(float nTimeLeft);
void ThinkChecks(float nTimeLeft)
{
    int nCurrentTime = GetTimeSeconds();
    object oObject = GetFirstPC();
    while(oObject!=OBJECT_INVALID)
    {
        DoHideCheck(oObject, nCurrentTime);
        oObject = GetNextPC();
    }
    DelayCommand(THINK_THINK_DECREMENT, ThinkChecks(nTimeLeft-THINK_THINK_DECREMENT));
}

void main()
{
    ThinkChecks(8.0); //think throughout HB
}
int GetTimeSeconds()
{
    return  (GetCalendarYear())*12*28*24*60*60 +
            (GetCalendarMonth()-1)*28*24*60*60 +
            (GetCalendarDay()-1)*24*60*60 +
            GetTimeHour()*60*60 +
            GetTimeMinute()*60 +
            GetTimeSecond();
}

void DoHideCheck(object oPC, int nCurrentTime)
{
    if (!GetHasFeat(FEAT_HIDE_IN_PLAIN_SIGHT, oPC))
        return;
    talent tHide = TalentSkill(SKILL_HIDE);
    string VAR_LAST_HIDDEN = "TIME_LAST_HIDDEN";
    string VAR_LAST_VIS = "TIME_LAST_VISIBLE";
    int nHideDelay = 6; //you can only hide once per round
    int nLastHide = GetLocalInt(oPC, VAR_LAST_HIDDEN);
    if (!GetActionMode(oPC, ACTION_MODE_STEALTH))
    {
        SetLocalInt(oPC, VAR_LAST_VIS, TRUE);
    }
    else if (GetLocalInt(oPC, VAR_LAST_VIS) && nLastHide > nCurrentTime)
    {
        string sHideTime = IntToString(nLastHide-nCurrentTime);
        ActionUseSkill(SKILL_HIDE, oPC); //toggle
        SetActionMode(oPC, ACTION_MODE_STEALTH, FALSE);
        FloatingTextStringOnCreature("*You cannot hide for "+sHideTime+" seconds*", oPC, FALSE);
    }
    else
    {
        SetLocalInt(oPC, VAR_LAST_VIS, FALSE);
        SetLocalInt(oPC, VAR_LAST_HIDDEN, nCurrentTime + nHideDelay);
        SetActionMode(oPC, ACTION_MODE_STEALTH, TRUE);
    }
}


if anyone has a clue where this script fits into please let me know  :(
G[/span][span style=\'color:orange\']w[/span][span style=\'color:yellow\']y[/span][span style=\'color:green\']d[/span][span style=\'color:blue\']i[/span][span style=\'color:purple\']on[/span] - Slann [span style=\'color:red\']Lord[/span] of the [span style=\'color:green\']Antediluvians

Offline Talon

  • Hero Member
  • *****
  • Posts: 88772
    • View Profile
    • http://
    • Email
6 sec hiding rule for pvp
« Reply #1 on: January 11, 2005, 06:31:55 PM »
Quote
I found this script on the nwvault. It sounds interesting but sadly it was not mentionent where it should be placed in the mod:

if anyone has a clue where this script fits into please let me know  :(
[snapback]15402[/snapback]

It will go in your modules onheartbeat event.
It is a very resource hungry script, and I wouldnt recommend using it.
If you have a certain type of motherboard, the sheer number of time functions will cause your CPU to hang.

Offline Daniel1975

  • Full Member
  • ***
  • Posts: 170
    • View Profile
    • http://
    • Email
6 sec hiding rule for pvp
« Reply #2 on: January 12, 2005, 05:05:51 AM »
Quote
Quote
I found this script on the nwvault. It sounds interesting but sadly it was not mentionent where it should be placed in the mod:

if anyone has a clue where this script fits into please let me know  :(
[snapback]15402[/snapback]

It will go in your modules onheartbeat event.
It is a very resource hungry script, and I wouldnt recommend using it.
If you have a certain type of motherboard, the sheer number of time functions will cause your CPU to hang.
[snapback]15410[/snapback]

Yes you are right Talon but since I don't have a better version and since I don't know (yet) enough about scripting to change this one I think I will use it anyway.
When I get problems with it then I can remove it anyway.
May be you can send me a better version of this script?  :blink:
I even would give credit to you  :)   :)
I'm always glad to get help from others...usually it is mel who helps me but she seems to be quite busy during the past days.
Look, I don't want to create a second GodSpire, I can't and I won't. I only would like to have the rules nearly the same so when GS is down and arivs isn't up, people could still have some fun on our mod too  :D
G[/span][span style=\'color:orange\']w[/span][span style=\'color:yellow\']y[/span][span style=\'color:green\']d[/span][span style=\'color:blue\']i[/span][span style=\'color:purple\']on[/span] - Slann [span style=\'color:red\']Lord[/span] of the [span style=\'color:green\']Antediluvians

Offline Daniel1975

  • Full Member
  • ***
  • Posts: 170
    • View Profile
    • http://
    • Email
6 sec hiding rule for pvp
« Reply #3 on: January 12, 2005, 06:53:56 AM »
oh and Talon (I hope you read this)
if it takes not too much of your free time,
could you please help me with this true seeing stuff?
I don't know how to change it into "see invisible" as it it done on GS
I can't get a clue how it has to be scripted  :(

Thanks for every little help!  :blush:
G[/span][span style=\'color:orange\']w[/span][span style=\'color:yellow\']y[/span][span style=\'color:green\']d[/span][span style=\'color:blue\']i[/span][span style=\'color:purple\']on[/span] - Slann [span style=\'color:red\']Lord[/span] of the [span style=\'color:green\']Antediluvians

Offline James_2k

  • Full Member
  • ***
  • Posts: 220
    • View Profile
    • http://
    • Email
6 sec hiding rule for pvp
« Reply #4 on: January 12, 2005, 07:13:38 AM »
couldnt you use a simple IF statement to find out whether the player is in a duel and only then carrying out the rest of the script?


Offline Daniel1975

  • Full Member
  • ***
  • Posts: 170
    • View Profile
    • http://
    • Email
6 sec hiding rule for pvp
« Reply #5 on: January 12, 2005, 07:50:54 AM »
Quote
couldnt you use a simple IF statement to find out whether the player is in a duel and only then carrying out the rest of the script?
[snapback]15468[/snapback]

I think it's not that easy because you have to check all players all the time to see if they are in a duel... *sigh*  :glare:
G[/span][span style=\'color:orange\']w[/span][span style=\'color:yellow\']y[/span][span style=\'color:green\']d[/span][span style=\'color:blue\']i[/span][span style=\'color:purple\']on[/span] - Slann [span style=\'color:red\']Lord[/span] of the [span style=\'color:green\']Antediluvians

Offline James_2k

  • Full Member
  • ***
  • Posts: 220
    • View Profile
    • http://
    • Email
6 sec hiding rule for pvp
« Reply #6 on: January 12, 2005, 07:53:45 AM »
Quote
Quote
couldnt you use a simple IF statement to find out whether the player is in a duel and only then carrying out the rest of the script?
[snapback]15468[/snapback]

I think it's not that easy because you have to check all players all the time to see if they are in a duel... *sigh*  :glare:
[snapback]15469[/snapback]
well, you could check to see if they are in combat much more easily. it would also help stop annoying hider randomers..

Offline Tea-cup

  • Hero Member
  • *****
  • Posts: 916
    • View Profile
6 sec hiding rule for pvp
« Reply #7 on: January 12, 2005, 10:07:13 AM »
You really have something with making heavy onbeat scripts gwydion. (like giving a throne an onbeat to add a clolor to it  :blink: )

I use a very small script on the onbeat to check for hide. It just check if the player is in duel, and if it's hided. If so it unhides. That's all and takes 1 if statement and 1 command to unhide.

For the truesee, just make that the truesee gets removed and replace it by 6 darkvisions. And when someone equips a item with 6 darkvision make that they get a supernatural effect with see invisi and ultrvision. Same goes for unequiping, remove those then. (this makes it gs/arivs compatible too, I recommend you work that way)

-Mel

Offline Daniel1975

  • Full Member
  • ***
  • Posts: 170
    • View Profile
    • http://
    • Email
6 sec hiding rule for pvp
« Reply #8 on: January 12, 2005, 11:15:38 AM »
Quote
You really have something with making heavy onbeat scripts gwydion. (like giving a throne an onbeat to add a clolor to it  :blink: )

I use a very small script on the onbeat to check for hide. It just check if the player is in duel, and if it's hided. If so it unhides. That's all and takes 1 if statement and 1 command to unhide.

For the truesee, just make that the truesee gets removed and replace it by 6 darkvisions. And when someone equips a item with 6 darkvision make that they get a supernatural effect with see invisi and ultrvision. Same goes for unequiping, remove those then. (this makes it gs/arivs compatible too, I recommend you work that way)

-Mel
[snapback]15479[/snapback]

I first used the OnHeartbeat to give effects to objects yes because I didn't know of another way. Now since you told me how to change that I use the OnModuleLoad to give effects to objects  :D
but this loop stuff isn't working out...  :crash:      :glare:
G[/span][span style=\'color:orange\']w[/span][span style=\'color:yellow\']y[/span][span style=\'color:green\']d[/span][span style=\'color:blue\']i[/span][span style=\'color:purple\']on[/span] - Slann [span style=\'color:red\']Lord[/span] of the [span style=\'color:green\']Antediluvians

Offline Tea-cup

  • Hero Member
  • *****
  • Posts: 916
    • View Profile
6 sec hiding rule for pvp
« Reply #9 on: January 12, 2005, 01:45:45 PM »
Quote
Quote
You really have something with making heavy onbeat scripts gwydion. (like giving a throne an onbeat to add a clolor to it  :blink: )

I use a very small script on the onbeat to check for hide. It just check if the player is in duel, and if it's hided. If so it unhides. That's all and takes 1 if statement and 1 command to unhide.

For the truesee, just make that the truesee gets removed and replace it by 6 darkvisions. And when someone equips a item with 6 darkvision make that they get a supernatural effect with see invisi and ultrvision. Same goes for unequiping, remove those then. (this makes it gs/arivs compatible too, I recommend you work that way)

-Mel
[snapback]15479[/snapback]

I first used the OnHeartbeat to give effects to objects yes because I didn't know of another way. Now since you told me how to change that I use the OnModuleLoad to give effects to objects  :D
but this loop stuff isn't working out...  :crash:      :glare:
[snapback]15486[/snapback]
Loop, you don't need a loop for the hiding stuff. You may need a few for the truesee fix, but if that's what doesn't works, can you give a bit more info?

-Mel

Offline Daniel1975

  • Full Member
  • ***
  • Posts: 170
    • View Profile
    • http://
    • Email
6 sec hiding rule for pvp
« Reply #10 on: January 12, 2005, 02:25:44 PM »
this hiding stuff isn't so important right now. If you can spare a little time I would like you to help me with this:

This is a section of the script where I want all objects with the tag "VIT"
to get a LocalInt:

object oVIT = GetObjectByTag("VIT"); // VIT = Very Important Thing
while(GetIsObjectValid(oVIT))
{
 SetLocalInt(oVIT, "NoKilling", 1);
 oVIT = GetNextObjectInArea();
}

all objects that are absolutely neccessary have the tag VIT.
But still not all objects with this tag in one area are affected by that.
Is there smt wrong with this?
May be it has smt to do with GetNextObjectInArea?
How can I get an area where objects with VIT-tag are in and run this while-stuff for
that area as long as there are objects with that tag???  
G[/span][span style=\'color:orange\']w[/span][span style=\'color:yellow\']y[/span][span style=\'color:green\']d[/span][span style=\'color:blue\']i[/span][span style=\'color:purple\']on[/span] - Slann [span style=\'color:red\']Lord[/span] of the [span style=\'color:green\']Antediluvians

Offline Tea-cup

  • Hero Member
  • *****
  • Posts: 916
    • View Profile
6 sec hiding rule for pvp
« Reply #11 on: January 12, 2005, 03:03:59 PM »
Quote
this hiding stuff isn't so important right now. If you can spare a little time I would like you to help me with this:

This is a section of the script where I want all objects with the tag "VIT"
to get a LocalInt:

object oVIT = GetObjectByTag("VIT"); // VIT = Very Important Thing
while(GetIsObjectValid(oVIT))
{
 SetLocalInt(oVIT, "NoKilling", 1);
 oVIT = GetNextObjectInArea();
}

all objects that are absolutely neccessary have the tag VIT.
But still not all objects with this tag in one area are affected by that.
Is there smt wrong with this?
May be it has smt to do with GetNextObjectInArea?
How can I get an area where objects with VIT-tag are in and run this while-stuff for
that area as long as there are objects with that tag???
[snapback]15511[/snapback]
oVIT = GetNextObjectInArea(); This gets any object in the area, not just those with the tag. Also, if you get a object by tag and then starting from that one loop trought the rest, you may miss a few before the first you got with the tag.

Just get the first object in the are, then loop trought hem all and if they have the tag vit, add the local int. That only req a simple if statement in the while loop.

-Mel

Offline Daniel1975

  • Full Member
  • ***
  • Posts: 170
    • View Profile
    • http://
    • Email
6 sec hiding rule for pvp
« Reply #12 on: January 12, 2005, 03:30:39 PM »
Quote
Quote
this hiding stuff isn't so important right now. If you can spare a little time I would like you to help me with this:

This is a section of the script where I want all objects with the tag "VIT"
to get a LocalInt:

object oVIT = GetObjectByTag("VIT"); // VIT = Very Important Thing
while(GetIsObjectValid(oVIT))
{
 SetLocalInt(oVIT, "NoKilling", 1);
 oVIT = GetNextObjectInArea();
}

all objects that are absolutely neccessary have the tag VIT.
But still not all objects with this tag in one area are affected by that.
Is there smt wrong with this?
May be it has smt to do with GetNextObjectInArea?
How can I get an area where objects with VIT-tag are in and run this while-stuff for
that area as long as there are objects with that tag???
[snapback]15511[/snapback]
oVIT = GetNextObjectInArea(); This gets any object in the area, not just those with the tag. Also, if you get a object by tag and then starting from that one loop trought the rest, you may miss a few before the first you got with the tag.

Just get the first object in the are, then loop trought hem all and if they have the tag vit, add the local int. That only req a simple if statement in the while loop.

-Mel
[snapback]15520[/snapback]
okay now I changed it to this:

 object oItem = GetFirstObjectInArea();
 while(GetIsObjectValid(oItem))
  {
   object oVIT = GetObjectByTag("VIT");
   if(GetIsObjectValid(oVIT))
    {
     SetLocalInt(oVIT, "NoKilling", 1);
     oVIT = GetNextObjectInArea();
    }
  }

but it still doesn't work for every item in an area. I'm giving up  :(
I'm too dumb to do handle this loop stuff  :glare:
G[/span][span style=\'color:orange\']w[/span][span style=\'color:yellow\']y[/span][span style=\'color:green\']d[/span][span style=\'color:blue\']i[/span][span style=\'color:purple\']on[/span] - Slann [span style=\'color:red\']Lord[/span] of the [span style=\'color:green\']Antediluvians

Offline Tea-cup

  • Hero Member
  • *****
  • Posts: 916
    • View Profile
6 sec hiding rule for pvp
« Reply #13 on: January 12, 2005, 04:29:25 PM »
Code: [Select]
object oItem = GetFirstObjectInArea();
while(GetIsObjectValid(oItem))
{
if(GetTag(oItem) == "VIT")
{
SetLocalInt(oItem, "NoKilling", 1);
}
oItem = GetNextObjectInArea();
}
Maybe it's a good idea to pass the area to the area functions, to be sure :closedeyes:

-Mel
« Last Edit: January 12, 2005, 04:33:45 PM by Tea-cup »

Offline Daniel1975

  • Full Member
  • ***
  • Posts: 170
    • View Profile
    • http://
    • Email
6 sec hiding rule for pvp
« Reply #14 on: January 12, 2005, 05:32:59 PM »
Quote
Code: [Select]
object oItem = GetFirstObjectInArea();
while(GetIsObjectValid(oItem))
{
if(GetTag(oItem) == "VIT")
{
SetLocalInt(oItem, "NoKilling", 1);
}
oItem = GetNextObjectInArea();
}
Maybe it's a good idea to pass the area to the area functions, to be sure :closedeyes:

-Mel
[snapback]15536[/snapback]

I don't like to say this but its still not working. Even yet it only affects one single item in an area. I need a big holiday from NWN  :blink:   :blink:
These things are making me crazy  :crash:
G[/span][span style=\'color:orange\']w[/span][span style=\'color:yellow\']y[/span][span style=\'color:green\']d[/span][span style=\'color:blue\']i[/span][span style=\'color:purple\']on[/span] - Slann [span style=\'color:red\']Lord[/span] of the [span style=\'color:green\']Antediluvians

Offline Tea-cup

  • Hero Member
  • *****
  • Posts: 916
    • View Profile
6 sec hiding rule for pvp
« Reply #15 on: January 13, 2005, 02:22:53 PM »
Quote
Quote
Code: [Select]
object oItem = GetFirstObjectInArea();
while(GetIsObjectValid(oItem))
{
if(GetTag(oItem) == "VIT")
{
SetLocalInt(oItem, "NoKilling", 1);
}
oItem = GetNextObjectInArea();
}
Maybe it's a good idea to pass the area to the area functions, to be sure :closedeyes:

-Mel
[snapback]15536[/snapback]

I don't like to say this but its still not working. Even yet it only affects one single item in an area. I need a big holiday from NWN  :blink:   :blink:
These things are making me crazy  :crash:
[snapback]15541[/snapback]
The error still may be somewhere else in the script. At least the part I posted should work (even if it's a 1 minute post :P)

-Mel