Author Topic: Some coding questions -answered for now-  (Read 469 times)

Hey all.
As a learning scripter, i am still working on my TF2 Ai.
But to make it work as i want, i need to change a damn lot of the code.

Now to my questions.
I will keep this list of questions up-to-date right here, so don't worry, you won't answer an old question.

-1-
Can i do something like this?
Improved, thanks to Choneis.
No need for answers anymore.
Code: [Select]
datablock PlayerData(putainamehereZombie : PlayerStandardArmor)
{
//blahblahblahstandardstuffhere
primary = TF2Flamethrower;
};
function LordiciansAiMainZombie::SpecialAttack(%this,%onshot)
{
if(getsimtime() >= %this.lastspecial+3000 && %this.getstate() !$= "Dead")
{
%this.unmountimage(0);
%primary = %this.getdatablock().primary @ "image";
%this.mountimage(%primary, 0);
%ran = getrandom(-1,1);
%ran2 = getrandom(-1,1);
%this.setmovex(%ran);
%this.setmovey(%ran2);
schedule(0,0,BotShootMode,%this);
schedule(500,0,BotShootMode,%this);
schedule(1000,0,BotShootMode,%this);
schedule(1500,0,BotShootMode,%this);
%this.schedule(2800,clearmovex);
%this.schedule(2800,clearmovey);
%this.lastspecial = getsimtime();
}
}
The function will be situated in the server.cs and be packaged of course while the datablock will be in the Ai script itself.

Probably the (%primary)image is wrong, but i'd like to know if it's possible to do something like that and if yes, how?


Thanks in advance
« Last Edit: December 17, 2009, 05:36:29 PM by lordician »

3 syntax errors.

primary = TF2Flamethrower
needs ending ;

datablock does not end in };

%this.mountimage((%primary)image, 0);

instead of
%primary = %this.getdatablock().primary;
%this.mountimage((%primary)image, 0);

do

%primary = %this.getdatablock().primary @ "image";
%this.mountimage(%primary, 0);

3 syntax errors.

primary = TF2Flamethrower
needs ending ;

datablock does not end in };

%this.mountimage((%primary)image, 0);

instead of
%primary = %this.getdatablock().primary;
%this.mountimage((%primary)image, 0);

do

%primary = %this.getdatablock().primary @ "image";
%this.mountimage(%primary, 0);
Thanks, will try soon.
Also, i was in a bit of a hurry when typing up this example, so i forgot the obvious things like }; and ;

EDIT:
If i understand it, the @ "image" adds the word image to it?
Hmm, learned another thing today. :)
« Last Edit: December 17, 2009, 05:32:37 PM by lordician »