KingOfTheKeyboard | 03/17/11 08:56 pm - Last edited 03/21/11 05:07 pm by KingOfTheKeyboard | Filter |
|
Graduate
Awards:
Group: Member Posts: 156
| I have a problem with one of my scripts, please examine the code carefully:
//This script stores the pokemon's base stats, moves, etc. and returns them based on argument0 (the index of the pokemon)
var index;
index=argument0;
if index=1 { //Missingno
name="Missingno";
dexNumber="000";
baseHP=49
baseAttack=50
baseDefence=54
baseSpeed=200
baseSpecialAttack=49
baseSpecialDefence=60
move[1]=1}
The purpose of this script is to return the base stats and information of the particular pokemon when called upon (based on argument 0) by setting the local variables of the object that is calling the script.
However, the script will not return anything. I have done a LOT of troubleshooting, and I am 100% certain that it is the script. The arguments are not being called properly, which I think is causing the problem. A hint to what may have gone wrong is when I delete the whole (var index;) and the (if index=1) part, it works. (This solution will obviously not work if I add more pokemon)
Also, this is the code that calls the script (apparently none of my scripts are working properly if there are arguments):
scr_pokemonstats(oppIndex)
I would appreciate any help on this
------------
PARTY LIKE A |
|
Iasper | |
Dual Master
Awards: Group: Member Posts: 1099
| Not sure what caused it, but try this: remove the var index and index=argument0 and then change it to if argument0=1
It might work then.
------------
|
|
KingOfTheKeyboard | |
Group: Member
| Thanks, Ill try as soon as I can access my computer |
|
Dark Matter | |
Champion
Awards:
Group: Member Posts: 4563
| Do you actually mean return? Because if so, you've missed out the return bit...
------------
Want to know when a pokemon evolves or what moves it learns? Having trouble uncovering hidden items? Visit the Official Pokemon Twilight Guide!
Got any questions about PT or the forums? Visit the FAQ!
Official Beta Tester for Pokemon Twilight
Highest poster on the GFF
Most active member on the GFF
66 (+2 special) out of 66 Pokemon Obtained on PTV5! Every single one of 'em!
|
|
KingOfTheKeyboard | |
Group: Member
| No no, i dont mean the return fuction, I just expect the script to set the local variables accordingly, but nothing doing. Unfortunately I will not have time to work on it until sunday, but the only solution I can think of that is fool proof would be to run the script multiple times, returning each individual variable |
|
Bouncy Ball | |
Champion
Awards: Group: Mod Posts: 4057
| It appears to work for me with the exact script copied into gamemaker.... it returns nothing but sets those variables (with those spellings) to that data. so to access it you use those variables. I see no reason why it wouldn't work....
------------
|
|
KingOfTheKeyboard | |
Group: Member
| I seriously have no idea why it wont work... I must dodecatuple check this... |
|
Bouncy Ball | |
Group: Mod
| are you sure that this is the exact code? can you post a stripped example or something? |
|
KingOfTheKeyboard | |
Group: Member
| THIS ISSUE HAS BEEN RESOLVED, turns out there is a vital error that is outside of the code I have given you, it is fixed now |
|
Game Fortress | |
The Big Cheese
Awards:
Group: Admin Posts: 425 Donor: $0.01
| I would suggest using a switch statement.
switch(argument0);
{
case 1:
name = "omgimon";
baseatk = 200;
basespatk = 200;
etc = etc;
break;
case 2:
name = "zomgimon";
baseatk = 250;
basespatk = 250;
etc = etc;
break;
}
------------
|
|
Dark Matter | |
Group: Member
| Trust GF to bump a solved 2 month old topic... |
|
Bouncy Ball | |
Group: Mod
| Better than the half-dead Skell topic or the pt/pkmn spin-off one |
|
KingOfTheKeyboard | |
Group: Member
| Thank you bouncy for the compliment, my dead threads are still attractive |
|
Dark Matter | |
Group: Member
| QUOTE: Bouncy Ball Better than the half-dead Skell topic or the pt/pkmn spin-off one
Half dead......
It was less dead than this topic. |
|