Lol, that makes huge sence! How do you think of all this. I didn't realise it could be so easy, using only 2 variables, the temporary_variable takes the weapon# value, then the script changes the weapon of the player using the MY_WEAPON variable and after this is done, the MY_WEAPON variable get's the value from the temporary_variable, simply genious
![Shocked :shock:](./images/smilies/icon_eek.gif)
!
OK, now I have some order execution problems...
the script looks like this:
Code: Select all
{
temporary_variable [0]
WEAPON [4]
Setup[ ()
{
Console(true);
SetNoCollision(true);
NewOrder("StandBy");
} ]
StandBy[ ()
{
PlayerDistOrder(200, "DoIt");
} ]
DoIt[ ()
{
LowLevel("Action");
} ]
Action[ ()
{
self.ThinkTime = 0.1;
if(self.key_pressed=14)
{
self.think = Give;
}
if(self.player_range>200)
{
HighLevel("StandBy");
return 0;
}
} ]
Give[ ()
{
self.ThinkTime = 0.1;
if(GetAttribute("weaponslot","Player") = 1)
{
temporary_variable = GetAttribute("weapon1","Player");
SetAttribute("weapon1",WEAPON,"Player");
WEAPON = temporary_variable;
}
if(GetAttribute("weaponslot","Player") = 2)
{
temporary_variable = GetAttribute("weapon2","Player");
SetAttribute("weapon2",WEAPON,"Player");
WEAPON = temporary_variable;
}
if(GetAttribute("weaponslot","Player") = 3)
{
temporary_variable = GetAttribute("weapon3","Player");
SetAttribute("weapon3",WEAPON,"Player");
WEAPON = temporary_variable;
}
} ]
}
The script checks if the player is in the range, executes the "Action" order, but when I press "Q", the script should execute the "Give" order, where it will check which weapon slot I'm using and give set the right weapon attribute to 4, but why, when the script could just crash the game
![Laughing :lol:](./images/smilies/icon_lol.gif)
(yeah, the game crashes after I've pressed "Q").
I have the feeling that there's something wrong in this line:
Code: Select all
if(self.key_pressed=14)
{
self.think = Give;
}
I see nothing wrong here, but I see nothing wrong nowhere in the script, and I think that maybe here's the problem.
Why, you bad script? Shouldn't you execute the "Give" and show in the console if there's a problem
![Twisted Evil :twisted:](./images/smilies/icon_twisted.gif)