Scripts / Scripts dont work in 1.805

Author
Message
shakyshawn8151
10
Years of Service
User Offline
Joined: 9th Nov 2013
Location: United States
Posted: 21st Sep 2014 19:29
function fooditem3_init(e)
end



function fooditem3_main(e)
PlayerDX = g_Entity[e]['x'] - g_PlayerPosX;
PlayerDY = g_Entity[e]['y'] - g_PlayerPosY;
PlayerDZ = g_Entity[e]['z'] - g_PlayerPosZ;
PlayerDist = math.sqrt(math.abs(PlayerDX*PlayerDX)+math.abs(PlayerDY*PlayerDY)+math.abs(PlayerDZ*PlayerDZ));
if PlayerDist < 80 then
Prompt("Purple Herb = " .. fooditem3 .. " , press E to collect , charexp = " .. charexp)
if g_KeyPressE == 1 and pressed == 0 then
PlaySound(e,1);
fooditem3 = fooditem3 + 1
charexp = charexp + 10
pressed = 1
Destroy(e);

end
if g_KeyPressE == 0 then
pressed = 0
end
end
end

------Dead of Night----- Open World Zombie Horror!!

Youtube/ShakyShawn8151 > 10k Subs Celebration
shakyshawn8151
10
Years of Service
User Offline
Joined: 9th Nov 2013
Location: United States
Posted: 21st Sep 2014 19:29
why does this no longer work in current version? almost all of my scripts I made no longer work when using in current version.

------Dead of Night----- Open World Zombie Horror!!

Youtube/ShakyShawn8151 > 10k Subs Celebration
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 21st Sep 2014 20:23 Edited at: 21st Sep 2014 20:23
are you getting any error or do they simply not do anything?

have you defined all those variables somewhere? i dont see them in the script so im assuming you had them in the global file, did u put them back?

other than that i dont see any obvious issues

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 22nd Sep 2014 18:45
Yepp, scripting changed a little from earlier versions. You need to declare your variables at the start of the script now generally. You could still add them to your global or use require still (I think, not used it for some time since the changes in scripting) but it is so easy to include them in your scripts I tend to do that now. Globals are declared before your init code, if needed. Local files are normally set in the init part.



SPECS: Q6600 CPU. Nvidia 660GTX. 8 Gig Memory. Win 7.

Login to post a reply

Server time is: 2024-05-02 09:21:36
Your offset time is: 2024-05-02 09:21:36