Fishing System 2.0

User avatar
kjLotus
Lead Developer
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: Fishing System 2.0

Post by kjLotus » Thu Jan 23, 2014 1:18 pm

just keep a list of the valid mobids of spawnable mobs, then iterate to find the first that isnt spawned (getmobaction == 0), then move its pos behind the player (setpos + nearposition), then spawn it with spawnmob, and update its enmity to make it engage the fisher (these functions are assumed to be from script, i forget if fishing is core or script)

EDGECOM
Posts: 50
Joined: Sat Aug 04, 2012 8:31 am

Re: Fishing System 2.0

Post by EDGECOM » Thu Jan 23, 2014 3:53 pm

That is what I am doing with the exception of setting the x,y,z to position -1.0,-1.0,-1.0 so it will load the mob when the server initializes the zone other wise I can't spawn the mob

the reason I am setting the x,y,z to this is because the server will not actually spawn the mob it will just add info to the mob list.

and the fishing is core and lua its kind of weird lol I am trying to optimize it is a bit.

I hope to have a beta soon I am trying to figure out how I want to handle the bait and rod info because it need to get changed.

User avatar
kjLotus
Lead Developer
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: Fishing System 2.0

Post by kjLotus » Thu Jan 23, 2014 4:49 pm

just don't spawn mobs off the map, move them using setPos first, and make sure they despawn instead of walking back after losing combat

EDGECOM
Posts: 50
Joined: Sat Aug 04, 2012 8:31 am

Re: Fishing System 2.0

Post by EDGECOM » Thu Jan 23, 2014 7:01 pm

well here is my function I can't seem to get the mob to attack the player :/ it spawns the mob where it should though

Code: Select all

	void spawncatch(CCharEntity* PChar, uint32 mobid)
	{
		CMobEntity* PMob = (CMobEntity*)zoneutils::GetEntity(mobid, TYPE_MOB);

		PMob->m_AllowRespawn = false;
		PMob->m_SpawnPoint = nearPosition(PChar->loc.p, 2.2f, M_PI);
		PMob->PBattleAI->SetLastActionTime(gettick());
		if (PMob->PBattleAI->GetCurrentAction() == ACTION_NONE)
		{
			PMob->PBattleAI->SetCurrentAction(ACTION_SPAWN);
		}

		if (PMob->PBattleAI->GetCurrentAction() == ACTION_NONE ||
			PMob->PBattleAI->GetCurrentAction() == ACTION_SPAWN)
		{
			PMob->PBattleAI->SetLastActionTime(0);
			PMob->PBattleAI->SetCurrentAction(ACTION_SPAWN);
		}
		else {
			ShowDebug(CL_CYAN"SpawnMob: <%s> is alredy spawned\n" CL_RESET, PMob->GetName());
		}
		PMob->PBattleAI->SetBattleTarget(PChar);
		luautils::OnMobEngaged(PMob, PChar);
		PMob->PBattleAI->CheckCurrentAction(gettick());		
		
	}

I hope this is the proper method

User avatar
kjLotus
Lead Developer
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: Fishing System 2.0

Post by kjLotus » Thu Jan 23, 2014 8:19 pm

don't call onMobEngaged, setBattleTarget or CheckCurrentAction, let the AI handle those. all you have to do is add base enmity using PMob->PEnmityContainer->AddBaseEnmity

User avatar
Apocalypse612
Developer
Posts: 40
Joined: Sat Mar 30, 2013 12:00 pm

Re: Fishing System 2.0

Post by Apocalypse612 » Thu Jan 23, 2014 9:42 pm

Fished up mobs probably have their own mob IDs, hence I would assume there can be a maximum amount of fished up mobs per time in one area. I'm not really sure on this, though. From what I remember from retail camping Devil Manta.. This is probably the case. For moving the mob position, can just do X and Y +1 I would assume. Might make some mobs appear off the side of boats and stuff though :/

User avatar
kjLotus
Lead Developer
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: Fishing System 2.0

Post by kjLotus » Thu Jan 23, 2014 9:58 pm

Apocalypse612 wrote:Fished up mobs probably have their own mob IDs, hence I would assume there can be a maximum amount of fished up mobs per time in one area. I'm not really sure on this, though. From what I remember from retail camping Devil Manta.. This is probably the case. For moving the mob position, can just do X and Y +1 I would assume. Might make some mobs appear off the side of boats and stuff though :/
he's already using nearPosition with pi rotation to spawn them behind the fisher, so he's good on that part

GraveNET
Posts: 47
Joined: Mon Sep 23, 2013 8:05 am

Re: Fishing System 2.0

Post by GraveNET » Fri Jan 24, 2014 8:05 am

Apocalypse612 wrote:Fished up mobs probably have their own mob IDs, hence I would assume there can be a maximum amount of fished up mobs per time in one area. I'm not really sure on this, though. From what I remember from retail camping Devil Manta.. This is probably the case. For moving the mob position, can just do X and Y +1 I would assume. Might make some mobs appear off the side of boats and stuff though :/
I love how we all remember the devil manta fishing with 30 people around that lake :)
Yes in his instance you could only have 2 pugs and 2 crabs, anything else caught while they were on the surface was either items or the Manta.

Also if two people hooked the same mob - when the other person pulled it up first, typically the 1st person would get a message that released the catch saying, "You lacked the skill to catch" or some other generic statement.

I noticed you (@edgecom) said you had an issue with it attacking the player when pulled up, are the spawning claimed to the fisher?

EDGECOM
Posts: 50
Joined: Sat Aug 04, 2012 8:31 am

Re: Fishing System 2.0

Post by EDGECOM » Fri Jan 24, 2014 9:17 am

thank you lotus I am a derp I did try the enmity but I was using UpadteBaseEnmity witch never worked lol I have it working now I am writing in checks for mob example: if player dies or zones,logs etc

those other functios are for pets manly I did more poking.

here are a couple of screenshots don't mind the text messages I need to update them I am going to do that last

Image

Image

EDGECOM
Posts: 50
Joined: Sat Aug 04, 2012 8:31 am

Re: Fishing System 2.0

Post by EDGECOM » Fri Jan 24, 2014 9:44 am

I have one other question because we want to try and get close to retail I will need to add a column to the char that would only allow a certain number of fish to be caught per day. I never liked so I was thinking of just making the luck percent a global in the server setting that away server ops could change it if they need / want to.

by changing the luck you could make it like retail without having to modify the char table (At least in theory)

Post Reply