There are two ways to do this.
First is to override Tick in your player class, this will make it only your-mod-specific:
Code: Select all
Override void Tick(){
Super.Tick();
friction=0.94;
If(player.cmd.forwardmove || player.cmd.sidemove){
friction=1;
}
}
The other is to create a new item and do the same with in the item's DoEffect override:
Code: Select all
Class FrictionItem : Inventory{
Override void DoEffect(){
Super.DoEffect();
//This time we will use the owner pointer.
If(!owner || !owner.player){Destroy();}
owner.friction=0.94;
If(owner.player.cmd.forwardmove || owner.player.cmd.sidemove){
owner.friction=1;
}
}
}
Now to automatically give this item to the player, you will want to use an
event handler, like so:
Code: Select all
Class FrictionHandler : EventHandler{
Override void PlayerEntered(PlayerEvent e){
let playe = players[e.PlayerNumber].mo;
If(!playe.FindInventory("FrictionItem")){playe.GiveInventory("FrictionItem",1);}
}
}
Make sure to also include the event handler in MAPINFO:
Code: Select all
GameInfo{
AddEventHandlers = "FrictionHandler"
}