OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: RolsRois on 16 Oct 2005, 16:05:11
-
ok so, i made a mission, now i made a bike that u can buy, the trigger next to the bike goes like this:
Condition:Money >= 100
Activition: buybike = dude (he is the player) addaction ["buy bike 25$","buybike1.sqs"];
so the script goes like this, and the bike's name is bike1 lol..
;this unlocks the car
bike1 lock False
;this stops the trigger being activated again
Buybike1 = False
;this takes away the cost ofthe car from the players total money
Money = Money - 25
;this makes _money the same as Money for the next line of script
_Money = Money
;this brings up a message showing us how much money the player has
hint format ["Players Money is %1$", _Money]
dude removeaction buybike1
~2
Hint "Thanks For Buying! Come Again!";
so i get this annoying thing that whouldn't switch off the action from the player, it says something like
'dude removeaction buybike1
something like that, raelly annoying thing, can someone tell me how do i get rid of it and how do i remove this annoying action from the player?
please comment; :-X
-
Excepcted bowl... ;D
I think its expected Bool.
Anyway:
If u do:buybike = dude addaction ["buy bike 25$","buybike1.sqs"]
then U remove the action with:dude removeaction buybike
while U do:dude removeaction buybike1
or try dude removeaction (_this select 2)
-
i was wrong writing it i guess, it was
Activition: Buybike1 = dude addaction ["BUy Bike 25$","buybike1.sqs"]; and not
Activition: Buybike1 = dude addaction ["BUy Bike 25$","buybike1.sqs"];.
so anyway thanks for ur help, but its not an answer u just wrote what i wrote in the script..
can anyone help me up?
thanks
-
You are probably trying to use the same name for two different variables?
A boolean variable with a name "Buybike1":
Buybike1 = False
...and then you have a variable containing the action's ID with a name "Buybike1":
Buybike1 = dude addaction ["BUy Bike 25$","buybike1.sqs"]
...
...
dude removeaction buybike1
That messes your script totally because you are giving the removeAction command a boolean variable instead of an action ID which it is expecting to get. Make sure you do not use the same name for two different things.
The error message comes from your trigger because you have added the action and then you give the action ID to the trigger as condition, which should instead be a boolean variable and that's why you get an error message "Expected: bool".
(And remember, OFP variable names are case insensitive so you can't have different variables named var and Var because they mean the same to OFP.)
-
i didn't know that and im not sure cause one, Buybike1 = false makes sure i wont use that trigger again, and removeaction buybike1 makes the player to remove this praticelur action from the actions menu
-
In your script, buybike1 isn't anymore pointing to the added action in the moment when you try to remove the action but it is set to "false" which doesn't help at all, you have lost the action ID at that point and thus can't remove the action anymore with "dude removeaction buybike1".
-
Simply put, make sure you use different names for the variable holding the action ID and the variable for a boolean value used in your trigger. From what you have told us, it seems like you have a variable naming conflict at your hands.
-
my bad, can u write the script in a fixed way please? it whould help a lot
here is the wrong one:
;this unlocks the car
bike1 lock False
;this stops the trigger being activated again
Buybike1 = False
;this takes away the cost ofthe car from the players total money
Money = Money - 25
;this makes _money the same as Money for the next line of script
_Money = Money
;this brings up a message showing us how much money the player has
hint format ["Players Money is %1$", _Money]
dude removeaction buybike1
~2
Hint "Thanks For Buying! Come Again!";
-
OMG! U RULE! U RULE! I TRIED WHAT U SAID AND IT'S TRUE, SORRY FOR ARGUEING WITH U, U RULE!!!!!!!!!!!!!!!!, tell me ur adress so i can send u cookies
-
Its not the script you need to change, its the actionID. So, instead of
Buybike1 = dude addaction ["BUy Bike 25$","buybike1.sqs"]
You've got....
Someothername = dude addaction ["BUy Bike 25$","buybike1.sqs"]
Also, in your script, replace
dude removeaction buybike1
with...
dude removeaction someothername
And you ought to be in the zone....
-
::)
:thumbsup:
-
::)
:thumbsup:
Thanks Gogs for clarifying more what I meant.
RolsRois, it would probably be a good idea to get familiar with OFPEC TAG's (http://www.ofpec.com/tags_about.php) because your global variables are lacking a TAG and that can lead to more problems with variable names (which can be harder to spot than this one).
#EDIT oops one post too much.