Difference between Item and Skill Note?

Hi there,


I wrote a script to capture enemies. I can call it from skills with:


<Custom Execution>


capture();


</Custom Execution>


If I use the same note on a Item it doesnt work! The Item is set to choose a enemy ofc....but nothing happens.


Does the Item choice mb dont count like selecting a enemy with a skill?


Or maybe I dont reach my script at all - someone has experience with these noteboxes and the difference between?


Thx
Noteboxes are noteboxes.  A text field that you can put anything you want to in them.  They have no purpose.


It is your script that gives them a purpose.  So if it's not working, it's because of something in your script.


There are different functions for using an item and using a skill.  Maybe you just haven't added the code for the item function.  If you need more help, it is the script we need to see, not what you've put in the notebox.
this.capture = function (){

$gameVariables.setValue(2,Math.randomInt(100)+1);

if($gameVariables.value(2)>30)
{
$gameVariables.setValue(1, $gameVariables.value(1)+1);
$gameActors.actor($gameVariables.value(1)).changeClass($gameTroop.members()[0]._enemyId, false);
$gameActors.actor($gameVariables.value(1)).setName($gameTroop.members()[0].name());
$gameActors.actor($gameVariables.value(1)).changeLevel($gameTroop.members()[0].level , false);
$gameParty.addActor($gameVariables.value(1));
BattleManager.abort();

}else{

$gameMessage.setFaceImage('Actor1',0);
$gameMessage.setBackground(1);
$gameMessage.setPositionType(1);
$gameMessage.add("It escaped!");
}
}




There is the Script ...but like I said. It works inside of the skill note box. So there has to be a difference to the one on items.
I guess I just dont reach it without adding the parent adressed with "this" in the script. Possibly the same parrent of the note box in the skill - so that reaches it.


But I'm quite new to js, just a wild guess...
that is only a part of the script.  What's its context?  What is this?  There's nothing in there that looks at any skill notes.  We need to see the whole thing, not just a little snippet that has nothing to do with reading the note.


You know that's just choosing the first of the enemy troop, not the target selected by the player, right?
True - But I have just one enemy. So it worked totally fine with picking the first available enemy.


And that is the whole script! Maybe you can delete the this... I just put it in for try and error after looking into other scripts.


I just started the whole thing in the note box of a skill and tried to export it outside afterwards. (by 90% copy and paste)


It worked that way!...maybe it's not a masterpiece of a script so ^^


But like I said...it totally works for skills.



EDIT: Okay....maybe I just had to restart the maker but this try it even worked for items. I'm quite sure it didn't last try.
Still some strange issues like that the enemy attacks after Item use, but before ending the fight. But my initial problem "seeeems" to be solved 😳
 
You MUST have something that reads the noteboxes and does what's inside them.  If you didn't write it yourself, then you've got a plugin that does it, and you've formatted your note-tag for use by the plugin.  That information (what plugin you're using) would have been really helpful in the first post, as you really made it sound like you'd written your own.
True! I should have a plugin there to read the </Custom Execution>



If I remember right it should be one of Yanflys... But except for that (and a lot of other plugins) its all I wrote into the .js for my plugin.


Anyway - it seems to work for now. I'm sure there will have to be a lot of change before then end, but it will be enough for the first Alpha/Beta Version.


I'm sure I will have to handle some issues sooner or later, but that can be done "later".


Thanks for your help and fast answers,


gotta go to sleep for now >.<


Enjoy your evening in Australia

Original thread: https://forums.rpgmakerweb.com/threads/difference-between-item-and-skill-note.66082/