Thank you for the answer, yes, when the player picks up the item and saves it, if you want to use it, ↓↑A use it, if the player does not have the item, the use failure animation will be executed, if there are 2 items, the first one will be covered (first pick up prop 1 then prop 2 overrides prop 1).Let's elaborate this further, when you say 1P picks up item 1 , 1P stores the item instead of immediately use it right?
Then ↓↑a is how to use the item, will player play fail to use item animation when there's nothing to be used?
Picking another item will remove stored item and put latest one instead. I prefer dropping former item though.
If this is how it works, you'd need to code inventory system. At least inventory with one slot. I recommend coding display script also to show player what item player is currently carrying.
There's no tutorial for this (yet) cause inventory and display system are designed to fit certain game only, both gameplaywise and visually. IOW you'd need to code these system yourself.
name BriannaSummon
type item
score 1
shadow 0
gfxshadow 1
nolife 1
facing 1
icon data/chars/misc/empty.gif
didhitscript data/scripts/item/summonNpc.c
anim idle
loop 0
delay 1
offset 8 15
bbox 0 0 16 16
frame data/chars/misc/BriannaSummon.gif
void main()
{
void self = getlocalvar("self");
void target = getlocalvar("damagetaker");
void name = getentityproperty(self, "defaultname");
int pIndex = getentityproperty(target, "playerindex");
if(name == "BriannaSummon"){setglobalvar("summon"+pIndex, "BriannaNpc");}
if(name == "ZoeSummon"){setglobalvar("summon"+pIndex, "ZoeNpc");}
}
name ZoeNpc
type npc
health 1
shadow 0
gfxshadow 1
nomove 1 1
icon data/chars/misc/empty.gif
diesound data/sounds/di1.wav
candamage enemy obstacle
subject_to_wall 1
subject_to_hole 1
subject_to_screen 1
no_adjust_base 0
animationscript data/scripts/animation.c
anim idle
loop 0
delay 999
offset 72 131
jumpframe 2 4 1 0
hitflash blood
hitfx data/sounds/swd.wav
frame .................
void summonNpc()
{
void self = getlocalvar("self");
int pIndex = getentityproperty(self, "playerindex");
void summon = getglobalvar("summon"+pIndex);
if(summon != NULL()){
loadmodel(summon);
spawn01(summon, 0, 250, 0);
setglobalvar("summon"+pIndex, NULL());
}
}
void spawn01(void vName, float fX, float fY, float fZ)
{ //spawn01 (Generic spawner)
//Damon Vaughn Caskey
//07/06/2007
//
//Spawns entity next to caller.
//
//vName: Model name of entity to be spawned in.
//fX: X location adjustment.
//fZ: Y location adjustment.
//fY: Z location adjustment.
void self = getlocalvar("self"); //Get calling entity.
void vSpawn; //Spawn object.
int iDirection = getentityproperty(self, "direction");
clearspawnentry(); //Clear current spawn entry.
setspawnentry("name", vName); //Acquire spawn entity by name.
if(iDirection == 0){ //Is entity facing left?
fX = -fX; //Reverse X direction to match facing.
}
fX = fX + getentityproperty(self, "x"); //Get X location and add adjustment.
fY = fY + getentityproperty(self, "a"); //Get Y location and add adjustment.
fZ = fZ + getentityproperty(self, "z"); //Get Z location and add adjustment.
vSpawn = spawn(); //Spawn in entity.
changeentityproperty(vSpawn, "position", fX, fZ, fY); //Set spawn location.
changeentityproperty(vSpawn, "direction", iDirection); //Set direction.
return vSpawn; //Return spawn.
}
void main()
{
void self = getlocalvar("self");
int dead = getentityproperty(self,"dead");
void type = getentityproperty(self, "type");
int p = getentityproperty(self, "playerindex");
void summon = getglobalvar("summon"+p);
int layer = 60000;
int xPos = 119;
int yPos = 18;
int xDif = 160;
int xAdd = xDif*p;
if(getglobalvar("BriannaIcon") == NULL()){setglobalvar("BriannaIcon", loadsprite("data/chars/misc/BriannaSummon.gif"));}
if(getglobalvar("ZoeIcon") == NULL()){setglobalvar("ZoeIcon", loadsprite("data/chars/misc/ZoeSummon.gif"));}
if(openborvariant("in_level") && type == openborconstant("TYPE_PLAYER")){
if(dead != 1 ){
if(summon != NULL()){
void icon;
if(summon == "BriannaNpc"){icon = getglobalvar("BriannaIcon");}
if(summon == "ZoeNpc"){icon = getglobalvar("ZoeIcon");}
drawsprite(icon, xPos+xAdd, yPos, layer);
}
}
}
}