Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - exidyne

Pages: [1]
1
Modification Help / Re: Admin only vehicle
« on: June 30, 2008, 06:33:02 PM »
Code: [Select]
        if( %slot == 0 && %state == 1 )
        {
            if( isObject(%vehicle) && (%obj.client.isAdmin || %obj.client.isSuperAdmin) )
            ...

2
Modification Help / Re: Mounting an object once a projectile hits
« on: June 30, 2008, 12:13:32 PM »
Well, it makes no different what you mount.
Can't you just use the player's eye position, then?

Code: [Select]
function ProjectileData::onCollision(%this, %obj, %col, %fade, %pos, %normal)
{
   %obj.targetPosition = %obj.getEyePoint();
}

EDIT:
Ah, I see your dilemma.

3
Modification Help / Re: Mounting an object once a projectile hits
« on: June 30, 2008, 11:35:18 AM »
You say you're trying to get AIPlayer::setAimLocation to work better, but this code looks like it mounts a gun item on a player's head.

Are you trying to mount a bot on a player's head and use the bot to aim the player? If so, it may look something like this:

Code: [Select]
        ...

%player = %client.player;

if( !isObject(%player.targetObject) )
{
%player.mountObject( %player.targetObject = new AIPlayer()
{
dataBlock = %player.getDataBlock();
position = %client.player.getTransform();
rotation = "1 0 0 0";
scale = "1 1 1";
} , $headSlot );
}

        ...

I remember having problems mounting things on players as well.

4
Modification Help / Re: Point-in-cylinder
« on: June 15, 2008, 01:28:51 PM »
This was tricky
Code: [Select]
function is_in_cylinder(%pt, %vec, %rad, %ht, %norm)
// "pt" is the point you're checking
// "vec" is actually the bottom of the cylinder
// "rad" and "ht" are the radius and height of the cylinder
// "norm" is the normalized vector relative to the bottom of the cylinder

{
%top = VectorAdd(%vec, VectorScale(%norm, %ht SPC %ht SPC %ht));
%center = VectorAdd(%vec, VectorScale(%norm, (%ht/2) SPC (%ht/2) SPC (%ht/2)));
%vec1 = VectorSub(%pt, %top);
%vec2 = VectorSub(%top, %vec);
%dist = mAbs( VectorCross(%vec1, %vec2) ) / VectorLen(%vec2);

if( %dist > %rad ) return false;
else
{
%start = 0;
%hit = VectorScale(%norm, %start);
while( true )
{
if( VectorDist(%pt, %hit) - %dist < 0.005 )
break;
else if( %start > %ht )
return false;

%start += 0.005;
%hit = VectorScale(%norm, %start);
}

if( VectorDist(%hit, %center) > VectorDist(%vec, %center) )
return false;
else
return true;
}
}

5
Off Topic / Re: Best Place to Learn C++
« on: June 14, 2008, 12:03:04 PM »
Do not use torque. You can download resources for C++ that are useful for 3D games; I'm starting to work with OpenGL myself.

C# isn't bad when it comes to graphics, but it's not as popular, portable, or useful as C++.

If you're looking for a good compiler, I use Dev-C++.

6
Modification Help / Re: Lvl Coresponding to Exp?
« on: June 13, 2008, 04:50:25 PM »
Capitalization makes no diffrence.

it's a syntax error

7
Modification Help / Re: Lvl Coresponding to Exp?
« on: June 13, 2008, 03:34:32 PM »
This is called debugging and it's important that you can do this so you don't have to make a new topic every time you get a syntax error.

The problem is the message "\c5Lvl: %1" (where %1 is the client's level) prints "Lvl: ". In other words, it's saying the client's level is blank, right? That means you never assigned a value to the client's level.

Now, you go into your code and figure out why the client's level has no value. The function that's supposed to give a value to the client's level is the Rpgset(), where you say:
Code: [Select]
If(%Client.exp >= 0);
%Client.Lvl = 1;

If(%Client.exp >= 50);
%Client.Lvl = 2;

That's not even torque script. You have extra semi-colons in there and keywords shouldn't be capitalized.


Eonz, the console tells you where you have errors in your code.

8
Modification Help / Re: Yes/No Box
« on: June 12, 2008, 04:34:35 PM »
They weren't included because the general function allows any piece of code to be executed

They're all just as dangerous - there's no reason to keep the other functions hidden from the server.

9
Modification Help / Re: Optional Parameters
« on: June 09, 2008, 06:18:34 PM »
That would be valid in C-derived languages, but torque doesn't support optional parameters. You really don't need them though, because torque doesn't care about how many parameters there are:

Code: [Select]
function foo(%need, %not)
{
   if( %not $= "" )
   {
      // They didn't give a '%not' paramter
      // Or they put an empty string here
      echo("Optional parameter wasn't used.");
   }
   else
   {
      echo("Optional parameter was used.");
   }
}

The amount of parameters you provide doesn't matter:
Code: [Select]
foo("Hello"); // 'Optional parameter wasn't used'; the second param is set to: ""
foo("This", "is", "rather", "unnecessary"); // 'Optional parameter was used'
Extra parameters are ignored.

10
Modification Help / Re: Keybind System?
« on: June 09, 2008, 05:28:50 PM »
It's a client-side feature. This would call someFunction(3) whenever you press 'x':
Code: [Select]
moveMap.bind(keyboard, "x", "someFunction", 3);
If the bind should be used even when you're not in-game, use globalActionMap instead of moveMap.

It's also possible to make a more complex keyboard bind that can do more than just call a function.

11
Modification Help / Re: Forging?
« on: June 08, 2008, 09:14:01 PM »
Why would you assume that I know anything about a /buy script? Like I said, you have to give me all the details because I can't read your mind. But it's fixed now .

By the way, now that I see your /buy code, you need to delete all of the item prices in the /buy script so they don't override the existing prices. Then replace:
Code: [Select]
      %price_of_item = $itemPrices[%item] * %amount_to_buy; // Calculate price
with:
Code: [Select]
      %price_of_item = firstWord($itemPrices[%item]) * %amount_to_buy; // Calculate price

12
Modification Help / Re: Forging?
« on: June 08, 2008, 09:10:31 PM »
So make each item cost 0 gold in the item prices...

13
Modification Help / Re: Forging?
« on: June 08, 2008, 08:55:41 PM »
Alright, this code should now work and be compatible with your other code.

14
Modification Help / Re: Forging?
« on: June 08, 2008, 08:52:54 PM »
I need to know how you're storing the client's gold.
In other words, what's your code for /grantgold and /checkgold?

15
Modification Help / Re: Forging?
« on: June 08, 2008, 08:43:13 PM »
Try my script again, it works fine for me:
Quote
/forge GoldOre 1
Forging costed you: 50 gold, 5 SilverOre, and you now have 1 GoldOre.

You might not have enough gold...
Try: ClientGroup.getObject(0).gold = 9999;

Pages: [1]