would it be possible to set a pawns target to equal the entynames of several pawns at once.
like this.
SetTarget(foe_(1-12))
i may need to use a right or left copy command in there some were i think, but if im right i can keep the pawn in low level.
i may even need to cycle the order constantly throughout the script but it would still save me a lot of wasted effort. can anyone confirm or deny my theory?
Thanks,
fps
target low level by number idea
Excellent idea!
Yes, you could get the enemies' names that way and then check if any of them is visible and then target that one.
Though I don't recommend doing the 'check' very often. If there are, say, 10 pawns each checking if there are enemies nearby like 10 times per second, things may get slow. Also, the pawn number in one level will be limited, but I don't think that's a major issue.
Anyway, Great thinking!
Yes, you could get the enemies' names that way and then check if any of them is visible and then target that one.
Though I don't recommend doing the 'check' very often. If there are, say, 10 pawns each checking if there are enemies nearby like 10 times per second, things may get slow. Also, the pawn number in one level will be limited, but I don't think that's a major issue.
Anyway, Great thinking!

Pain is only psychological.
I personally would do it like this:
Code: Select all
for enemynumber = 0 to 10
{
if(IsEntityVsible("foe_" # enemynumber))
{
SetTarget("foe_" # enemynumber);
}
}
Pain is only psychological.
-
- Posts: 75
- Joined: Tue Jul 05, 2005 4:29 pm
oo indifference
also visible is spelled wrong
also visible is spelled wrong
Code: Select all
if(IsEntityVsible("foe_" # enemynumber))
That's how it is in the manual. I just pasted it here.revolutiongames2004 wrote: also visible is spelled wrong
Code: Select all
if(IsEntityVsible("foe_" # enemynumber))

Pain is only psychological.
- QuestOfDreams
- Site Admin
- Posts: 1520
- Joined: Sun Jul 03, 2005 11:12 pm
- Location: Austria
- Contact:
- fps
- Posts: 504
- Joined: Mon Sep 26, 2005 9:54 pm
- Location: in a magical land devoid of hope, happiness, and sanity.
thats nice to know. if they fix that in the next release it would mess up older scripts.
so the order should look somthing like this in the script.
{
Spawn[ ()
{
Console(true);
Ect(true);
LowLevel("Setup");
} ]
Setup[ ()
{
BlaBla = "bla";
self.think = "Idle";
} ]
Idle[ ()
{
idleactions
self.think = "AquireTargets"
}]
AquireTargets[ ()
{
self.ThinkTime = "0.2"; //what should this be set at?
for enemynumber = 0 to 10
{
if(IsEntityVsible("foe_" # enemynumber))
{
SetTarget("foe_" # enemynumber);
}
}]
rest of script
}
Will this check the visible pawns throughout the entire duration of the script or will i need to but it else were in the code also?
what do you think would happen if more than one pawn becomes visible while this is setting its target?
(i think i may have asked that elsewere
)
would it work if the players entity name to friendly_1?
i think i will need to have it check for distance too but it may already do that in my full script.
i feel like im getting somewere with this finally,
thanks for the help,
fps
so the order should look somthing like this in the script.
{
Spawn[ ()
{
Console(true);
Ect(true);
LowLevel("Setup");
} ]
Setup[ ()
{
BlaBla = "bla";
self.think = "Idle";
} ]
Idle[ ()
{
idleactions
self.think = "AquireTargets"
}]
AquireTargets[ ()
{
self.ThinkTime = "0.2"; //what should this be set at?
for enemynumber = 0 to 10
{
if(IsEntityVsible("foe_" # enemynumber))
{
SetTarget("foe_" # enemynumber);
}
}]
rest of script
}
Will this check the visible pawns throughout the entire duration of the script or will i need to but it else were in the code also?
what do you think would happen if more than one pawn becomes visible while this is setting its target?
(i think i may have asked that elsewere

would it work if the players entity name to friendly_1?
i think i will need to have it check for distance too but it may already do that in my full script.
i feel like im getting somewere with this finally,
thanks for the help,
fps
No, it wouldn't work the way you wrote it. You see, in the 'Idle' order you command the script to go to 'AquireTargets', but it doesn't come back to 'Idle'. So the script will only run the order 'AquireTargets' and do nothing else. I would recommend making this 'AquireTargets' a custom command (or something like that). I mean like this:
Then you could call this function from anywhere in the script. So whenever you would need to get a target, you would add line 'AquireTargets();' in the script. For example, if you wanted the pawn to check for new targets every 1 seconds while in 'Idle', you would add this to the 'Idle' order:
Where 'FindTargetTimer' is a variable which you need to define in the top of the script.
If there are multiple enemies visible at the same time, I believe the last one (the one with the biggest number) will be targeted.
Also, I would check for targets like every 1-2 seconds. In the end, it's up to you, though. Try different numbers and try to optimize it, so that it doesn't take too long for the pawns to find targets but it doesn't drop the framerate either.
Code: Select all
AquireTargets[ ()
{
for enemynumber = 0 to 10
{
if(IsEntityVsible("foe_" # enemynumber))
{
SetTarget("foe_" # enemynumber);
}
}]
Code: Select all
if(FindTargetTimer < self.time)
{
AquireTargets();
FindTargetTimer = self.time + 1;
}
If there are multiple enemies visible at the same time, I believe the last one (the one with the biggest number) will be targeted.
Also, I would check for targets like every 1-2 seconds. In the end, it's up to you, though. Try different numbers and try to optimize it, so that it doesn't take too long for the pawns to find targets but it doesn't drop the framerate either.
Pain is only psychological.