Small Holes, Big Difference
#1
Posté 27 juillet 2010 - 09:14
void main()
{
object oPC = GetPCSpeaker();
object oTarget;
location lTarget;
if(GetLocalInt(OBJECT_SELF, "Is In Cave 1") == 1)
{
oTarget = GetWaypointByTag("CrawlToGoblinCave2");
lTarget = GetLocation(oTarget);
if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;
oTarget=GetFirstFactionMember(oPC, FALSE);
while (GetIsObjectValid(oTarget))
{
if (GetCreatureSize(oTarget) != CREATURE_SIZE_SMALL || CREATURE_SIZE_TINY) return;
AssignCommand(oTarget, ClearAllActions());
AssignCommand(oTarget, ActionJumpToLocation(lTarget));
oTarget=GetNextFactionMember(oPC, FALSE);
return;
}
}
oTarget = GetWaypointByTag("CrawlToGoblinCave1");
lTarget = GetLocation(oTarget);
if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;
oTarget=GetFirstFactionMember(oPC, FALSE);
while (GetIsObjectValid(oTarget))
{
if (GetCreatureSize(oTarget) != CREATURE_SIZE_SMALL | CREATURE_SIZE_TINY) return;
AssignCommand(oTarget, ClearAllActions());
AssignCommand(oTarget, ActionJumpToLocation(lTarget));
oTarget=GetNextFactionMember(oPC, FALSE);
}
}
#2
Posté 27 juillet 2010 - 10:35
on the first one you have: if(GetCreatureSize(oTarget) != CREATURE_SIZE_SMALL || CREATURE_SIZE_TINY) return;
On the second you have: if(GetCreatureSize(oTarget) != CREATURE_SIZE_SMALL | CREATURE_SIZE_TINY) return;
in the second one you are doing a logical test Or and in the second you are doing a logical Bitwize Or.
Does not matter that much since nither is going to return the resutts you want.
here is what you are doing in the first one.
(GetCreatureSize(oTarget) != CREATURE_SIZE_SMALL) will return a true or false value. Then you are doing an Or against CREATURE_SIZE_TINY wich is a postive value making it true. This is causing your expression to always evaluate to be true. (true or false) || True =TRUE.
in the second one it does the operator first so you have (CREATURE_SIZE_SMALL | CREATURE_SIZE_TINY) since the tiny constant is equal to 1 and the small one equal to 2. This will evaluate out to be 3. now 3 is what the constant for creature size mediun is equal to. So this section will only transport the character it they are != CREATURE_SIZE_MEDIUM.
What you need to to make both checks seperate with an OR inbtween them.
if((GetCreatureSize(oTarget) != CREATURE_SIZE_SMALL) || GetCreatureSize(oTarget) != CREATURE_SIZE_TINY) return;
Modifié par Lightfoot8, 27 juillet 2010 - 10:38 .
#3
Posté 28 juillet 2010 - 12:31
Yeah, the two were different because I was hastily changing them for testing.
I still don't understand the Bitwize one, though, namely because I don't what a Bitwize is or what it's good for.
Thanks again, Lightfoot!
#4
Posté 28 juillet 2010 - 12:35
Here's what I have in the OnUsed event of the hole...
object oPC = GetPCSpeaker();
This may be giving you trouble.
I'm pretty sure if you're not using a conversation this wont return anything.
Replace it with this:
object oPC= GetLastUsedBy();
I haven't looked at the rest yet. I'll do so and let you know if I see anything else.
#5
Posté 28 juillet 2010 - 12:57
Wait, no, that's right. It's actually called from a conversation with the hole. Make me doubt myself like that.
Modifié par One Thousand Talons Mao Ra, 28 juillet 2010 - 12:59 .
#6
Posté 28 juillet 2010 - 01:32
So I noticed my objects were defined all wrong. Rewrote the script and still got nothin'. Here's my last version...
void main()
{
object oPC = GetPCSpeaker();
object oTarget;
object oCrawler;
location lTarget;
if(GetLocalInt(OBJECT_SELF, "Is In Cave 1") == 1)
{
oTarget = GetWaypointByTag("CrawlToGoblinCave2");
lTarget = GetLocation(oTarget);
if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;
oCrawler=GetFirstFactionMember(oPC, FALSE);
while (GetIsObjectValid(oCrawler))
{
if((GetCreatureSize(oCrawler)==CREATURE_SIZE_SMALL) || GetCreatureSize(oCrawler)==CREATURE_SIZE_TINY) return;
{
AssignCommand(oCrawler, ClearAllActions());
AssignCommand(oCrawler, ActionJumpToLocation(lTarget));
oCrawler=GetNextFactionMember(oPC, FALSE);
return;
}
}
}
oTarget = GetWaypointByTag("CrawlToGoblinCave1");
lTarget = GetLocation(oTarget);
if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;
oCrawler=GetFirstFactionMember(oPC, FALSE);
while (GetIsObjectValid(oCrawler))
{
if((GetCreatureSize(oCrawler)==CREATURE_SIZE_SMALL) || GetCreatureSize(oCrawler)==CREATURE_SIZE_TINY) return;
{
AssignCommand(oCrawler, ClearAllActions());
AssignCommand(oCrawler, ActionJumpToLocation(lTarget));
oCrawler=GetNextFactionMember(oPC, FALSE);
return;
}
}
}
<_<
#7
Posté 28 juillet 2010 - 01:37
One Thousand Talons Mao Ra wrote...
LOL!!! That's just embarrassing.
Wait, no, that's right. It's actually called from a conversation with the hole. Make me doubt myself like that.
Well then, it doesn't go in a onUsed, it needs to go into the "Action Taken...." of the conversation file.
#8
Posté 28 juillet 2010 - 01:43
#9
Posté 28 juillet 2010 - 01:50
#10
Posté 28 juillet 2010 - 01:56
if((GetCreatureSize(oCrawler)==CREATURE_SIZE_SMALL) || GetCreatureSize(oCrawler)==CREATURE_SIZE_TINY) return;
Lets just rewrite the thing. It is beign called on a conversation? So we make it like this.
void main()
{
object oPC = GetPCSpeaker();
object oTarget;
object oCrawler;
location lTarget;//alot of this is redundant and you could put a simple jump speaker to
//waypoint btw
if(GetLocalInt(OBJECT_SELF, "Is In Cave 1") == 1)
{
if((GetCreatureSize(oCrawler)==CREATURE_SIZE_SMALL) || GetCreatureSize(oCrawler)==CREATURE_SIZE_TINY);
{
AssignCommand(oCrawler, ClearAllActions());
AssignCommand(oCrawler, ActionJumpToLocation(lTarget));
}
}
}
Now put that on the text appears and then on the other conversation node a simple,
"You are too massive to skimmy through this hole. Quit eating sweet pies."
There is even easier ways but it is late and I just got home from playing pool and hanging out with the freinds so will check in the morning and post a true compiled script but hopfully this is in the right direction.
#11
Posté 28 juillet 2010 - 01:57
Modifié par One Thousand Talons Mao Ra, 28 juillet 2010 - 01:59 .
#12
Posté 28 juillet 2010 - 02:02
#13
Posté 28 juillet 2010 - 02:05
Let's see what we can do..
void main()
{
object oPC=GetPCSpeaker();
object oWay=GetObjectByTag("CrawlToGoblinCave2");
location iTarget=GetLocation(oWay);
if ((GetCreatureSize(oPC)==CREATURE_SIZE_SMALL) || (GetCreatureSize(oPC)==CREATURE_SIZE_TINY))
{
AssignCommand(oPC,ClearAllActions());
AssignCommand(oPC,ActionJumpToLocation(iTarget));
}
else
{
AssignCommand(oPC,SpeakString("I don't think I can fit."));
}
}
This works. Adding the check for the Int shouldn't hurt it any.
Is there a reason for the int? Or the checking for the existence of the WayPoint?
EDIT:
TSMDude, I want the PCs henchmen to follow if they're the right size,
but be left behind otherwise. Your script doesn't do that.
Ah, Henchmen add a whole other dimension to this.
Give me a few minutes.
Modifié par Redunct, 28 juillet 2010 - 02:10 .
#14
Posté 28 juillet 2010 - 02:17
TSMDude wrote...
wont this part here end all conversation anyhow?
if((GetCreatureSize(oCrawler)==CREATURE_SIZE_SMALL) || GetCreatureSize(oCrawler)==CREATURE_SIZE_TINY) return;
You just identified my problem. The ''return'' is killing the whole script.
#15
Posté 28 juillet 2010 - 02:24
#16
Posté 28 juillet 2010 - 02:37
void main()
{
object oPC=GetPCSpeaker();
object oWay=GetObjectByTag("CrawlToGoblinCave2");
location iTarget=GetLocation(oWay);
object oHench=GetHenchman(oPC);
if ((GetCreatureSize(oPC)==CREATURE_SIZE_SMALL) || (GetCreatureSize(oPC)==CREATURE_SIZE_TINY))
{
AssignCommand(oPC,ActionJumpToLocation(iTarget));
}
else
{
AssignCommand(oPC,SpeakString("I don't think I can fit."));
}
if ((GetCreatureSize(oHench)==CREATURE_SIZE_SMALL) || (GetCreatureSize(oHench)==CREATURE_SIZE_TINY))
{
AssignCommand(oHench,ActionJumpToLocation(iTarget));
}
else
{
RemoveHenchman(oPC,oHench);
}
}
This works. If the Henchman can't fit, He'll leave the Player's group. He SHOULD wait for the player where he was left, where he can rejoin.
Modifié par Redunct, 28 juillet 2010 - 02:37 .
#17
Posté 28 juillet 2010 - 02:38
One Thousand Talons Mao Ra wrote...
It works now! I rarely say this but... Woot!
It shouldn't, I don't see how you can define a henchmen via a Faction, but if it does, great.
#18
Posté 28 juillet 2010 - 02:50
#19
Posté 28 juillet 2010 - 03:05
One Thousand Talons Mao Ra wrote...
Isn't each PC party their own faction? I should be able to loop through that faction and move 'em if they're the right size. Worked on the PC anyway...
No, I don't believe so.
In order to prevent them from coming through you're gonna have to either 1.Force them to stay there or 2.Remove them from the party. I'll test it now, but I believe only a PC belongs to his respective faction, no one else can join it.
Just tested it, I am correct. NPCs cannot belong to a PC faction.
Switch it to "GetHenchmen(oPC)" and make sure you put some command to prevent the henchman from materializing next to the PC.
#20
Posté 28 juillet 2010 - 03:06
Modifié par Redunct, 28 juillet 2010 - 03:06 .
#21
Posté 28 juillet 2010 - 03:23
And yes a party if a faction. If they are in the party they are in that same faction. With the party leader the leader of the faction. If a PC leaves the party then they are in a different faction.
#22
Posté 28 juillet 2010 - 03:33
Lightfoot8 wrote...
And yes a party if a faction. If they are in the party they are in that same faction. With the party leader the leader of the faction. If a PC leaves the party then they are in a different faction.
I just tested this again, it appears to be a hit and miss.
Still think you'd be safest just changing it to GetHenchmen(oPC)





Retour en haut






