![]() |
Arrays....
Hello, Im working on a script that uses arrays. This script puts images randomly across the board. That part is fine, but....its the script that goes with it. Ive tried everything....from in to arraylen(which i found out really wasnt worth trying lol). I need to know how to detect if there is an image in front of the player. It wont detect anything, because its an array, and it's value is always 10 because of setarray blach,10; I did however, use level. vars...so the other NPC CAN detect the images, but all of the commands ive tried wont work. Can anyone help me? If you need the coding...i guess i could post it, though I thought this was sufficient.
|
umm
I have 10 values of arrays in x,y form. level.fishx and level.fishy. What i want to do, is when the player is near a level.fishx,level.fishy i want it to trigger another command, but this is difficult w/arrays. Can it be done?
Ill post the code. NPC Code: That is the weapon part, that detects. This (below) is the array part, that does the images. NPC Code: Lot of code, lol. Anyways, im trying to get it to where it sets client.hasfish=1 when client.spearing=1 if the player is close to a fish. Can you help me? (Ive got it to set client.spearing=1, lol.) |
couldnt you use strings?
like if (Action) {setstring image,random(1,6); set random; } while (random) { showimg #s(image),30,30; } or something if you're just showing random images? |
i guess...
i guess i could. But that takes all the fun outta it ;). I wouldnt have to use strings...i could do what im doing, except not use arrays. level. controls vars for the whole level, which is great for this script. I guess there is no way to do it with arrays :(. I like using arrays, because they are new to me. I just learned them a few weeks ago. They are great for weather scripts and stuff. I guess i have a small enough amount of images to do each one individually, but....it would also make my weapon script longer. Id have to detect each Image differently because they would all have different values instead of the arrays where they are all level.fishx,level.fishy. there would be level.fishx1,level.fishx2,level.fishx3 ect. Ill work something out since noone has a clue either. This is gonna be a great script once its finished :-).
|
yes
yes, thats what i want.....
How do i do it? |
umm
yeah, i know how to do it without using arrays. But i want lots of fish. So, what do you suggest?
|
okay, so that would tell me the distance.... from the player to the fish.
so i would put if (distance<=5) {client.hasfish=1; } ?? And that script would make it so it would have the distance of every fish that appears? |
n/m
Ahh forget it. I decided to use an NPC for each fish, and have the NPC detect the player, instead of having the player detect the NPC....much easier. I finished my script in like 10 minutes this way....
Thanks for your help though! |
| All times are GMT +2. The time now is 07:18 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.