Page 3 of 7

Re: Shooting - How is it done?

PostPosted: Wed Dec 15, 2010 11:41 am
by Lacotemale
Here is where I put it: (actor)ammoCount >> Draw Actor >> Set Text. However it just shows that text.. not the variable.

//Another silly picture removed :D

Re: Shooting - How is it done?

PostPosted: Wed Dec 15, 2010 11:54 am
by skydereign
Don't use Set Text. Use Script Editor. sprintf is a function, so you have to use it in script. Generally it is better not to use Set Text, as you have the string functions, like sprintf.

ammoCount -> Draw Actor -> Script Editor
Code: Select all
sprintf(text, "%i", clip);

Re: Shooting - How is it done?

PostPosted: Wed Dec 15, 2010 12:25 pm
by Lacotemale
I already tried putting in script here:

ammoCount -> Draw Actor -> Script Editor

This is what shows up:
:|

//Yet another silly picture removed :lol:

Re: Shooting - How is it done?

PostPosted: Wed Dec 15, 2010 12:28 pm
by schnellboot
Lacotemale wrote:
[show actor].textNumber = clip;


What do you mean by [show actor]? What do I have to put there? :?

actor showing the amount of the clip

Re: Shooting - How is it done?

PostPosted: Wed Dec 15, 2010 12:32 pm
by skydereign
That is because you did not make the actor a text actor. For any of this to work, you'll need to add some default text to the text actor. Since Set Text has already worked for you, that means you have inputed a text file. Now what you need to do is insert a 0 in the default text zone. So on the actor control panel, click text. This is where you added your .ttf file, in the big box, put the zero, and your actor is officially a text actor.

Re: Shooting - How is it done?

PostPosted: Wed Dec 15, 2010 2:57 pm
by Lacotemale
LOL after putting 0 in the text it works! :D I wish somebody told me sooner. Thanks!! :wink:

Re: Shooting - How is it done?

PostPosted: Wed Dec 15, 2010 6:59 pm
by Lacotemale
Hmm... why does changeAnimation not work inside my script located here?:

aimer >> Left mouse down >> script.

Any changeAnimation code does nothing in the script. Anything wrong with this??

if(weapon <1 && right==1)
{
ChangeAnimation("Player", "stab-right", FORWARD);
}

else
ChangeAnimation("Player", "stab-left", FORWARD);


Also can more than one statement be given to else? Like shown below:

else
{
PlaySound2("data/noammo.wav", 1.000000, 1, 0.000000);
ChangeAnimation("Player", "beretta-empty-left", FORWARD);
}


The sound plays but it does not change the animation.

Any more help with these things would be great! :)

Re: Shooting - How is it done?

PostPosted: Thu Dec 16, 2010 1:47 am
by skydereign
There shouldn't be any problems with ChangeAnimation. The only things that cause the actor not to change animation, is spelling either the actor's name, or animation name wrong. Are you sure it is "stab-right"? Also yes, more than one statement can be used in else. You can also use else if().

Re: URT - 2D

PostPosted: Thu Dec 16, 2010 1:33 pm
by Lacotemale
The file names are correct and this is all im trying to get working:

if(weapon ==0 && right==1 && left==0)
{
ChangeAnimation("Player", "stab-right", FORWARD);
}

if(weapon ==0 && left==1 && right==0)
{
ChangeAnimation("Player", "stab-left", FORWARD);
}



Ive no idea why it won't work... anyone wanna help? I can post up full code if someone is will to help me out.

Re: URT - 2D

PostPosted: Thu Dec 16, 2010 4:34 pm
by schnellboot
is the code in Draw Actor?

Re: URT - 2D

PostPosted: Thu Dec 16, 2010 7:25 pm
by Lacotemale
No the code is in: mouse click left

This is because I want to stab if the mouse is clicked and the weapon == 0 (knife).

Re: URT - 2D

PostPosted: Fri Dec 17, 2010 3:42 pm
by Lacotemale
Any help with my current issues (mostly with ChangeAnimation) would be great! Please check the issues and check the source code (on first page) to see what the hell im doing wrong! (its probably something stupid and easy to fix) :D

Then you get a nice +1 for each issue fixed! :wink:

Re: URT - 2D

PostPosted: Fri Dec 17, 2010 9:26 pm
by schnellboot
This solves both ChangeAnimation issues.
The problem was in Player -> Draw Actor.
If you need more help just tell me.

note: new variable "stab"

Re: URT - 2D

PostPosted: Sat Dec 18, 2010 7:59 pm
by Lacotemale
Thank you so much Schnellboot! For being so helpful and cool I gave you a +1... it wouldn't allow me to give you your second one but you will get it soon! :wink:

I had an idea it was to do with the Player >> Draw actor but I just didn't know how to sort it. :D

My gun empty looks quite nice but my stab animation is... so bad! :oops: Ah well im a programmer so I can't expect to be good at graphics. :D

Re: URT - 2D

PostPosted: Sat Dec 18, 2010 8:33 pm
by schnellboot
Thanks!
I uploaded a new one.
There are all player sprites in 76*100
Check it out!