Script Basics

The_Gambit

New member
Player maximum mp is 50. I'm trying to change the max mp of a player to 75 when they pick up an item in their "Get" animation. This script does not seem to work. What am I doing wrong? I'm total n00g :-[
Thanks.


        @script{
void maxmp = getplayerproperty(0, "maxmp");
//changeplayerproperty(0, maxmp, 75)
}
@end_script

 
just checked the source code and playerproperty does not support maxmp !



Code:
int mapstrings_playerproperty(ScriptVariant **varlist, int paramCount)
{
    char *propname;
    int prop;


    static const char *proplist[] =
    {
        "colourmap",
        "combokey",
        "combostep",
        "credits",
        "disablekeys",
        "ent",
        "entity",
        "hasplayed",
        "hmapl",
        "hmapu",
        "inputtime",
        "joining",
        "keys",
        "lives",
        "mapcount",
        "name",
        "newkeys",
        "numweapons",
        "playkeys",
        "releasekeys",
        "score",
        "spawnhealth",
        "spawnmp",
        "weapnum",
        "weapon",
    };


it looks like your typing it right onto frame data so try this:


Code:
@cmd changeentityproperty getlocalvar("self") "maxmp" 75
@cmd changeentityproperty getlocalvar("self") "mp" 75
[/size]the second one it to change current mp to match max.
 
Thank you!
Your @cmd changeentityproperty getlocalvar("self") "maxmp" 75 works great! I was using the player property maxmp because it was listed under properities in "getentityproperty(entity, propname) / changeentityproperty(entity, propname, values)" in the manual. Thanks again for the replies!

PS: I dont suppose there is anyway to add health regen at a constant rate to a Char file without adding it to each individual animation?
 
For sure its possible. You can use a code in ondrawscript.

I was using the player property maxmp because it was listed under properities in "getentityproperty(entity, propname) / changeentityproperty(entity, propname, values)" in the manual.

Not all player properties are possible to be modified. Some are read only. DC  was working on a post at wikia explaining this, check it out.
 
Ok I have this script that is supposed to check to see if you are pressing 'right' or 'left' when you hit the 'special' button. If so, it is to play freespecial8. The script works, but only for player 1. Player 2 seems to ignore the script completely. What do I need to do to make it work for whatever player is using this character?

Code:
anim	freespecial4
	com	A3 freespecial4
	energycost	4
	mponly	1
	loop	0
	fastattack 1
	offset	82 111
	bbox	65 37 45 74
	delay	5
	@script
	if (frame<=1){
    	       void self = getlocalvar("self");
		void mana = getentityproperty(self,"mp");
    	       int iPlIndex = getlocalvar("player");
		
               void iLeft = playerkeys(iPlIndex, 0, "moveleft"); // New key status of "Left"
               void iRight = playerkeys(iPlIndex, 0, "moveright");
               if((iLeft)||(iRight)){
 	                          if (mana>=0 && frame <= 2)
			performattack(self, openborconstant("ANI_FREESPECIAL8"));
        }
	}
	@end_script
	frame	data/chars/loki/r4.gif
	sound	data/sounds/icem9.wav
	@cmd	mpcost 2
	frame	data/chars/loki/r5.gif
	attack	100 39 111 40 10 2 0 0 0 0
	frame	data/chars/loki/r6.gif
	delay	2	
	attack	0 0 0 0 0 0 0 0 0 0
	frame	data/chars/loki/r7.gif
	delay	2
	freeze	100 39 111 40 10 2 0 0 0 0
	frame	data/chars/loki/r8.gif
	delay	2	
	attack	0 0 0 0 0 0 0 0 0 0
	frame	data/chars/loki/r9.gif
	delay	2
	freeze	100 39 111 40 10 2 0 0 0 0
	delay	2	
	attack	0 0 0 0 0 0 0 0 0 0

I have tried replacing the:

"int iPlIndex = getlocalvar("player");"
with
"int iPlIndex = getentityproperty("self", "playerindex");

but this crashes the game when I trigger the script.
 
Back
Top Bottom