![]() |
another array question
k, I made my hat NPC, no one helped me :(
But I have it so when you pick up the NPC it sets an array.It uses client.hats for the variable. question: why is it when I make a variable like client.hats[0]=1; it only stays true for that level, and goes false for any other level? |
bump
I need help someone :( plz |
LOL. I h8 arrays. Otherwise I would help. Arrays are one of the few things I'd prefer not to script unless I have to, they annoy me. Maybe soon I'll take the time to understand them more fully. Beg the great Kai and he may help, he he.
---Shifter |
Quote:
I beg apon the almighty Kai, I need your supirior(sp?) knowledge about scripting arrays :megaeek: |
If you're using VARIABLES, as opposed to strings, and it's offline, then you won't have much luck. Unless a NPC weapon sets a this. var, variables are attatched to the level, not the player. Anyway, I seem to recall Kaimetsu saying there is no such thing as a client. variable; it will work, but it's no different to calling a variable anything else. Diagram is below.
http://members.aol.com/irnet22350/diagram.png Note: to save hats, it's probably better to use strings. Variables have a nasty habit of clearing whenever you reconnect, or at least they do in my experience. |
Ah, the almighty Growlz has come to aid you, heh. GrowlZ and I worked back on Sans, he's smart, maybe rivaling Kai? He he.
---Shifter |
Quote:
|
Quote:
|
Quote:
Umm.. I don't know of any such thing as string arrays. Maybe they exist, but I've never come across one. You can probably simulate something like 'em, but if you're using strings now, why don't you just have a piece of code that, when the player picks up a hat, checks whether or not the player already has that hat (doing strcontains on a string), and adds it to their list? If, as I presumed, you're using the array to track what hats the player has, rather than the mode of the weapon, configuration, etc., this would probably work better. It'd be my choice, anyway. (Unless, of course, you want the player to be able to carry more than one of a hat. Then we could potentially get into the confusing world of string indexes which I don't exactly want to go over unless I really, really, really have to.) |
Quote:
NPC Code: I use that to check if the player has the the hat, so how could I replace this to check for a string. If you would like to see the script, my MSN email is [email protected] |
Quote:
NPC Code: ... will check if the number 1 (the hat's number) is in the client.hats string, so basically, will have the effect of checking if the player has a certain hat (in this case, hat 1). |
Quote:
NPC Code: |
Quote:
|
Quote:
|
-FooL-
Quote:
insertstring removestring replacestring deletestring #I() For() [edit] sarraylen() [/edit] Need I say more? |
| All times are GMT +2. The time now is 01:08 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.