Player Specials Problems

2 views
Skip to first unread message

Nick Nabavian

unread,
May 5, 2007, 9:33:28 PM5/5/07
to GameDev360
So i have players based on classes:
strength, agility, accuracy, health

the problem im having is that i cant get the players to change to load
a particular datablock.
for example:

i have a 4 different datablocks for crossbow projectiles.
and i noticed in crossbowimage::onFire(...) there are calls to the
projectile datablock

at the top it looks i modified:

function CrossbowImage::onFire(%this, %obj, %slot)
{
//%projectile = %this.projectile //original
switch$(%this.playerClass.playerClassId)
{
case 1:
%projectile = CrossbowProjectileStrength; //modified
projectile datablock
case 2:
%projectile = CrossbowProjectileAccuracy; //modified
}
....//more code
}

I guess the problem is that there is no "this" associated with the
modified datablocks.
My question is how can i get this to work the way i want to?

Zeus

unread,
May 6, 2007, 3:12:14 PM5/6/07
to GameDev360
Are you expecting %this to be the player? If I remember correctly,
%obj is the player:
%obj.playerClass.playerClassId

Or this:
%obj.getDatablock().playerClass.playerClassId


Inside the Image::onFire method, %this is the Image Datablock and
%obj, if I recall correctly, the player it is mounted to. Remember,
that's Player, not PlayerData. If you need something from PlayerData
you call getDatablock.

Hope that helps.

~Zeus

Nick !

unread,
May 6, 2007, 6:15:19 PM5/6/07
to gamed...@googlegroups.com
Ahh that makes sense. Thanks for this. I will fiddle with this later. I appreciate the response.
Reply all
Reply to author
Forward
0 new messages