teleport to leader script modification problem
#1
Posté 20 octobre 2011 - 08:26
If Party Leader has atlantisc variable on their panic buttons, *and* pc in question has the same variable, they can teleport to leader as usual...
If party leader has atlantisb (but not atlantisc) *and* pc has the same or higher variable, they can teleport as usual...
if party leader has atlantisa (but not higher) *and* pc has the same variable or higher, they can port...
if the party leader, however, has a higher variable than the pc trying to port, the porting won't go through and there will be a message saying why...
And, of course, if neither party has any of the atlantis variables, they can port as usual.
This is kinda a complex if/and script, and I'm not sure I know how to code it myself...can someone help me with that?
Alassirana
#2
Posté 20 octobre 2011 - 08:39
Meanwhile I'll just write what I would do and that is not very complex.
Just use the normal TP script....but then also a conversation where you check for which of the three versions it is....
...but again...if you want something more complex...hopefully someone else can help you...
#3
Posté 20 octobre 2011 - 08:46
Alassirana
#4
Posté 20 octobre 2011 - 10:57
So panic buttons indicate the variables on an item in the PC's possesson,or a converstion node? Just wondering since panic button just is not enough of a definition, as conversations cannot be started while in combat, which might be one reason to panic. Anyway probably easier to use something like my teleport to party leader method and alter it, then put it into a conversation node.
http://nwvault.ign.c....detail&id=2345
Oh, and just pointing out what may be obvious and abundantly clear to you is not necessarily so to others.
but you could probably do it with just a few lines.
object oPC = GetPCSpeaker();
object oPCL = GetFactionLeader(oPC);
//object oItem ToCheck = GetItemPossessedBy(oPC, "tagofitem"); if the varibles are on an item. then instead you would have to add one for each the oPC and the oPCL and check them against eachother.
if (((GetLocalInt(oPCL, "variable")==TRUE) && (GetLocalInt(oPC, "variable")==TRUE) || (GetLocalInt(oPC, "variableA")==TRUE)))//just add or for additional varibles
{
AssignCommand(oPC, JumpToObject(oPCL));
}
else if //restate the case for other variable on leader etc...
//if failure occurs, the variables don't allow the teleportation
{
SendMessageToPC(oPC, "You can't teleport to your leader with the current configuration of the atlantis pr-gression.");
return;
}
Modifié par ffbj, 20 octobre 2011 - 11:28 .
#5
Posté 20 octobre 2011 - 11:31
Alassirana wrote...
If Party Leader has atlantisc variable on their panic buttons, *and* pc in question has the same variable, they can teleport to leader as usual...
If party leader has atlantisb (but not atlantisc) *and* pc has the same or higher variable, they can teleport as usual...
This is kinda a complex if/and script, and I'm not sure I know how to code it myself...can someone help me with that?
Alassirana
Hmm, It sounds like you have crafted your own complexity. If I am reading what you are saying correctly you have three different varaiavbles on your PC's atlantisa atlantisb and atlantisc, instead of just having one variable 'atlantis' set to state 1, 2, or 3. With the last [1,2,3] states set on the same varaiable all you would have to do is make sure that they are the same.
If ( GetAtlantisState(oPC1) == GetAtlantisState(oPC2) ) AllowTransport();
With the three vars it just gets a little more messy;
if var one will always be set if var 2 is set and var2 will always be set if var two is set if var 3 is set. I think I would just added them all together for each PC then compair them to see if they are equal.
if ( GetVar1(oPC1) +GetVar2(oPC1) + GetVar3(oPC1) == GetVar1(oPC2) +GetVar2(oPC2) + GetVar3(oPC2) ) AllowTransport();
But is is hard to give advice when we do not really know what your vars are and what they are set to. the Multi var line above only really works if you are only setting then to true or false. and if that is what you are doing you may want to think about converting you system to the one var method, but that could be a lot of work if you have already have a lot of scripts using the three vars.
#6
Posté 21 octobre 2011 - 12:10
Alassirana
#7
Posté 21 octobre 2011 - 12:26
if (((GetLocalInt(oPCL, "variable")==TRUE) && (GetLocalInt(oPC, "variable")==TRUE) || (GetLocalInt(oPC, "variableA")==TRUE)...))
would return TRUE if both PC's have var 1 set on them reguardles of if either or both have the next var set. His logic will only work if the PC can only have one of the vars set at a time. I just do not know if that is the case in your system or not.
#8
Posté 21 octobre 2011 - 10:40
Alassirana
#9
Posté 21 octobre 2011 - 04:33
void main ();
object oPC = GetPCSpeaker();
object oLeader = GetFactionLeader(oPC);
object oPButton = GetItemPossessedBy(oPC, "panicbutton");
object oPBL = GetItemPossessedBy(oLeader, "panicbutton");
if (((GetLocalInt(oPBL, "atlantisc")) ==TRUE) && (((GetLocalInt(oPButton, "atlantisc"))==TRUE)
|| (((GetLocalInt(oPBL, "atlantisb"))==TRUE) && (((GetLocalInt(oPButton, "atlantisb"))==TRUE)
|| (((GetLocalInt(oPBL, "atlantisa"))==TRUE) && (((GetLocalInt(oPButton, "atlantisa"))=TRUE)
|| (((GetLocalInt(oPBL, "atlantisa"))!=TRUE) && (((GetLocalInt(oPButton, "atlantisa"))!=TRUE);
{ AssignCommand(oPC, JumpToObject(oLeader));
}
else if (((GetLocalInt(oPBL, "atlantisc"))==TRUE) && (((GetLocalInt(oPButton, "atlantisc"))!=TRUE) ||
(((GetLocalInt(oPBL, "atlantisb"))==TRUE) && (((GetLocalInt(oPButton, "atlantisb"))==TRUE)
|| (((GetLocalInt(oPBL, "atlantisa")==TRUE) && (((GetLocalInt(oPButton, "atlantisa))== TRUE);
SendMessageToPC(oPC, "You can't teleport to your leader with the current configuration of the atlantis progression.");
return;
}
}
Thanks in advance for your help.
#10
Posté 21 octobre 2011 - 04:40
Alassirana
#11
Posté 21 octobre 2011 - 04:41
Add another = ;-)Alassirana wrote...
if (((GetLocalInt(oPBL, "atlantisc")) ==TRUE) && (((GetLocalInt(oPButton, "atlantisc"))==TRUE)
|| (((GetLocalInt(oPBL, "atlantisb"))==TRUE) && (((GetLocalInt(oPButton, "atlantisb"))==TRUE)
|| (((GetLocalInt(oPBL, "atlantisa"))==TRUE) && (((GetLocalInt(oPButton, "atlantisa"))=TRUE)
|| (((GetLocalInt(oPBL, "atlantisa"))!=TRUE) && (((GetLocalInt(oPButton, "atlantisa"))!=TRUE);
{ AssignCommand(oPC, JumpToObject(oLeader));
}
<...an empty spot>
Modifié par Rolo Kipp, 21 octobre 2011 - 04:43 .
#12
Posté 21 octobre 2011 - 04:49
#13
Posté 21 octobre 2011 - 04:59
Only thing I can think of at the moment is to put in a check to make sure oLeader is a valid object and that oPC is commandable.
I don't see anything wrong with the function call.
What do feedback do you get?
<...if the coin is wooden>
#14
Posté 21 octobre 2011 - 05:02
You took out this semi-colon?Alassirana wrote...
else if (((GetLocalInt(oPBL, "atlantisc"))==TRUE) && (((GetLocalInt(oPButton, "atlantisc"))!=TRUE) ||
(((GetLocalInt(oPBL, "atlantisb"))==TRUE) && (((GetLocalInt(oPButton, "atlantisb"))==TRUE)
|| (((GetLocalInt(oPBL, "atlantisa")==TRUE) && (((GetLocalInt(oPButton, "atlantisa))== TRUE);
<...nits>
#15
Posté 21 octobre 2011 - 05:06
{ AssignCommand (oPC, ActionJumpToObject(oLeader))};
This is giving me a (no right bracket on expression) error...
#16
Posté 21 octobre 2011 - 05:10
Would you post the entire script as it now is, please?
<...perplexed>
#17
Posté 21 octobre 2011 - 05:15
void main ()
{
object oPC = GetPCSpeaker();
object oLeader = GetFactionLeader(oPC);
object oPButton = GetItemPossessedBy(oPC, "panicbutton");
object oPBL = GetItemPossessedBy(oLeader, "panicbutton");
if (((GetLocalInt(oPBL, "atlantisc")) ==TRUE) && ((GetLocalInt(oPButton, "atlantisc"))==TRUE))
|| (((GetLocalInt(oPBL, "atlantisb"))==TRUE) && ((GetLocalInt(oPButton, "atlantisb"))==TRUE))
|| (((GetLocalInt(oPBL, "atlantisa"))==TRUE) && ((GetLocalInt(oPButton, "atlantisa"))==TRUE))
|| (((GetLocalInt(oPBL, "atlantisa"))!=TRUE) && ((GetLocalInt(oPButton, "atlantisa"))!=TRUE))
{ AssignCommand(oPC, ActionJumpToObject(oLeader))};
else if (((GetLocalInt(oPBL, "atlantisc"))==TRUE) && ((GetLocalInt(oPButton, "atlantisc"))!=TRUE)) ||
(((GetLocalInt(oPBL, "atlantisb"))==TRUE) && ((GetLocalInt(oPButton, "atlantisb"))!=TRUE))
|| (((GetLocalInt(oPBL, "atlantisa")==TRUE) && ((GetLocalInt(oPButton, "atlantisa"))!=TRUE))
SendMessageToPC(oPC, "You can't teleport to your leader with the current configuration of the atlantis progression.");
return;
}
}
#18
Posté 21 octobre 2011 - 05:40
#19
Posté 21 octobre 2011 - 05:42
Try this; remove this semi-colon...Alassirana wrote...
if (((GetLocalInt(oPBL, "atlantisc")) ==TRUE) && ((GetLocalInt(oPButton, "atlantisc"))==TRUE))
|| (((GetLocalInt(oPBL, "atlantisb"))==TRUE) && ((GetLocalInt(oPButton, "atlantisb"))==TRUE))
|| (((GetLocalInt(oPBL, "atlantisa"))==TRUE) && ((GetLocalInt(oPButton, "atlantisa"))==TRUE))
|| (((GetLocalInt(oPBL, "atlantisa"))!=TRUE) && ((GetLocalInt(oPButton, "atlantisa"))!=TRUE))
{ AssignCommand(oPC, ActionJumpToObject(oLeader))};
Change this part to:else if (((GetLocalInt(oPBL, "atlantisc"))==TRUE) && ((GetLocalInt(oPButton, "atlantisc"))!=TRUE)) ||
(((GetLocalInt(oPBL, "atlantisb"))==TRUE) && ((GetLocalInt(oPButton, "atlantisb"))!=TRUE))
|| (((GetLocalInt(oPBL, "atlantisa")==TRUE) && ((GetLocalInt(oPButton, "atlantisa"))!=TRUE))
SendMessageToPC(oPC, "You can't teleport to your leader with the current configuration of the atlantis progression.");
return;
}
}
else if (((GetLocalInt(oPBL, "atlantisc"))==TRUE) && ((GetLocalInt(oPButton, "atlantisc"))!=TRUE)) ||
(((GetLocalInt(oPBL, "atlantisb"))==TRUE) && ((GetLocalInt(oPButton, "atlantisb"))!=TRUE))
|| (((GetLocalInt(oPBL, "atlantisa")==TRUE) && ((GetLocalInt(oPButton, "atlantisa"))!=TRUE))
{
SendMessageToPC(oPC, "You can't teleport to your leader with the current configuration of the atlantis progression.");
return;
}
<...his sleeves>
#20
Posté 21 octobre 2011 - 10:53
Perhaps in the future you may want to consider just using a variables you can increment or decrement, say atlantis set to 1, then 2, then 3, etc...In this way you would be just checking the value of the variable, not comparing multiple variables with similar names, usually an easy way to make a mistake.
For instance in my notoriety system you gain/lose notoriety based on variious actions. Npc's will respond to you differently based on that notoriety. Not a perfect example as relates to this script problem.
Oh I sort of liked the 'current configuration of the atlantis progression', it has a nice ring to it. Don't know if that fits or not just off the top of my head.
Yeah parenthesis and ellipsis, look similar.
Modifié par ffbj, 21 octobre 2011 - 11:08 .
#21
Posté 21 octobre 2011 - 11:06
#22
Posté 21 octobre 2011 - 11:11
#23
Posté 21 octobre 2011 - 11:21





Retour en haut






