Author Topic: Homing Player With Sword Weapon  (Read 2678 times)

You're able to make a player aim left/right with setTransform, but not up or down.

It doesn't know the funtion "containerRadiusSearch"

You're able to make a player aim left/right with setTransform, but not up or down.

You can force a player to aim vertically by restraining their look limits %player.setLookLimts(%up,%down).

But how do I get the player to aim at a specific player in a specific Radius? containerRadiusSearch doesn't work.

But how do I get the player to aim at a specific player in a specific Radius? containerRadiusSearch doesn't work.
uuuhhhhh here's how you do a container radius search
Code: [Select]
InitContainerRadiusSearch(%center, %radius, %typemasks);
while(%hit = ContainerSearchNext())
{
dostuff();
}

uuuhhhhh here's how you do a container radius search
Code: [Select]
InitContainerRadiusSearch(%center, %radius, %typemasks);
while(%hit = ContainerSearchNext())
{
dostuff();
}
How do I make it do that with OnTrigger?

I highly doubt you actually know what you're talking about, let alone if you know how to do this.

You are probably right, since I only have limited experience with raycasts, but I do know a raycast can be used to test direction, as well as distance.  Then you just have the player face that direction and attack.

How do I make it do that with OnTrigger?
Are you asking for help making this or asking for someone else to script this for you? If the latter, this thread belongs in suggestions and requests.

Are you asking for help making this or asking for someone else to script this for you? If the latter, this thread belongs in suggestions and requests.
Honestly, that code confuses me. I'm sorry.

A thrust would not require a radius search right? :C

"Homing" Player With Sword Weapon.

If %obj is the player, and %trg is the target:
Code: [Select]
%bot = new AIPlayer() {
    position = %obj.getPosition();
    datablock = %obj.getDataBlock();
};
%bot.setDamageLevel(%obj.getDamageLevel());
%bot.mountImage(%obj.getMountedImage(0), 0);
%bot.mountImage(%obj.getMountedImage(1), 1);
// copy appearance of %obj to %bot
%obj.client.camera.setOrbitMode(%bot, effin, forgot, dem, args);
%obj.client.setControlObject(%obj.client.camera);
%obj.setTransform("0 0 -10000");
%bot.setMoveObject(%trg);
%bot.setTrigger(0, true);

// ...
// ... when boost, aka attack is over (%bot is the bot, %obj is the player)
%bot.stop();
%bot.setTrigger(0, false);
%obj.setTransform(%bot.getTransform());
%obj.setDamageLevel(%bot.getDamageLevel());
%obj.client.setControlObject(%obj);
%bot.delete();

Of course not complete, fill in dem' missing parts.
« Last Edit: January 13, 2011, 03:17:49 AM by Bauklotz »

If %obj is the player, and %trg is the target:
Code: [Select]
%bot = new AIPlayer() {
    position = %obj.getPosition();
    datablock = %obj.getDataBlock();
};
%bot.setDamageLevel(%obj.getDamageLevel());
%bot.mountImage(%obj.getMountedImage(0), 0);
%bot.mountImage(%obj.getMountedImage(1), 1);
// copy appearance of %obj to %bot
%obj.client.camera.setOrbitMode(%bot, effin, forgot, dem, args);
%obj.client.setControlObject(%obj.client.camera);
%obj.setTransform("0 0 -10000");
%bot.setMoveObject(%trg);
%bot.setTrigger(0, true);

// ...
// ... when boost, aka attack is over (%bot is the bot, %obj is the player)
%bot.stop();
%bot.setTrigger(0, false);
%obj.setTransform(%bot.getTransform());
%obj.setDamageLevel(%bot.getDamageLevel());
%obj.client.setControlObject(%obj);
%bot.delete();

Of course not complete, fill in dem' missing parts.
So, this won't work?

So, this won't work?
what exactly did you do with it because just copy+pasting it into your script was not the intended usage.